From 2faf43d477e51afbc9162b44f5b87c123e8cc82a Mon Sep 17 00:00:00 2001 From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:43:59 -0500 Subject: [PATCH] loading --- .../src/components/GenerationProgress.jsx | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/GenerationProgress.jsx b/frontend/src/components/GenerationProgress.jsx index ab7d099..de59d7c 100644 --- a/frontend/src/components/GenerationProgress.jsx +++ b/frontend/src/components/GenerationProgress.jsx @@ -100,58 +100,64 @@ export default function GenerationProgress({ progress, courseId }) { } const renderDetailedStats = (cat) => { + // emoji mapping for each step + const emojiSteps = { + 'Course Details': ['📝', '📚', '🎯', '✨'], + 'Course Content': ['📖', '📑', '✍️', '📘'], + 'Quiz Generation': ['❓', '🤔', '💭', '✅'] + } + + const getEmojis = (current, total) => { + const emojis = emojiSteps[cat.name] || ['⭐'] + const progress = Math.min(Math.floor((current / total) * emojis.length), emojis.length) + return ( +
+ {emojis.map((emoji, i) => ( + + {emoji} + + ))} +
+ ) + } + switch (cat.name) { case 'Course Details': return (
{cat.stats?.step && ( -

{cat.stats.step}

- )} - {(cat.stats?.current && cat.stats?.total) && ( - renderProgressBar(cat.stats.current, cat.stats.total) +

{cat.stats.step}

)} - + {(cat.stats?.current && cat.stats?.total) && + getEmojis(cat.stats.current, cat.stats.total)}
) case 'Course Content': return (
{cat.stats?.step && ( -

{cat.stats.step}

+

{cat.stats.step}

)} - {renderProgressBar(cat.stats?.pageCount || 0, cat.stats?.totalPages || 24)} - + {getEmojis(cat.stats?.pageCount || 0, cat.stats?.totalPages || 24)}
) case 'Quiz Generation': return (
{cat.stats?.step && ( -

{cat.stats.step}

+

{cat.stats.step}

)} - {cat.status === 'completed' ? ( - renderProgressBar(1, 1) // full bar when complete - ) : cat.stats?.questionCount ? ( - renderProgressBar(cat.stats.questionCount, 4) // assuming 4 questions total - ) : null} - + {cat.status === 'completed' ? + getEmojis(1, 1) : + getEmojis(cat.stats?.questionCount || 0, 4)}
) default: