import type { ReactNode } from 'react';
import { Link } from '@tanstack/react-router';
import { useActiveCampaign } from '@/features/campaigns/hooks';
import type { Campaign } from '@/lib/schemas';
export function Page({ children }: { children: ReactNode }) {
return
{children}
;
}
export function PageHeader({
title,
subtitle,
eyebrow,
actions,
}: {
title: string;
subtitle?: string;
/** small italic accent line above the title (editorial eyebrow) */
eyebrow?: string;
actions?: ReactNode;
}) {
return (
{eyebrow &&
{eyebrow}
}
{title}
{subtitle &&
{subtitle}
}
{actions &&
{actions}
}
);
}
export function EmptyState({ title, hint, action }: { title: string; hint?: string; action?: ReactNode }) {
return (
{title}
{hint &&
{hint}
}
{action &&
{action}
}
);
}
/** Gate a screen on an active campaign; renders a prompt if none is selected. */
export function RequireCampaign({ children }: { children: (campaign: Campaign) => ReactNode }) {
const campaign = useActiveCampaign();
if (!campaign) {
return (
Go to Campaigns
}
/>
);
}
return <>{children(campaign)}>;
}