import type { ReactNode } from 'react'; // Import images import noABImage from './images/no-ab.png'; import noAnalyticsImage from './images/no-analytics.png'; import noEngagedImage from './images/no-engaged.png'; import noPersonalizationImage from './images/no-personalization.png'; import noPopularImage from './images/no-popular.png'; import noRateImage from './images/no-rate.png'; import noSessionsImage from './images/no-sessions.png'; import noUsersImage from './images/no-users.png'; // Image mapping const IMAGE_MAP = { ab: noABImage, analytics: noAnalyticsImage, engaged: noEngagedImage, personalization: noPersonalizationImage, popular: noPopularImage, rate: noRateImage, sessions: noSessionsImage, users: noUsersImage, } as const; export type PlaceholderImageType = keyof typeof IMAGE_MAP; interface NoDataPlaceholderProps { /** Type of placeholder image to display */ type: PlaceholderImageType; /** Optional content to display below the image (can include text, links, etc.) */ children?: ReactNode; } /** * NoDataPlaceholder component displays a placeholder image with optional content when no data is available * * @param root0 * @param root0.type * @param root0.children * @example * ```tsx * *

No analytics data available for this period.

*
* * *

No users found. Configure tracking to get started.

*
* ``` */ export default function NoDataPlaceholder( { type, children, }: NoDataPlaceholderProps ) { const imageSrc = IMAGE_MAP[ type ]; return (
{ children && (
{ children }
) }
); }