From f9fa99f5ffd341184b9c2885c28abb3c7ab6d897 Mon Sep 17 00:00:00 2001 From: JCEEE <0xjceee@proton.me> Date: Mon, 14 Sep 2026 21:29:10 +0100 Subject: [PATCH] fix bugs --- frontend/src/lib/components/Chat.svelte | 2 +- frontend/src/lib/components/TopNav.svelte | 4 ++++ .../src/lib/server/services/completions.ts | 20 ++++++++--------- frontend/src/routes/[fam]/+layout.svelte | 22 ++++++++++--------- .../src/routes/[fam]/[username]/+page.svelte | 7 +++--- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/frontend/src/lib/components/Chat.svelte b/frontend/src/lib/components/Chat.svelte index 3b51faf..f9167c8 100644 --- a/frontend/src/lib/components/Chat.svelte +++ b/frontend/src/lib/components/Chat.svelte @@ -208,7 +208,7 @@ {msg.authorName} {/if}
- {#each renderContent(msg.content) as seg (msg.id + ':' + seg.text)} + {#each renderContent(msg.content) as seg, i (msg.id + ':' + i)} {#if seg.mention} + import type { Snippet } from 'svelte'; let { announcement = '', role = '', seasons = [], connected = true, children, + left }: { announcement?: string role?: string seasons?: { id: string; name: string; color: string; active: boolean }[] connected?: boolean children?: any + left?: Snippet } = $props(); @@ -19,6 +22,7 @@ {#if role} {role} {/if} + {@render left?.()} = '${from}' && date < '${to}'`; - } else if (isTodo) { + if (isTodo) { filter = `assignedChoreId = '${assignedChoreId}' && memberId = '${memberId}'`; } else { const { payday, tz } = await famMetaSU(famId); @@ -78,8 +77,8 @@ export async function toggle(pb: any, famId: string, memberId: string, body: { a if (isTodo && existing[0].rewardId) { await pb.collection('rewards').delete(existing[0].rewardId).catch(() => {}); } - // If this was a shared chore claimed by this member, un-share it - if (isShared && existing[0].memberId === memberId) { + // If this was a claimed one-off todo, release it back to shared. + if (isClaimable && existing[0].memberId === memberId) { await claimChore(assignedChoreId, famId, ''); } evaluateFam(pb, famId).catch(() => {}); @@ -107,8 +106,9 @@ export async function toggle(pb: any, famId: string, memberId: string, body: { a completedAt: new Date().toISOString(), ...(rewardId ? { rewardId } : {}) }); - // Claim the shared chore by setting memberId - if (isShared) { + // Claim a shared one-off todo by setting memberId (recurring shared + // chores stay unassigned — see isClaimable above). + if (isClaimable) { await claimChore(assignedChoreId, famId, memberId); } evaluateFam(pb, famId).catch(() => {}); diff --git a/frontend/src/routes/[fam]/+layout.svelte b/frontend/src/routes/[fam]/+layout.svelte index fe49b8c..f7c2770 100644 --- a/frontend/src/routes/[fam]/+layout.svelte +++ b/frontend/src/routes/[fam]/+layout.svelte @@ -306,6 +306,18 @@ announcement={disabled && !activating ? accessMessage(accessReason, isParent) : ''} connected={!famStore.connectionDown} > + {#snippet left()} + + {/snippet} {/if} -
diff --git a/frontend/src/routes/[fam]/[username]/+page.svelte b/frontend/src/routes/[fam]/[username]/+page.svelte index 2b72284..b05f85d 100644 --- a/frontend/src/routes/[fam]/[username]/+page.svelte +++ b/frontend/src/routes/[fam]/[username]/+page.svelte @@ -550,9 +550,10 @@ const name = bonusConfigs.find((b: BonusConfig) => b.id === r.bonusConfigId)?.name || r.label; map.set(name, (map.get(name) || 0) + 1); } - // Only badge recurring/multiple bonuses — a single occurrence (×1) is - // already obvious from the wallet, so it just adds noise here. - return [...map.entries()].map(([name, count]) => ({ name, count })).filter((t) => t.count > 1); + // Badge every bonus earned this week — including a single occurrence + // (×1): the hero is the child's only at-a-glance signal, so nothing + // earned should stay invisible here. + return [...map.entries()].map(([name, count]) => ({ name, count })); }); let anyWeekBonuses = $derived(weekRewards.length > 0);