diff --git a/src/features/regulations/draft-actions.tsx b/src/features/regulations/draft-actions.tsx index b8c8df0..efde330 100644 --- a/src/features/regulations/draft-actions.tsx +++ b/src/features/regulations/draft-actions.tsx @@ -26,36 +26,67 @@ import type { Draft } from "./regulations.contract" const TITLE_MAX = 120 /** - * A draft's own actions, as a "More actions" menu for the page header: rename it and, while it's a bozza, delete it. + * A draft's own actions for the page header: rename it and, while it's a bozza, delete it. `menu` groups them in a + * "More actions" menu; `inline` shows each as an icon button with its tooltip (the editor's header). * Renders nothing when the viewer may do neither. */ -export function DraftActions({ draft }: { draft: Pick }) { +export function DraftActions({ + draft, + layout = "menu", +}: { + draft: Pick + layout?: "menu" | "inline" +}) { const [renameOpen, setRenameOpen] = useState(false) const [deleteOpen, setDeleteOpen] = useState(false) const renameKey = useOpenGeneration(renameOpen) if (!draft.can.rename && !draft.can.delete) return null return ( <> - - } - /> - + {layout === "inline" ? ( + <> {draft.can.rename ? ( - setRenameOpen(true)}> - - Rinomina - + setRenameOpen(true)} + /> ) : null} - {draft.can.rename && draft.can.delete ? : null} {draft.can.delete ? ( - setDeleteOpen(true)}> - - Elimina bozza - + setDeleteOpen(true)} + /> ) : null} - - + + ) : ( + + } + /> + + {draft.can.rename ? ( + setRenameOpen(true)}> + + Rinomina + + ) : null} + {draft.can.rename && draft.can.delete ? : null} + {draft.can.delete ? ( + setDeleteOpen(true)}> + + Elimina bozza + + ) : null} + + + )} {draft.can.rename ? ( ) : null} diff --git a/src/features/regulations/editor/editor-page.tsx b/src/features/regulations/editor/editor-page.tsx index 9d1796c..9911251 100644 --- a/src/features/regulations/editor/editor-page.tsx +++ b/src/features/regulations/editor/editor-page.tsx @@ -34,6 +34,7 @@ import { Button } from "@/components/ui/button" import { useFillHeight } from "@/features/esign/use-fill-height" import { cn } from "@/lib/utils" +import { DraftActions } from "../draft-actions" import { parseDocument, type StructureNode } from "../latex-structure" import { MembersDialog } from "../members-dialog" import { downloadPdf, PdfDialog, usePdfDialog } from "../pdf-dialog" @@ -412,6 +413,7 @@ export function EditorPage({ draft, members }: { draft: Draft; members: Assignme Condividi ) : null} +