create note added

This commit is contained in:
2026-02-27 14:40:10 -06:00
parent 1a497a98e8
commit 20a19006d5
3 changed files with 101 additions and 7 deletions
+11 -2
View File
@@ -21,7 +21,12 @@ export const NotepadView: Component<{
const currentUserId = pb.authStore.model?.id;
// Derived states
const activeNote = createMemo(() => store.notes.find(n => n.id === props.selectedNoteId) || null);
const activeNote = createMemo(() => {
const id = props.selectedNoteId?.trim();
const note = store.notes.find(n => n.id === id) || null;
console.log('[DEBUG NotepadView] store.notes length:', store.notes.length, 'selectedNoteId:', id, 'found Note:', !!note);
return note;
});
const handleUpdateNote = async (id: string, data: Partial<Note>) => {
try {
@@ -148,7 +153,11 @@ export const NotepadView: Component<{
)}>
<Show when={activeNote()} fallback={
<div class="text-center space-y-4 opacity-40 select-none">
<p class="text-sm font-medium tracking-wide">Select a note or create a new one</p>
<Show when={props.selectedNoteId && store.notes.length === 0} fallback={
<p class="text-sm font-medium tracking-wide">Select a note or create a new one</p>
}>
<p class="text-sm font-medium tracking-wide">Loading note...</p>
</Show>
</div>
}>
{(note) => {