Skip to content

Commit

Permalink
feat: update journey cards to display the right difficulty level
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-kakal-akarah committed Jun 24, 2024
1 parent c79dd24 commit 5b2a58c
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/components/JourneyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,52 @@ type JourneyCardProps = {

const JourneyCard = ({ journey }: JourneyCardProps) => {
const averageRate = calculateAverageRating(journey.comments);
let phisicalDificulty = "facile";
let cluesDificulty = "facile";

switch (journey.physicalDifficulty) {
case 1:
phisicalDificulty = "facile";
break;
case 2:
phisicalDificulty = "intermédiaire";
break;
case 3:
phisicalDificulty = "difficile";
break;
default:
phisicalDificulty = "facile";
break;
}

switch (journey.cluesDifficulty) {
case 1:
cluesDificulty = "facile";
break;
case 2:
cluesDificulty = "intermédiaire";
break;
case 3:
cluesDificulty = "difficile";
break;
default:
cluesDificulty = "facile";
break;
}

return (
<Link href={`/parcours/${journey.id}`} className="rounded-lg bg-gray">
<div className="relative">
<div className="absolute left-4 flex gap-[6px]">
<div className="flex items-center rounded-b-md bg-white px-2 py-[6px]">
<Icons.dumbbel />
<p className="text-sm font-semibold text-gray">Facile</p>
<p className="text-sm font-semibold text-gray">
{phisicalDificulty}
</p>
</div>
<div className="flex items-center gap-1 rounded-b-md bg-green px-2 py-[6px]">
<Icons.bulb />
<p className="text-sm font-semibold text-gray">Intermédiaire</p>
<p className="text-sm font-semibold text-gray">{cluesDificulty}</p>
</div>
</div>
<Image
Expand Down

0 comments on commit 5b2a58c

Please sign in to comment.