diff --git a/apps/web/src/components/dialogs/move-note-dialog.tsx b/apps/web/src/components/dialogs/move-note-dialog.tsx index 19e7f33e3..0d973b935 100644 --- a/apps/web/src/components/dialogs/move-note-dialog.tsx +++ b/apps/web/src/components/dialogs/move-note-dialog.tsx @@ -30,7 +30,6 @@ import { showToast } from "../../utils/toast"; import { pluralize } from "../../utils/string"; import { isMac } from "../../utils/platform"; import create from "zustand"; -import { usePersistentState } from "../../hooks/use-persistent-state"; type MoveDialogProps = { onClose: Perform; noteIds: string[] }; type NotebookReference = { @@ -45,7 +44,11 @@ type Item = { title: string; }; type Topic = Item & { notebookId: string }; -type Notebook = Item & { topics: Topic[]; dateCreated: number }; +type Notebook = Item & { + topics: Topic[]; + dateCreated: number; + dateModified: number; +}; interface ISelectionStore { selected: NotebookReference[]; @@ -61,13 +64,9 @@ export const useSelectionStore = create((set) => ({ })); function MoveDialog({ onClose, noteIds }: MoveDialogProps) { - const { selected, setIsMultiselect, isMultiselect, setSelected } = - useSelectionStore(); - - const [suggestion, setSuggestion] = usePersistentState( - "link-notebooks:suggestion", - [] - ); + const setSelected = useSelectionStore((store) => store.setSelected); + const setIsMultiselect = useSelectionStore((store) => store.setIsMultiselect); + const isMultiselect = useSelectionStore((store) => store.isMultiselect); const refreshNotebooks = useStore((store) => store.refresh); const notebooks = useStore((store) => store.notebooks); @@ -123,9 +122,8 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) { width={450} positiveButton={{ text: "Done", - disabled: !selected.length, onClick: async () => { - setSuggestion(selected); + const { selected } = useSelectionStore.getState(); for (const item of selected) { try { if (item.op === "remove") { @@ -145,9 +143,7 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) { if (stringified) { showToast( "success", - `${pluralize(noteIds.length, "note", "notes")} ${stringified - .replace("Add", "added") - .replace("remove", "removed")}` + `${pluralize(noteIds.length, "note", "notes")} ${stringified}` ); } @@ -163,8 +159,9 @@ function MoveDialog({ onClose, noteIds }: MoveDialogProps) {