import { Steps, Typography } from 'antd';
import { IconCheck, IconX, IconClock } from '@tabler/icons-react';
import { ApprovalRequestStep } from '@/api/approval';
import { COLOR_SUCCESS, COLOR_ERROR, COLOR_PRIMARY, GRAY } from '@/theme/tokens';
const { Text } = Typography;
interface Props {
steps: ApprovalRequestStep[];
currentStep: number;
}
function stepIcon(status: string) {
if (status === 'APPROVED') return ;
if (status === 'REJECTED') return ;
return ;
}
function stepStatus(status: string): 'finish' | 'error' | 'process' | 'wait' {
if (status === 'APPROVED') return 'finish';
if (status === 'REJECTED') return 'error';
if (status === 'IN_PROGRESS') return 'process';
return 'wait';
}
/**
* 결재선 진행 시각화 컴포넌트.
* Steps 수평 렌더링 + 단계별 상태 색상.
*/
export default function ApprovalProgress({ steps, currentStep }: Props) {
const items = steps.map((s) => ({
title: (
{s.approverName}
),
description: (
{s.comment &&
{s.comment}
}
{s.processedAt && (
{s.processedAt.slice(0, 10)}
)}
),
icon: stepIcon(s.status),
status: stepStatus(s.status),
}));
return (
);
}