diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsx index e4b7d3e59..fb3b24294 100644 --- a/apps/client/src/widgets/dialogs/branch_prefix.tsx +++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx @@ -1,6 +1,6 @@ import { useRef, useState } from "preact/hooks"; import appContext from "../../components/app_context.js"; -import { closeActiveDialog, openDialog } from "../../services/dialog.js"; +import { closeActiveDialog } from "../../services/dialog.js"; import { t } from "../../services/i18n.js"; import server from "../../services/server.js"; import toast from "../../services/toast.js"; @@ -8,56 +8,18 @@ import Modal from "../react/Modal.jsx"; import ReactBasicWidget from "../react/ReactBasicWidget.js"; import froca from "../../services/froca.js"; import tree from "../../services/tree.js"; -import FBranch from "../../entities/fbranch.js"; import Button from "../react/Button.jsx"; import FormGroup from "../react/FormGroup.js"; +import useTriliumEvent from "../react/hooks.jsx"; +import FBranch from "../../entities/fbranch.js"; -interface BranchPrefixDialogProps { - branch?: FBranch; -} - -function BranchPrefixDialogComponent({ branch }: BranchPrefixDialogProps) { +function BranchPrefixDialogComponent() { + const [ shown, setShown ] = useState(false); + const [ branch, setBranch ] = useState(); const [ prefix, setPrefix ] = useState(branch?.prefix ?? ""); const branchInput = useRef(null); - async function onSubmit() { - if (!branch) { - return; - } - - savePrefix(branch.branchId, prefix); - closeActiveDialog(); - } - - return ( - branchInput.current?.focus()} - onSubmit={onSubmit} - helpPageId="TBwsyfadTA18" - footer={