'use client' import type { ContentListingIcon } from '~/lib/content-listings.schema' import { Auth, Axiom, Database, Datadog, EdgeFunctions, Grafana, Last9, Otlp, Realtime, Sentry, Storage, } from 'icons' import { BadgeCheck, Braces, Cloud, Server, Shield } from 'lucide-react' import type { ReactNode } from 'react' type IconKind = Extract['kind'] const ICON_KIND_COMPONENTS: Record = { braces: , otlp: , datadog: , grafana: , cloud: , sentry: , axiom: , last9: , server: , } const PRODUCT_ICONS = { database: Database, auth: Auth, rls: Shield, storage: Storage, functions: EdgeFunctions, realtime: Realtime, production: BadgeCheck, } as const export function resolveContentListingIcon( icon: ContentListingIcon | undefined ): ReactNode | string | undefined { if (typeof icon === 'string' && icon in PRODUCT_ICONS) { const Icon = PRODUCT_ICONS[icon as keyof typeof PRODUCT_ICONS] return } if (icon && typeof icon === 'object') { return ( {ICON_KIND_COMPONENTS[icon.kind]} ) } // GlassPanel picks -light via next-themes; class-based dark: is more reliable for // Reflex (near-black light mark vanishes on dark cards if theme resolution lags). if (typeof icon === 'string' && icon.endsWith('/reflex-icon')) { return ( <> ) } return icon }