Skip to content

Commit 9aea35c

Browse files
fix: resolve TypeScript strict mode errors in dashboard and insights (#8)
Co-authored-by: Ofer Shapira <ofershap@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 6b82df5 commit 9aea35c

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/app/dashboard-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function buildDailySpendData(breakdown: SpendBreakdownRow[]): {
422422
const point = byDate.get(row.date) as Record<string, number>;
423423
const firstName = row.name.split(" ")[0] ?? row.name;
424424
const dollars = row.spend_cents / 100;
425-
point.total += dollars;
425+
point.total = (point.total ?? 0) + dollars;
426426
if (topNames.includes(firstName)) {
427427
point[firstName] = (point[firstName] as number) + dollars;
428428
} else {

src/app/insights/insights-client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function InsightsClient({ data }: { data: InsightsData }) {
150150
if (!byDate.has(entry.date)) byDate.set(entry.date, { _total: 0 });
151151
const row = byDate.get(entry.date) as Record<string, number>;
152152
row[model] = (row[model] ?? 0) + entry.messages;
153-
row._total += entry.messages;
153+
row._total = (row._total ?? 0) + entry.messages;
154154
}
155155
const result: Array<Record<string, string | number>> = [];
156156
for (const [date, row] of [...byDate.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
@@ -658,7 +658,7 @@ function ModelEfficiencySection({ data }: { data: ModelEfficiencyEntry[] }) {
658658
<LabelList
659659
dataKey="precision_pct"
660660
position="right"
661-
formatter={(v: number) => `${v}%`}
661+
formatter={(v) => `${v ?? ""}%`}
662662
style={{ fontSize: 10, fill: "#a1a1aa", fontFamily: "monospace" }}
663663
/>
664664
</Bar>

src/components/dashboard/members-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function rankBadge(rank: number) {
2121
return `#${rank}`;
2222
}
2323

24-
function SortIcon({ active, asc }: { active: boolean; asc: boolean }) {
24+
function SortIcon({ active, asc }: { col?: string; active: boolean; asc: boolean }) {
2525
if (!active) return <span className="text-zinc-700 ml-0.5"></span>;
2626
return <span className="text-blue-400 ml-0.5">{asc ? "↑" : "↓"}</span>;
2727
}

0 commit comments

Comments
 (0)