import classNames from 'classnames'; import { AnimatePresence, motion } from 'framer-motion'; import { useMemo, useState } from 'react'; import type { ProgressAnnotation } from '~/types/message'; import { cubicEasingFn } from '~/utils/easings'; export default function ProgressCompilation({ data }: { data?: ProgressAnnotation[] }) { const [expanded, setExpanded] = useState(false); const progressList = useMemo(() => { if (!data || data.length == 0) { return []; } const progressMap = new Map(); data.forEach((x) => { const existingProgress = progressMap.get(x.label); if (existingProgress && existingProgress.status === 'complete') { return; } progressMap.set(x.label, x); }); return Array.from(progressMap.values()).sort((a, b) => a.order - b.order); }, [data]); if (progressList.length === 0) { return <>; } return (
{expanded ? ( {progressList.map((x, i) => { return ; })} ) : ( )}
{progressList.length > 1 && ( setExpanded((v) => !v)} >
)}
); } interface ProgressItemProps { progress: ProgressAnnotation; } const ProgressItem = ({ progress }: ProgressItemProps) => { return (
{progress.status === 'in-progress' ? (
) : progress.status === 'complete' ? (
) : progress.status === 'stopped' ? (
) : progress.status === 'warning' ? (
) : null}
{progress.message}
); };