diff --git a/src/components/section-cards.tsx b/src/components/section-cards.tsx
index fb469fb..596c1d1 100644
--- a/src/components/section-cards.tsx
+++ b/src/components/section-cards.tsx
@@ -83,17 +83,18 @@ export function SectionCards() {
rateLabel: "Taxa indisponível",
}
}
- const current = dashboard.resolution.resolvedLast7d ?? 0
- const previous = dashboard.resolution.previousResolved ?? 0
- const deltaPercentage = dashboard.resolution.deltaPercentage ?? null
+ const current = dashboard?.resolution?.resolvedLast7d ?? 0
+ const previous = dashboard?.resolution?.previousResolved ?? 0
+ const deltaPercentage = dashboard?.resolution?.deltaPercentage ?? null
const positive = deltaPercentage !== null ? deltaPercentage >= 0 : current >= previous
const badgeLabel = deltaPercentage !== null
? `${deltaPercentage >= 0 ? "+" : ""}${deltaPercentage.toFixed(1)}%`
: previous > 0
? `${current - previous >= 0 ? "+" : ""}${current - previous}`
: "Sem histórico"
- const rateLabel = dashboard.resolution.rate !== null
- ? `${dashboard.resolution.rate.toFixed(1)}% dos tickets foram resolvidos`
+ const rate = dashboard?.resolution?.rate ?? null
+ const rateLabel = rate !== null
+ ? `${rate.toFixed(1)}% dos tickets foram resolvidos`
: "Taxa indisponível"
return { positive, badgeLabel, rateLabel }
}, [dashboard])
@@ -137,7 +138,9 @@ export function SectionCards() {
1ª resposta
- {dashboard ? formatMinutes(dashboard.firstResponse.averageMinutes) : }
+ {dashboard?.firstResponse
+ ? formatMinutes(dashboard.firstResponse.averageMinutes)
+ : }
- {dashboard
+ {dashboard?.firstResponse
? `${dashboard.firstResponse.responsesCount} tickets com primeira resposta`
: "Carregando amostra"}
@@ -169,12 +172,12 @@ export function SectionCards() {
Tickets aguardando ação
- {dashboard ? dashboard.awaitingAction.total : }
+ {dashboard?.awaitingAction ? dashboard.awaitingAction.total : }
- {dashboard ? `${dashboard.awaitingAction.atRisk} em risco` : "—"}
+ {dashboard?.awaitingAction ? `${dashboard.awaitingAction.atRisk} em risco` : "—"}
@@ -191,7 +194,7 @@ export function SectionCards() {
(7 dias)
- {dashboard ? dashboard.resolution.resolvedLast7d : }
+ {dashboard?.resolution ? dashboard.resolution.resolvedLast7d : }