'use client' import { type ComponentProps, forwardRef } from 'react' import { Box, Circle, HStack, VStack } from 'styled-system/jsx' import { scenarioCard } from 'styled-system/recipes' import * as Card from '../Card' import { ClockIcon } from '../Icons/ClockIcon' import { GripDotsVerticalIcon } from '../Icons/GripDotsVerticalIcon' import * as Switch from '../Switch' import { type ScenarioCardProps, difficultyLabel, } from './types' export interface ScenarioCardElementProps extends ScenarioCardProps, Omit, 'children'> { /** Callback ref for the root element (used by ScenarioCardDraggable) */ rootRef?: (el: HTMLDivElement | null) => void /** Callback ref for the drag handle (used by ScenarioCardDraggable) */ handleRef?: (el: HTMLDivElement | null) => void } export const ScenarioCard = forwardRef( function ScenarioCard( { scenario, position, isActive, showRequeueSwitch = false, onRequeue, isRepeat = false, isDragging = false, rootRef, handleRef, className: _className, ...rest }, _ref, ) { const styles = scenarioCard({ isActive, isDragging }) return ( {/* Top row: drag handle (left) + position badge (right) — queue tab only */} {!showRequeueSwitch && ( {position} )} {/* Title */}

{scenario.title}

{/* Badge column: difficulty stacked above duration, matching Figma flex-col layout */} {difficultyLabel[scenario.difficulty]} {isRepeat && ( Repeat )} {/* Re-queue switch row (completed tab only) */} {showRequeueSwitch && ( Re-queue { if (!details.checked) onRequeue?.(scenario.id) }} aria-label={`Re-queue ${scenario.title}`} > )}
) }, )