Fix type changes, tag navigation, and routing cleanup

- set_entry removes entry from old bucket when type changes (fixes duplicates)
- PUT /api/entries/:id now accepts type field
- Tag clicks navigate via URL (#type/x/tag/y or #tag/y) instead of mutating state
- Replace magic 'all' hash with empty hash as the all-entries route
- Clickable tags in entry detail view
- Tag filter dropdown updates URL

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 15:56:42 +00:00
parent 25c8f98b7f
commit 40722310ae
3 changed files with 44 additions and 9 deletions

View File

@@ -127,6 +127,15 @@ export function get_entry(id) {
}
export function set_entry(entry) {
// Remove from any other bucket in case type changed
for (const t of Object.keys(store.get('entry_types') ?? {})) {
if (t === entry.type) { continue; }
const bucket = store.get(t);
if (bucket?.[entry.id]) {
delete bucket[entry.id];
store.set(t, bucket);
}
}
const bucket = store.get(entry.type) ?? {};
bucket[entry.id] = entry;
store.set(entry.type, bucket);