feat: add call-to-action links in zero-state dashboard stats cards (refs #179)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-13 19:45:14 -06:00
parent 0dc273d238
commit accb0533c6
2 changed files with 30 additions and 4 deletions

View File

@@ -112,7 +112,7 @@ export const DashboardScreen: React.FC<DashboardScreenProps> = ({
<PendingAssociationBanner onViewPending={() => setShowPendingReceipts(true)} /> <PendingAssociationBanner onViewPending={() => setShowPendingReceipts(true)} />
{/* Summary Cards */} {/* Summary Cards */}
<SummaryCards summary={summary} /> <SummaryCards summary={summary} onNavigate={onNavigate} />
{/* Vehicles Needing Attention */} {/* Vehicles Needing Attention */}
{vehiclesNeedingAttention && vehiclesNeedingAttention.length > 0 && ( {vehiclesNeedingAttention && vehiclesNeedingAttention.length > 0 && (

View File

@@ -9,18 +9,22 @@ import BuildRoundedIcon from '@mui/icons-material/BuildRounded';
import LocalGasStationRoundedIcon from '@mui/icons-material/LocalGasStationRounded'; import LocalGasStationRoundedIcon from '@mui/icons-material/LocalGasStationRounded';
import { GlassCard } from '../../../shared-minimal/components/mobile/GlassCard'; import { GlassCard } from '../../../shared-minimal/components/mobile/GlassCard';
import { DashboardSummary } from '../types'; import { DashboardSummary } from '../types';
import { MobileScreen } from '../../../core/store';
interface SummaryCardsProps { interface SummaryCardsProps {
summary: DashboardSummary; summary: DashboardSummary;
onNavigate?: (screen: MobileScreen) => void;
} }
export const SummaryCards: React.FC<SummaryCardsProps> = ({ summary }) => { export const SummaryCards: React.FC<SummaryCardsProps> = ({ summary, onNavigate }) => {
const cards = [ const cards = [
{ {
title: 'Total Vehicles', title: 'Total Vehicles',
value: summary.totalVehicles, value: summary.totalVehicles,
icon: DirectionsCarRoundedIcon, icon: DirectionsCarRoundedIcon,
color: 'primary.main', color: 'primary.main',
ctaText: 'Add a vehicle',
ctaScreen: 'Vehicles' as MobileScreen,
}, },
{ {
title: 'Upcoming Maintenance', title: 'Upcoming Maintenance',
@@ -28,6 +32,8 @@ export const SummaryCards: React.FC<SummaryCardsProps> = ({ summary }) => {
subtitle: 'Next 30 days', subtitle: 'Next 30 days',
icon: BuildRoundedIcon, icon: BuildRoundedIcon,
color: 'primary.main', color: 'primary.main',
ctaText: 'Schedule maintenance',
ctaScreen: 'Maintenance' as MobileScreen,
}, },
{ {
title: 'Recent Fuel Logs', title: 'Recent Fuel Logs',
@@ -35,6 +41,8 @@ export const SummaryCards: React.FC<SummaryCardsProps> = ({ summary }) => {
subtitle: 'Last 7 days', subtitle: 'Last 7 days',
icon: LocalGasStationRoundedIcon, icon: LocalGasStationRoundedIcon,
color: 'primary.main', color: 'primary.main',
ctaText: 'Log your first fill-up',
ctaScreen: 'Log Fuel' as MobileScreen,
}, },
]; ];
@@ -74,11 +82,29 @@ export const SummaryCards: React.FC<SummaryCardsProps> = ({ summary }) => {
> >
{card.value} {card.value}
</Box> </Box>
{card.subtitle && ( {card.value === 0 && card.ctaText ? (
<Box
component="button"
onClick={() => onNavigate?.(card.ctaScreen)}
sx={{
background: 'none',
border: 'none',
padding: 0,
cursor: 'pointer',
color: 'primary.main',
fontSize: '0.75rem',
fontWeight: 500,
mt: 0.5,
'&:hover': { textDecoration: 'underline' },
}}
>
{card.ctaText}
</Box>
) : card.subtitle ? (
<p className="text-xs text-slate-400 dark:text-canna mt-1"> <p className="text-xs text-slate-400 dark:text-canna mt-1">
{card.subtitle} {card.subtitle}
</p> </p>
)} ) : null}
</div> </div>
</div> </div>
</GlassCard> </GlassCard>