Skip to content

Commit e3616b1

Browse files
committed
feat: achievement
1 parent 6188575 commit e3616b1

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/components/roadmap/RoadmapView.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import RoadmapCard from './RoadmapCard';
33
import { getOnlyBgStatusColor, statusTextColor } from '../../utils/roadmapHelpers';
4-
import { EyeIcon, EyeSlashIcon } from '@phosphor-icons/react'; // Import eye icons
4+
import { EyeIcon, EyeSlashIcon } from '@phosphor-icons/react';
5+
import { useAchievements } from '../../context/AchievementContext';
56

67
const RoadmapView = ({ issuesData = [] }) => {
7-
const [hiddenColumns, setHiddenColumns] = useState([]); // State to track hidden columns
8+
const [hiddenColumns, setHiddenColumns] = useState([]);
9+
const { unlockAchievement } = useAchievements();
10+
11+
const statusOrder = ['Planned', 'In Progress', 'Completed', 'On Hold'];
812

913
const toggleColumnVisibility = (status) => {
1014
if (hiddenColumns.includes(status)) {
@@ -14,7 +18,14 @@ const RoadmapView = ({ issuesData = [] }) => {
1418
}
1519
};
1620

17-
const groupedApps = issuesData.reduce((acc, app) => {
21+
useEffect(() => {
22+
// Check if all status columns are hidden
23+
if (hiddenColumns.length === statusOrder.length) {
24+
unlockAchievement('hide_and_seek_master');
25+
}
26+
}, [hiddenColumns, statusOrder.length, unlockAchievement]);
27+
28+
const groupIssues = issuesData.reduce((acc, app) => {
1829
const status = app.status || 'Planned'; // Default to Planned if not specified
1930
if (!acc[status]) {
2031
acc[status] = [];
@@ -23,8 +34,6 @@ const RoadmapView = ({ issuesData = [] }) => {
2334
return acc;
2435
}, {});
2536

26-
const statusOrder = ['Planned', 'In Progress', 'Completed', 'On Hold'];
27-
2837
return (
2938
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
3039
{statusOrder.map((status) => {
@@ -38,7 +47,7 @@ const RoadmapView = ({ issuesData = [] }) => {
3847
<span
3948
className={`w-3 h-3 rounded-full ${getOnlyBgStatusColor(status)} ${statusTextColor(status)}`}
4049
></span>
41-
{status} ({groupedApps[status]?.length || 0})
50+
{status} ({groupIssues[status]?.length || 0})
4251
</span>
4352
<button
4453
onClick={() => toggleColumnVisibility(status)}
@@ -50,7 +59,7 @@ const RoadmapView = ({ issuesData = [] }) => {
5059
</h3>
5160
{!isHidden && (
5261
<div className="space-y-4">
53-
{groupedApps[status]?.map((app, appIndex) => (
62+
{groupIssues[status]?.map((app, appIndex) => (
5463
<RoadmapCard key={app.id} app={app} index={appIndex} />
5564
))}
5665
</div>

src/config/achievements.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
BookBookmarkIcon,
1414
BooksIcon,
1515
GhostIcon,
16+
EyeSlashIcon, // Added for new achievement
1617
} from '@phosphor-icons/react';
1718

1819
export const ACHIEVEMENTS = [
@@ -100,6 +101,13 @@ export const ACHIEVEMENTS = [
100101
icon: <BooksIcon size={32} weight="duotone" />,
101102
category: 'Content',
102103
},
104+
{
105+
id: 'hide_and_seek_master',
106+
title: 'Hide and Seek Master',
107+
description: 'Hid all roadmap status columns.',
108+
icon: <EyeSlashIcon size={32} weight="duotone" />,
109+
category: 'Exploration',
110+
},
103111
{
104112
id: 'the_medium',
105113
title: 'The Medium',

0 commit comments

Comments
 (0)