fix: render insights with nullable calendar data
This commit is contained in:
@@ -236,13 +236,13 @@
|
||||
<p class="text-muted-foreground mt-2 text-sm leading-7">{insight.copy.future90Days.body}</p>
|
||||
</article>
|
||||
{/if}
|
||||
{#if insight.calendarContext.length}
|
||||
{#if insight.calendarContext?.length}
|
||||
<div>
|
||||
<h3 class="flex items-center gap-2 text-sm font-bold">
|
||||
<CalendarDaysIcon class="size-4" /> رویدادهای مرتبط
|
||||
</h3>
|
||||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
{#each insight.calendarContext as event}<span
|
||||
{#each insight.calendarContext ?? [] as event}<span
|
||||
class={`rounded-md border px-3 py-2 text-xs ${eventTone(event.tone)}`}
|
||||
>{event.titleFa} · {formatDate(event.startDate)}</span
|
||||
>{/each}
|
||||
|
||||
@@ -51,7 +51,7 @@ const insight: AIInsight = {
|
||||
options: [],
|
||||
},
|
||||
evidence: {},
|
||||
calendarContext: [],
|
||||
calendarContext: null as unknown as AIInsight['calendarContext'],
|
||||
refreshState: { state: 'IDLE' },
|
||||
sectionRefreshState: {},
|
||||
generatedAt: '2026-08-22T00:00:00Z',
|
||||
|
||||
Reference in New Issue
Block a user