import { AnimatePresence, motion } from 'framer-motion'; import React, { useState } from 'react'; import type { ProgressAnnotation } from '~/types/context'; import { classNames } from '~/utils/classNames'; import { cubicEasingFn } from '~/utils/easings'; export default function ProgressCompilation({ data }: { data?: ProgressAnnotation[] }) { const [progressList, setProgressList] = React.useState([]); const [expanded, setExpanded] = useState(false); React.useEffect(() => { if (!data || data.length == 0) { setProgressList([]); 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); }); const newData = Array.from(progressMap.values()); newData.sort((a, b) => a.order - b.order); setProgressList(newData); }, [data]); if (progressList.length === 0) { return <>; } return (
{expanded ? ( {progressList.map((x, i) => { return ; })} ) : ( )}
setExpanded((v) => !v)} >
); } const ProgressItem = ({ progress }: { progress: ProgressAnnotation }) => { return (
{progress.status === 'in-progress' ? (
) : progress.status === 'complete' ? (
) : null}
{/* {x.label} */}
{progress.message}
); };