diff --git a/ka-note/client/src/lib/components/JournalView.svelte b/ka-note/client/src/lib/components/JournalView.svelte
index 249ee92..8feb944 100644
--- a/ka-note/client/src/lib/components/JournalView.svelte
+++ b/ka-note/client/src/lib/components/JournalView.svelte
@@ -13,8 +13,9 @@
interface Props {
contextId: string;
+ journalScope?: 'business' | 'private';
}
- let { contextId }: Props = $props();
+ let { contextId, journalScope = 'business' }: Props = $props();
const isDailyLog = $derived(contextId === 'daily-log');
@@ -45,10 +46,10 @@
.toArray();
});
- // Filter journal entries by selected date
+ // Filter journal entries by selected date and scope
const filteredEntries = $derived(
($journalEntries ?? [])
- .filter(e => e.date === selectedDate)
+ .filter(e => e.date === selectedDate && (journalScope === 'private' ? !!e.isPrivate : !e.isPrivate))
.sort((a, b) => b.sortOrder - a.sortOrder)
);
@@ -86,15 +87,16 @@
}
}
+ const isPrivate = journalScope === 'private';
if (selectedLinkedContextId) {
const topic = await createTopic(selectedLinkedContextId, title);
if (body) {
- await createHistoryEntry(topic.id, selectedDate, body);
+ await createHistoryEntry(topic.id, selectedDate, body, null, false, isPrivate);
}
} else {
const text = body ? `${title}\n${body}` : title;
await getOrCreateJournalTopic();
- await createHistoryEntry(JOURNAL_TOPIC_ID, selectedDate, text, null, wiedervorlageChecked);
+ await createHistoryEntry(JOURNAL_TOPIC_ID, selectedDate, text, null, wiedervorlageChecked, isPrivate);
}
entryTitle = '';
@@ -186,12 +188,40 @@
}
return [...groups.entries()].sort(([a], [b]) => b.localeCompare(a));
});
+
+ // Birthday banner — filtered by scope
+ const allPersons = liveQuery(() =>
+ db.contexts.filter(c => !c.deletedAt && c.type === 'person').toArray()
+ );
+ const BUSINESS_SUBTYPES = new Set(['employee', 'colleague']);
+ const PRIVATE_SUBTYPES = new Set(['family', 'acquaintance']);
+ const birthdayPersons = $derived(
+ ($allPersons ?? []).filter(p => {
+ const meta = p.meta as { birthday?: string; personSubType?: string } | null;
+ const bd = meta?.birthday;
+ if (!bd || bd.slice(5) !== selectedDate.slice(5)) return false;
+ const sub = meta?.personSubType;
+ if (journalScope === 'private') return !!sub && PRIVATE_SUBTYPES.has(sub);
+ // business: employee/colleague/contact/undefined
+ return !sub || !PRIVATE_SUBTYPES.has(sub);
+ })
+ );
{#if isDailyLog}
selectedDate = d} />
+ {#if birthdayPersons.length > 0}
+
+ 🎂
+ Geburtstag heute:
+ {#each birthdayPersons as p}
+ {p.name}
+ {/each}
+
+ {/if}
+