import { lazy, Suspense, type CSSProperties } from "react"; import { classById, raceById } from "../app/characterCatalog"; import type { CharacterDraft, CharacterProfile } from "../app/types"; import { normalizePreviewFrameRateLimit } from "../game/frameRateSettings"; const CharacterPreview3D = lazy(() => import("./CharacterPreview3D")); function AvatarSilhouette({ gender, raceSigil }: { gender: CharacterDraft["gender"]; raceSigil: string; }) { return ( ); } export function CharacterPreview({ character, draft, compact = false }: { character?: CharacterProfile | null; draft?: CharacterDraft; compact?: boolean; }) { const source = character ?? draft; if (!source) { return
+

Create a character to answer the call.

; } const race = raceById(source.raceId); const characterClass = classById(source.classId); const name = "name" in source && source.name ? source.name : "New adventurer"; const rotation = "rotation" in source ? source.rotation : -8; const previewFrameRate = normalizePreviewFrameRateLimit( "settings" in source ? source.settings?.previewFrameRate : undefined, ); const style = { "--race-accent": race.accent, "--class-color": characterClass.color, "--avatar-turn": `${rotation}deg`, } as CSSProperties; return (
{compact ? ( ) : ( }> )} {source.gender} {race.name} {characterClass.name} preview
{race.name} / {source.gender} {name} {characterClass.name}
); }