import { useRef, useState } from "preact/hooks"; import appContext from "../../components/app_context.js"; import { closeActiveDialog, openDialog } from "../../services/dialog.js"; import { t } from "../../services/i18n.js"; import server from "../../services/server.js"; import toast from "../../services/toast.js"; 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"; interface BranchPrefixDialogProps { branch?: FBranch; } function BranchPrefixDialogComponent({ branch }: BranchPrefixDialogProps) { 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={