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