UI changes on road cards

pull/4066/head
Kamran Ahmed 1 year ago
parent 0031a9c6ba
commit 955d04e532
  1. 10
      src/components/RoadCard/RoadCardPage.tsx
  2. 13
      src/components/RoadCard/RoadmapSelect.tsx
  3. 2
      src/pages/account/road-card.astro

@ -44,12 +44,12 @@ export function RoadCardPage() {
return ( return (
<> <>
<div className="mb-5 flex items-start gap-4 pt-2"> <div className="flex items-start gap-4 mx-0 sm:-mx-10 px-0 sm:px-10 border-b pt-2 pb-4">
<StepCounter step={1} /> <StepCounter step={1} />
<div> <div>
<StepLabel label="Pick progress to show (Max. 4)" /> <StepLabel label="Pick progress to show (Max. 4)" />
<div className="flex min-h-[30px] flex-wrap"> <div className="flex flex-wrap">
<RoadmapSelect <RoadmapSelect
selectedRoadmaps={roadmaps} selectedRoadmaps={roadmaps}
setSelectedRoadmaps={setRoadmaps} setSelectedRoadmaps={setRoadmaps}
@ -58,7 +58,7 @@ export function RoadCardPage() {
</div> </div>
</div> </div>
<div className="mb-5 flex items-start gap-4"> <div className="flex items-start gap-4 mx-0 sm:-mx-10 px-0 sm:px-10 border-b py-4">
<StepCounter step={2} /> <StepCounter step={2} />
<div> <div>
<StepLabel label="Select Mode (Dark vs Light)" /> <StepLabel label="Select Mode (Dark vs Light)" />
@ -85,7 +85,7 @@ export function RoadCardPage() {
</div> </div>
</div> </div>
<div className="mb-5 flex items-start gap-4"> <div className="flex items-start gap-4 mx-0 sm:-mx-10 px-0 sm:px-10 border-b py-4">
<StepCounter step={3} /> <StepCounter step={3} />
<div> <div>
<StepLabel label="Select Version" /> <StepLabel label="Select Version" />
@ -111,7 +111,7 @@ export function RoadCardPage() {
</div> </div>
</div> </div>
<div className="mb-5 flex items-start gap-4"> <div className="flex items-start gap-4 mx-0 sm:-mx-10 px-0 sm:px-10 border-b py-4">
<StepCounter step={4} /> <StepCounter step={4} />
<div class="flex-grow"> <div class="flex-grow">
<StepLabel label="Share your #RoadCard with others" /> <StepLabel label="Share your #RoadCard with others" />

@ -33,12 +33,14 @@ export function RoadmapSelect(props: RoadmapSelectProps) {
}, []); }, []);
const canSelectMore = selectedRoadmaps.length < 4; const canSelectMore = selectedRoadmaps.length < 4;
const allProgress = progressList?.filter(
(progress) => progress.resourceType === 'roadmap'
) || [];
return ( return (
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
{progressList {allProgress?.length === 0 && <p className={'text-sm text-gray-400 italic'}>No progress tracked so far.</p>}
?.filter((progress) => progress.resourceType === 'roadmap') {allProgress?.map((progress) => {
.map((progress) => {
const isSelected = selectedRoadmaps.includes(progress.resourceId); const isSelected = selectedRoadmaps.includes(progress.resourceId);
const canSelect = isSelected || canSelectMore; const canSelect = isSelected || canSelectMore;
@ -55,10 +57,7 @@ export function RoadmapSelect(props: RoadmapSelectProps) {
) )
); );
} else if (selectedRoadmaps.length < 4) { } else if (selectedRoadmaps.length < 4) {
setSelectedRoadmaps([ setSelectedRoadmaps([...selectedRoadmaps, progress.resourceId]);
...selectedRoadmaps,
progress.resourceId,
]);
} }
}} }}
/> />

@ -7,7 +7,7 @@ import { RoadCardPage } from '../../components/RoadCard/RoadCardPage';
<AccountLayout <AccountLayout
title='Road Card' title='Road Card'
noIndex={true} noIndex={true}
initialLoadingMessage='Preparing card..' initialLoadingMessage='Preparing card'
> >
<AccountSidebar activePageId='road-card' activePageTitle='Road Card'> <AccountSidebar activePageId='road-card' activePageTitle='Road Card'>
<RoadCardPage client:load /> <RoadCardPage client:load />

Loading…
Cancel
Save