feat(reports): sales report-level empty state
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,8 @@ import {
|
|||||||
} from '@/lib/constants';
|
} from '@/lib/constants';
|
||||||
import { formatMoney } from '@/lib/reports/format-currency';
|
import { formatMoney } from '@/lib/reports/format-currency';
|
||||||
import type { ReportPayload } from '@/lib/reports/types';
|
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 { SalesPipelineFunnel } from './sales-pipeline-funnel';
|
||||||
import { SalesStageVelocity } from './sales-stage-velocity';
|
import { SalesStageVelocity } from './sales-stage-velocity';
|
||||||
@@ -211,6 +213,7 @@ interface SalesReportPayload {
|
|||||||
recentWins: RecentWinRow[];
|
recentWins: RecentWinRow[];
|
||||||
lostReasonBreakdown: LostReasonRow[];
|
lostReasonBreakdown: LostReasonRow[];
|
||||||
range: { from: string; to: string };
|
range: { from: string; to: string };
|
||||||
|
hasData: boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +277,7 @@ interface SalesTemplateConfig extends Record<string, unknown> {
|
|||||||
compare?: boolean;
|
compare?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SalesReportClient({ portSlug: _portSlug }: { portSlug: string }) {
|
export function SalesReportClient({ portSlug }: { portSlug: string }) {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const initialTemplateId = searchParams?.get('templateId') ?? null;
|
const initialTemplateId = searchParams?.get('templateId') ?? null;
|
||||||
|
|
||||||
@@ -345,6 +348,7 @@ export function SalesReportClient({ portSlug: _portSlug }: { portSlug: string })
|
|||||||
});
|
});
|
||||||
|
|
||||||
const kpis = query.data?.data.kpis;
|
const kpis = query.data?.data.kpis;
|
||||||
|
const data = query.data?.data;
|
||||||
const deltas = query.data?.data.comparison?.deltas ?? null;
|
const deltas = query.data?.data.comparison?.deltas ?? null;
|
||||||
const funnel = query.data?.data.funnel ?? [];
|
const funnel = query.data?.data.funnel ?? [];
|
||||||
const stageVelocity = query.data?.data.stageVelocity ?? [];
|
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 (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<PageHeader
|
<PageHeader
|
||||||
|
|||||||
Reference in New Issue
Block a user