Skip to content

Commit ae0572a

Browse files
committed
more achievements
1 parent 6007ad2 commit ae0572a

File tree

9 files changed

+91
-7
lines changed

9 files changed

+91
-7
lines changed

src/components/CommandPalette.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ const CommandPalette = ({
378378
});
379379
break;
380380
case 'showTime': {
381+
unlockAchievement('time_teller');
381382
openGenericModal('Current Time', <LiveClock />);
382383
break;
383384
}

src/config/achievements.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import {
1616
ChalkboardIcon,
1717
CastleTurretIcon,
1818
MartiniIcon,
19+
TimerIcon,
20+
LogIcon,
21+
KanbanIcon
1922
} from '@phosphor-icons/react';
2023

2124
export const ACHIEVEMENTS = [
@@ -33,6 +36,62 @@ export const ACHIEVEMENTS = [
3336
icon: <UserIcon size={32} weight="duotone" />,
3437
category: 'Exploration',
3538
},
39+
{
40+
id: 'story_explorer',
41+
title: 'Story Explorer',
42+
description: 'Did you hear about the Serfs?',
43+
icon: <BookOpenIcon size={32} weight="duotone" />,
44+
category: 'Exploration',
45+
},
46+
{
47+
id: 'author_aficionado',
48+
title: 'Author Aficionado',
49+
description: 'Explored the authors of From Serfs and Frauds.',
50+
icon: <UserIcon size={32} weight="duotone" />,
51+
category: 'Exploration',
52+
},
53+
{
54+
id: 'time_traveler',
55+
title: 'Time Traveler',
56+
description: 'Changelogs?',
57+
icon: <TimerIcon size={32} weight="duotone" />,
58+
category: 'Exploration',
59+
},
60+
{
61+
id: 'news_hound',
62+
title: 'News Hound',
63+
description: 'Checked out the latest news and updates.',
64+
icon: <CompassIcon size={32} weight="duotone" />,
65+
category: 'Exploration',
66+
},
67+
{
68+
id: 'log_diver',
69+
title: 'Log Diver',
70+
description: 'Explored the logs.',
71+
icon: <LogIcon size={32} weight="duotone" />,
72+
category: 'Exploration',
73+
},
74+
{
75+
id: 'project_pioneer',
76+
title: 'Project Pioneer',
77+
description: 'Discovered the projects page.',
78+
icon: <TerminalWindowIcon size={32} weight="duotone" />,
79+
category: 'Exploration',
80+
},
81+
{
82+
id: 'time_teller',
83+
title: 'Time Teller',
84+
description: 'I want to know the time.',
85+
icon: <TimerIcon size={32} weight="duotone" />,
86+
category: 'Tools',
87+
},
88+
{
89+
id: 'path_finder',
90+
title: 'Path Finder',
91+
description: 'Navigated to the Roadmap page.',
92+
icon: <KanbanIcon size={32} weight="duotone" />,
93+
category: 'Exploration',
94+
},
3695
{
3796
id: 'the_hacker',
3897
title: 'The Hacker',

src/pages/LogsPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { motion, AnimatePresence } from 'framer-motion';
1111
import LogCard from '../components/LogCard';
1212
import useSeo from '../hooks/useSeo';
1313
import colors from '../config/colors';
14+
import { useAchievements } from '../context/AchievementContext';
1415

1516
// Define categories for the filter pills
1617
const categories = [
@@ -73,8 +74,10 @@ const LogsPage = () => {
7374
const [searchQuery, setSearchQuery] = useState('');
7475
const [filteredLogs, setFilteredLogs] = useState([]);
7576
const [iconColor, setIconColor] = useState('text-white');
77+
const { unlockAchievement } = useAchievements();
7678

7779
useEffect(() => {
80+
unlockAchievement('log_diver');
7881
const fetchLogs = async () => {
7982
try {
8083
const fetchPromises = categories.map(async (category) => {
@@ -109,7 +112,7 @@ const LogsPage = () => {
109112
}
110113
};
111114
fetchLogs();
112-
}, []);
115+
}, [unlockAchievement]);
113116

114117
useEffect(() => {
115118
const lowerQuery = searchQuery.toLowerCase();

src/pages/NewsPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { motion } from 'framer-motion';
33
import { Link } from 'react-router-dom';
44
import { getPosts, getProjects } from '../utils/dataUtils';
55
import useSeo from '../hooks/useSeo';
6+
import { useAchievements } from '../context/AchievementContext';
67

78
const pageVariants = {
89
initial: { opacity: 0 },
@@ -68,6 +69,7 @@ function NewsPage() {
6869
const [newsItems, setNewsItems] = useState([]);
6970
const [loading, setLoading] = useState(true);
7071
const [error, setError] = useState(null);
72+
const { unlockAchievement } = useAchievements();
7173

7274
// Get current date for the header
7375
const today = new Date();
@@ -80,6 +82,7 @@ function NewsPage() {
8082
const formattedDate = today.toLocaleDateString('en-US', options);
8183

8284
useEffect(() => {
85+
unlockAchievement('news_hound');
8386
async function fetchNews() {
8487
try {
8588
const [blogPosts, projects] = await Promise.all([
@@ -120,7 +123,7 @@ function NewsPage() {
120123
}
121124

122125
fetchNews();
123-
}, []);
126+
}, [unlockAchievement]);
124127

125128
if (loading) {
126129
return (

src/pages/ProjectsPage.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import {Link} from 'react-router-dom';
33
import ProjectCard from '../components/ProjectCard';
44
import {useProjects} from '../utils/projectParser';
55
import useSeo from '../hooks/useSeo';
66
import {ArrowLeftIcon} from '@phosphor-icons/react';
7+
import { useAchievements } from '../context/AchievementContext';
78

89
const ProjectsPage = () => {
910
useSeo({
@@ -25,6 +26,11 @@ const ProjectsPage = () => {
2526
twitterImage: 'https://fezcode.github.io/logo512.png',
2627
});
2728
const {projects, loading, error} = useProjects();
29+
const { unlockAchievement } = useAchievements();
30+
31+
useEffect(() => {
32+
unlockAchievement('project_pioneer');
33+
}, [unlockAchievement]);
2834

2935
if (loading) {
3036
// Skeleton loading screen for ProjectsPage

src/pages/TimelinePage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { appIcons } from '../utils/appIcons';
55
import { motion } from 'framer-motion';
66
import useSeo from '../hooks/useSeo';
77
import colors from '../config/colors'; // Assuming colors is available for styling
8+
import { useAchievements } from '../context/AchievementContext';
89

910
const TimelinePage = () => {
1011
useSeo({
@@ -23,8 +24,10 @@ const TimelinePage = () => {
2324

2425
const [milestones, setMilestones] = useState([]);
2526
const [loading, setLoading] = useState(true);
27+
const { unlockAchievement } = useAchievements();
2628

2729
useEffect(() => {
30+
unlockAchievement('time_traveler');
2831
const fetchMilestones = async () => {
2932
try {
3033
const response = await fetch('/timeline/timeline.json');
@@ -46,7 +49,7 @@ const TimelinePage = () => {
4649
};
4750

4851
fetchMilestones();
49-
}, []);
52+
}, [unlockAchievement]);
5053

5154
const getEventColor = (type) => {
5255
switch (type) {

src/pages/dnd/DndAuthorsPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { DndContext } from '../../context/DndContext'; // Import DndContext
77
import DndAuthorCard from '../../components/dnd/DndAuthorCard'; // Import DndAuthorCard
88
import { parseWallpaperName } from '../../utils/dndUtils'; // Import parseWallpaperName
99
import dndWallpapers from '../../utils/dndWallpapers'; // Import dndWallpapers
10+
import { useAchievements } from '../../context/AchievementContext';
1011

1112
const pageVariants = {
1213
initial: {
@@ -31,6 +32,7 @@ function DndAuthorsPage() {
3132
const [authors, setAuthors] = useState([]);
3233
const [books, setBooks] = useState([]);
3334
const [bgImage, setBgImage] = useState(''); // State for background image
35+
const { unlockAchievement } = useAchievements();
3436

3537
useSeo({
3638
title: 'Authors | From Serfs and Frauds',
@@ -49,6 +51,7 @@ function DndAuthorsPage() {
4951
});
5052

5153
useEffect(() => {
54+
unlockAchievement('author_aficionado');
5255
setBreadcrumbs([{ label: 'S&F', path: '/stories' }, { label: 'Authors' }]);
5356

5457
const images = dndWallpapers;
@@ -85,7 +88,7 @@ function DndAuthorsPage() {
8588
};
8689

8790
fetchAllData();
88-
}, [setBreadcrumbs, setBgImageName]);
91+
}, [setBreadcrumbs, setBgImageName, unlockAchievement]);
8992

9093
const getBooksByAuthor = (authorName, authorAlias) => {
9194
const authorBooks = [];

src/pages/dnd/DndPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { parseWallpaperName } from '../../utils/dndUtils';
55
import dndWallpapers from '../../utils/dndWallpapers';
66
import DndCard from '../../components/dnd/DndCard';
77
import useSeo from '../../hooks/useSeo';
8+
import { useAchievements } from '../../context/AchievementContext';
89

910
const DndPage = () => {
1011
useSeo({
@@ -24,14 +25,16 @@ const DndPage = () => {
2425
});
2526
const [bgImage, setBgImage] = useState('');
2627
const { setBgImageName, setBreadcrumbs } = useContext(DndContext); // Get setBgImageName and setBreadcrumbs from context
28+
const { unlockAchievement } = useAchievements();
2729

2830
useEffect(() => {
31+
unlockAchievement('story_explorer');
2932
const images = dndWallpapers;
3033
const randomImage = images[Math.floor(Math.random() * images.length)];
3134
setBgImage(randomImage);
3235
setBgImageName(parseWallpaperName(randomImage.split('/').pop()));
3336
setBreadcrumbs([{ label: 'S&F', path: '/stories' }]);
34-
}, [setBgImageName, setBreadcrumbs]);
37+
}, [setBgImageName, setBreadcrumbs, unlockAchievement]);
3538

3639
return (
3740
<div className="dnd-page-container">

src/pages/roadmap/FezzillaPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ArrowLeftIcon, KanbanIcon, ListBulletsIcon } from '@phosphor-icons/reac
55
import piml from 'piml';
66
import RoadmapView from '../../components/roadmap/RoadmapView';
77
import TableView from '../../components/roadmap/TableView';
8+
import { useAchievements } from '../../context/AchievementContext';
89

910
const FezzillaPage = () => {
1011
useSeo({
@@ -22,8 +23,10 @@ const FezzillaPage = () => {
2223

2324
const [issuesData, setIssuesData] = useState([]);
2425
const [viewMode, setViewMode] = useState('roadmap'); // 'roadmap' or 'table'
26+
const { unlockAchievement } = useAchievements();
2527

2628
useEffect(() => {
29+
unlockAchievement('path_finder');
2730
const fetchRoadmap = async () => {
2831
try {
2932
const pimlResponse = await fetch('/roadmap/roadmap.piml');
@@ -39,7 +42,7 @@ const FezzillaPage = () => {
3942
};
4043

4144
fetchRoadmap();
42-
}, []);
45+
}, [unlockAchievement]);
4346

4447
return (
4548
<div className="min-h-screen py-8 sm:py-16 relative overflow-hidden">

0 commit comments

Comments
 (0)