bcfee45bd7
Implements Task 4: base.html DaisyUI/Alpine shell, notes autosave panel, nav.py phase switching with downstream stale marking, notes.py save/get endpoints, state debug endpoint, and stub /triage route for test support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
909 B
JavaScript
35 lines
909 B
JavaScript
function notesApp(initialNotes, albumId) {
|
|
return {
|
|
open: false,
|
|
notes: initialNotes,
|
|
status: '',
|
|
saveTimer: null,
|
|
|
|
scheduleAutosave() {
|
|
clearTimeout(this.saveTimer);
|
|
this.status = 'Saving…';
|
|
this.saveTimer = setTimeout(() => this.doSave(), 500);
|
|
},
|
|
|
|
async doSave() {
|
|
const res = await fetch('/notes/save', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ album_id: albumId, notes: this.notes }),
|
|
});
|
|
this.status = res.ok ? 'Saved ✓' : 'Error';
|
|
},
|
|
|
|
async convertToEntry(text) {
|
|
const res = await fetch('/group/from-note', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ album_id: albumId, text }),
|
|
});
|
|
if (res.ok) {
|
|
this.status = 'Added as entry ✓';
|
|
}
|
|
},
|
|
};
|
|
}
|