From 21b892ec448e3e9f46623d8c233def42201cd9ca Mon Sep 17 00:00:00 2001 From: oshankkkk Date: Sat, 11 Apr 2026 07:58:11 +0530 Subject: [PATCH 1/7] feat: add note options frontend --- frontend/src/Puffnote.tsx | 10 ++-------- frontend/src/components/Options.tsx | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 frontend/src/components/Options.tsx diff --git a/frontend/src/Puffnote.tsx b/frontend/src/Puffnote.tsx index e092e90..1730b68 100644 --- a/frontend/src/Puffnote.tsx +++ b/frontend/src/Puffnote.tsx @@ -6,6 +6,7 @@ import { SignUpButton, } from "@clerk/clerk-react"; import { Editor } from "./components/Editor"; +import { Options } from "./components/Options"; import { Sidebar } from "./components/Sidebar"; import { useNotes } from "./hooks/useNotes"; @@ -35,14 +36,7 @@ function NotesApp() { onToggle={() => setSidebarOpen(!sidebarOpen)} />
-
- -
+
diff --git a/frontend/src/components/Options.tsx b/frontend/src/components/Options.tsx new file mode 100644 index 0000000..323dc1a --- /dev/null +++ b/frontend/src/components/Options.tsx @@ -0,0 +1,20 @@ +export function Options() { + return ( +
+
+ + +
+
+ ); +} From 2659072c2e0ff7ad02b0bb152a4990734584040f Mon Sep 17 00:00:00 2001 From: oshankkkk Date: Sat, 11 Apr 2026 09:01:28 +0530 Subject: [PATCH 2/7] feat: add import files frontend routing and file input --- frontend/src/Puffnote.tsx | 3 ++- frontend/src/components/Options.tsx | 31 +++++++++++++++++++++- frontend/src/hooks/useNotes.ts | 40 +++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/frontend/src/Puffnote.tsx b/frontend/src/Puffnote.tsx index 1730b68..8da1d87 100644 --- a/frontend/src/Puffnote.tsx +++ b/frontend/src/Puffnote.tsx @@ -17,6 +17,7 @@ function NotesApp() { activeNote, setActiveIndex, createNote, + handleImportNotes, updateNoteContent, renameNote, deleteNote, @@ -36,7 +37,7 @@ function NotesApp() { onToggle={() => setSidebarOpen(!sidebarOpen)} />
- +
diff --git a/frontend/src/components/Options.tsx b/frontend/src/components/Options.tsx index 323dc1a..df1946f 100644 --- a/frontend/src/components/Options.tsx +++ b/frontend/src/components/Options.tsx @@ -1,6 +1,34 @@ -export function Options() { +import { useRef, type ChangeEvent } from "react"; + +type Props = { + onImportNotes: (file: File) => Promise | void; +}; + +export function Options({ onImportNotes }: Props) { + const fileInputRef = useRef(null); + + function handleImportButtonClick() { + if (!fileInputRef.current) return; + fileInputRef.current.value = ""; + fileInputRef.current.click(); + } + + function handleFileChange(event: ChangeEvent) { + const file = event.target.files?.[0]; + if (!file) return; + + void onImportNotes(file); + event.target.value = ""; + } + return (
+