feat(reports): sales report-level empty state

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 10:17:56 +02:00
parent 7cf364e03a
commit 24e88ae32e

View File

@@ -36,6 +36,8 @@ import {
} from '@/lib/constants';
import { formatMoney } from '@/lib/reports/format-currency';
import type { ReportPayload } from '@/lib/reports/types';
import { ReportEmptyState } from '@/components/reports/shared/report-empty-state';
import type { Route } from 'next';
import { SalesPipelineFunnel } from './sales-pipeline-funnel';
import { SalesStageVelocity } from './sales-stage-velocity';
@@ -211,6 +213,7 @@ interface SalesReportPayload {
recentWins: RecentWinRow[];
lostReasonBreakdown: LostReasonRow[];
range: { from: string; to: string };
hasData: boolean;
};
}
@@ -274,7 +277,7 @@ interface SalesTemplateConfig extends Record<string, unknown> {
compare?: boolean;
}
export function SalesReportClient({ portSlug: _portSlug }: { portSlug: string }) {
export function SalesReportClient({ portSlug }: { portSlug: string }) {
const searchParams = useSearchParams();
const initialTemplateId = searchParams?.get('templateId') ?? null;
@@ -345,6 +348,7 @@ export function SalesReportClient({ portSlug: _portSlug }: { portSlug: string })
});
const kpis = query.data?.data.kpis;
const data = query.data?.data;
const deltas = query.data?.data.comparison?.deltas ?? null;
const funnel = query.data?.data.funnel ?? [];
const stageVelocity = query.data?.data.stageVelocity ?? [];
@@ -594,6 +598,25 @@ export function SalesReportClient({ portSlug: _portSlug }: { portSlug: string })
};
}
if (!query.isLoading && data && !data.hasData) {
return (
<div className="space-y-6">
<PageHeader
eyebrow="Reports"
title="Sales performance"
description="Rep performance, win rates, pipeline value, stalled deals, and deal heat."
/>
<ReportEmptyState
icon={TrendingUp}
title="No sales activity yet"
body="Once you add clients and log interests, this report fills with win rates, pipeline value, and deal heat."
actionLabel="Add an interest"
actionHref={`/${portSlug}/interests` as Route}
/>
</div>
);
}
return (
<div className="space-y-6">
<PageHeader