diff --git a/ka-note/VERSION b/ka-note/VERSION index a2ece8c..bc08bb2 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.87 \ No newline at end of file +1.1.89 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/PersonList.svelte b/ka-note/client/src/lib/components/PersonList.svelte index 456d118..3b9b9f2 100644 --- a/ka-note/client/src/lib/components/PersonList.svelte +++ b/ka-note/client/src/lib/components/PersonList.svelte @@ -16,15 +16,35 @@ const subTypeLabels: Record = { contact: 'Kontakt', employee: 'Mitarbeiter', - colleague: 'Kollege' + colleague: 'Kollege', + family: 'Familie', + acquaintance: 'Bekannte/r' }; const subTypeColors: Record = { contact: 'bg-[#555] text-[#ccc]', employee: 'bg-accent/30 text-accent', - colleague: 'bg-[#00b894]/30 text-[#00b894]' + colleague: 'bg-[#00b894]/30 text-[#00b894]', + family: 'bg-pink-900/40 text-pink-300', + acquaintance: 'bg-purple-900/40 text-purple-300' }; + function formatDate(iso: string): string { + const [y, m, d] = iso.split('-'); + return `${d}.${m}.${y}`; + } + + function tenure(joinDate: string): string { + const start = new Date(joinDate); + const now = new Date(); + let years = now.getFullYear() - start.getFullYear(); + let months = now.getMonth() - start.getMonth(); + if (months < 0) { years--; months += 12; } + if (years > 0 && months > 0) return `${years} J. ${months} Mo.`; + if (years > 0) return `${years} J.`; + return `${months} Mo.`; + } + let confirmDeleteId = $state(null); let confirmDeleteName = $state(''); @@ -42,7 +62,10 @@ {#if persons.length > 0}
{#each persons as ctx, i (ctx.id)} - {@const subType = ((ctx.meta as PersonMeta | null)?.personSubType ?? 'contact') as PersonSubType} + {@const meta = ctx.meta as PersonMeta | null} + {@const subType = (meta?.personSubType ?? 'contact') as PersonSubType} + {@const showBirthday = subType === 'family' || subType === 'employee' || subType === 'colleague'} + {@const showTenure = subType === 'employee' && !!meta?.joinDate}
@@ -58,7 +81,15 @@ onclick={() => goto(`/context/${ctx.id}`)} > {displayName(ctx.name)} - {subTypeLabels[subType]} + + {#if showBirthday && meta?.birthday} + 🎂 {formatDate(meta.birthday)} + {/if} + {#if showTenure && meta?.joinDate} + ⏱ {tenure(meta.joinDate)} + {/if} + {subTypeLabels[subType]} +
@@ -57,5 +77,20 @@ {#if createError}

{createError}

{/if} {/if} - +
+ {#each tabs as tab} + {@const count = tab.key === 'all' ? persons.length : persons.filter(c => ((c.meta as PersonMeta | null)?.personSubType ?? 'contact') === tab.key).length} + {#if count > 0 || tab.key === 'all'} + + {/if} + {/each} +
+ +
diff --git a/ka-note/server/ka-note.db-wal b/ka-note/server/ka-note.db-wal index d78ed95..bc8ccad 100644 Binary files a/ka-note/server/ka-note.db-wal and b/ka-note/server/ka-note.db-wal differ