'use client';
import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import type { MotivatorCard as MotivatorCardType } from '@/lib/types';
import { MOTIVATOR_BY_TYPE } from '@/lib/types';
interface MotivatorCardProps {
card: MotivatorCardType;
onInfluenceChange?: (influence: number) => void;
disabled?: boolean;
showInfluence?: boolean;
}
export function MotivatorCard({
card,
disabled = false,
showInfluence = false,
}: MotivatorCardProps) {
const config = MOTIVATOR_BY_TYPE[card.type];
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
id: card.id,
disabled,
});
const style = {
transform: CSS.Transform.toString(transform),
transition,
};
return (
{/* Color accent bar */}
{/* Icon */}
{config.icon}
{/* Name */}
{config.name}
{/* Description */}
{config.description}
{/* Influence indicator */}
{showInfluence && card.influence !== 0 && (
0 ? 'bg-green-500' : 'bg-red-500'}
`}
>
{card.influence > 0 ? `+${card.influence}` : card.influence}
)}
{/* Rank badge */}
{card.orderIndex}
);
}
// Non-draggable version for summary
export function MotivatorCardStatic({
card,
size = 'normal',
}: {
card: MotivatorCardType;
size?: 'small' | 'normal';
}) {
const config = MOTIVATOR_BY_TYPE[card.type];
const sizeClasses = {
small: 'w-20 h-24 text-2xl',
normal: 'w-28 h-36 text-3xl',
};
return (
{/* Color accent bar */}
{/* Icon */}
{config.icon}
{/* Name */}
{config.name}
{/* Influence indicator */}
{card.influence !== 0 && (
0 ? 'bg-green-500' : 'bg-red-500'}
${size === 'small' ? 'w-5 h-5 text-[10px]' : 'w-6 h-6 text-xs'}
`}
>
{card.influence > 0 ? `+${card.influence}` : card.influence}
)}
{/* Rank badge */}
{card.orderIndex}
);
}