diff --git a/apps/web/src/components/importer/components/file-provider-handler.tsx b/apps/web/src/components/importer/components/file-provider-handler.tsx index ec2aabbfb..43af0c63e 100644 --- a/apps/web/src/components/importer/components/file-provider-handler.tsx +++ b/apps/web/src/components/importer/components/file-provider-handler.tsx @@ -53,6 +53,9 @@ export function FileProviderHandler(props: FileProviderHandlerProps) { }); const [totalNoteCount, setTotalNoteCount] = useState(0); const [_, setCounter] = useState(0); + const [colornotePassword, setColornotePassword] = useState< + string | undefined + >(undefined); const logs = useRef([]); const onDrop = useCallback((acceptedFiles: File[]) => { @@ -103,6 +106,9 @@ export function FileProviderHandler(props: FileProviderHandlerProps) { }, reporter: () => { setTotalNoteCount(++totalNotes); + }, + options: { + colornote: { password: colornotePassword } } }; @@ -224,6 +230,25 @@ export function FileProviderHandler(props: FileProviderHandlerProps) { + + {files.length > 0 && provider.id === "colornote" && ( + + Colornote password + setColornotePassword(e.target.value)} + /> + + )} + {files.length > 0 ? ( = { yellow: "#FFC107" }; -/** - * TODO: add support for trashed notes and reminders - */ export async function importNote(note: Note) { const encryptedAttachmentFieldsMap = await processAttachments( note.attachments @@ -117,6 +114,10 @@ async function processNote( if (!noteId) return; + if (note.archived) { + await db.notes.archive(true, noteId); + } + for (const tag of note.tags || []) { const tagId = (await db.tags.find(tag))?.id || @@ -165,6 +166,24 @@ async function processNote( for (const notebookId of notebookIds) await db.notes.addToNotebook(notebookId, noteId); } + + if (note.reminder) { + const reminderId = await db.reminders.add({ + recurringMode: note.reminder.recurringMode, + mode: note.reminder.mode, + selectedDays: note.reminder.selectedDays, + date: note.reminder.date, + title: note.reminder.title, + description: note.reminder.description + }); + + if (reminderId) { + await db.relations.add( + { id: noteId, type: "note" }, + { id: reminderId, type: "reminder" } + ); + } + } } async function importNotebook(