feat(blamy-notes): local + DB + git notes with login sync#11
Open
obvious-autobuild[bot] wants to merge 1 commit into
Open
feat(blamy-notes): local + DB + git notes with login sync#11obvious-autobuild[bot] wants to merge 1 commit into
obvious-autobuild[bot] wants to merge 1 commit into
Conversation
Give blamy-notes three first-class ways to store a note, all sharing one
markdown content model:
- Local notes — usable with no login, persisted in localStorage. A guest
mode ("Continue without logging in") shows a local-mode banner with a
Log in / Register action.
- Saved notes (DB) — markdown persisted server-side in Netlify Blobs,
namespaced per authenticated user (sub) via new /api/notes/* routes.
- Git notes — the existing GitHub .md flow, unchanged.
On login, all local notes are uploaded to the user's DB store (a local note
is removed only after its DB copy succeeds, so a partial failure loses
nothing) and the banner clears.
New:
- src/lib/storage.ts — NotesStorage interface + Local/Db adapters
- src/lib/sync.ts — guest→authed login sync
- src/components/local-mode-banner.tsx
- netlify/functions/lib/notes.ts — per-user Netlify Blobs CRUD
Changed:
- auth-provider.tsx — "guest" status + useAuth() hook
- api.mts — authenticated /api/notes/* group
- App.tsx — branch sidebar/editor on note source
Netlify PR PreviewsBase:
Replay QA
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three first-class ways to store a note in blamy-notes, all sharing one markdown content model. The three sources differ only in where the markdown is persisted.
localStorage(index + per-note bodies)sub.mdfiles (existing flow)What changed
src/lib/storage.ts—NotesStorageinterface (list/get/create/save/remove) withLocalNotesStorage+DbNotesStorage; unifiedNoteRef/NoteData.src/lib/sync.ts— on guest→authenticated, upload each local note viaPOST /api/notes; a local note is deleted only after its DB create succeeds (partial failure loses nothing).src/components/auth-provider.tsx— adds"guest"status +useAuth()hook ({ status, setStatus, login, logout }); "Continue without logging in" persisted inlocalStorage["blamy_guest"].src/components/local-mode-banner.tsx— persistent banner in guest mode with a Log in / Register action (existing Auth0 flow).netlify/functions/api.mts+lib/notes.ts— authenticated/api/notes/*CRUD backed by per-user Netlify Blobs.App.tsx— sidebar groups notes by source (Saved this device [guest] / Saved notes [DB] / Git repos); "New note" writes to the active store; git commit/PR flow unchanged.Acceptance criteria
🔗 Obvious Project · 🧵 Obvious Thread