From 1f8b69fb226823d4bd8b43b7b0a858038a46ecaa Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Sat, 21 Sep 2024 15:35:38 -0500 Subject: [PATCH] Style and functional improvements to user progress --- .../charts/GithubContributionChart.js | 2 +- .../profile/progress/UserProgress.js | 96 ++++++++++++++----- 2 files changed, 75 insertions(+), 23 deletions(-) diff --git a/src/components/charts/GithubContributionChart.js b/src/components/charts/GithubContributionChart.js index 4cd818b..11b1af4 100644 --- a/src/components/charts/GithubContributionChart.js +++ b/src/components/charts/GithubContributionChart.js @@ -56,7 +56,7 @@ const GithubContributionChart = ({ username }) => {

Total commits: {totalCommits}

- +
}
diff --git a/src/components/profile/progress/UserProgress.js b/src/components/profile/progress/UserProgress.js index 31c6e0b..9b7bf84 100644 --- a/src/components/profile/progress/UserProgress.js +++ b/src/components/profile/progress/UserProgress.js @@ -1,9 +1,11 @@ -import React, {useState, useEffect} from 'react'; +import React, { useState, useEffect } from 'react'; import { ProgressBar } from 'primereact/progressbar'; +import { Accordion, AccordionTab } from 'primereact/accordion'; const UserProgress = () => { const [progress, setProgress] = useState(0); const [currentTier, setCurrentTier] = useState('Pleb'); + const [expanded, setExpanded] = useState(null); const getProgress = async () => { return 10; @@ -27,8 +29,8 @@ const UserProgress = () => { const tasks = [ { status: 'Create Account', completed: true, tier: 'Pleb' }, - { - status: 'Complete PlebDevs Starter', + { + status: 'Complete PlebDevs Starter', completed: false, tier: 'New Dev', subTasks: [ @@ -45,7 +47,7 @@ const UserProgress = () => {

Your Dev Journey

Track your progress from Pleb to Plebdev

- +
Progress {progress}% @@ -55,34 +57,84 @@ const UserProgress = () => { className: 'hidden' } }} /> - +
Current Tier: {currentTier}
- +
    {tasks.map((task, index) => ( -
  • -
    - {task.completed ? ( -
    - +
  • + {task.subTasks ? ( + setExpanded(true)} onTabClose={(e) => setExpanded(false)}> + +
    +
    + {index + 1} +
    + {task.status} + +
    + + {task.tier} + +
+ } + > +
    + {task.subTasks.map((subTask, subIndex) => ( +
  • + {subTask.completed ? ( +
    + +
    + ) : ( +
    + {subIndex + 1} +
    + )} + + {subTask.status} + +
  • + ))} +
+ + + ) : ( +
+
+ {task.completed ? ( +
+ +
+ ) : ( +
+ {index + 1} +
+ )} + {task.status}
- ) : ( -
- {index + 1} -
- )} - {task.status} -
- - {task.tier} - + + {task.tier} + +
+ )} ))} - +