'use client' import type { FC } from 'react' import type { QuadrantConfig, Task } from './types' import { useTranslation } from 'react-i18next' import { cn } from '@/utils/classnames' import TaskItem from './task-item' type QuadrantCardProps = { config: QuadrantConfig tasks: Task[] expanded?: boolean maxDisplay?: number } const QuadrantCard: FC = ({ config, tasks, expanded = false, maxDisplay = 3, }) => { const { t } = useTranslation() const { number, titleKey, subtitleKey, bgClass, borderClass, titleClass } = config const displayLimit = expanded ? Infinity : maxDisplay const displayTasks = tasks.slice(0, displayLimit) const remainingCount = Math.max(0, tasks.length - displayLimit) return (
{/* Header with numbered circle */}
{/* Numbered circle */} {number} {t(titleKey, { ns: 'app' })} {tasks.length > 0 && ( {tasks.length} )}
{t(subtitleKey, { ns: 'app' })}
{/* Task List */}
{displayTasks.length > 0 ? ( displayTasks.map((task) => { const taskKey = [ task.name, task.deadline ?? 'no-deadline', task.importance_score, task.urgency_score, task.description ?? '', task.action_advice ?? '', ].join('|') return ( ) }) ) : (
{t('quadrantMatrix.noTasks', { ns: 'app' })}
)}
{/* More indicator (only in non-expanded mode) */} {!expanded && remainingCount > 0 && (
{t('quadrantMatrix.more', { ns: 'app', count: remainingCount })}
)}
) } export default QuadrantCard