Skip to content

Commit 4701fb3

Browse files
committed
feat: query params for about me page.
1 parent ec7684f commit 4701fb3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/pages/AboutPage.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useEffect } from 'react';
22
import { motion, AnimatePresence } from 'framer-motion';
3-
import { Link } from 'react-router-dom';
3+
import { Link, useSearchParams } from 'react-router-dom';
44
import {
55
ArrowLeft,
66
TreeStructure,
@@ -21,11 +21,11 @@ import useSeo from '../hooks/useSeo';
2121

2222
const ViewSwitcher = ({ currentView, setView }) => {
2323
const views = [
24+
{ id: 'brutalist', icon: Bug, label: 'Brutalist' },
2425
{ id: 'dossier', icon: Article, label: 'Dossier' },
2526
{ id: 'hud', icon: Terminal, label: 'Terminal' },
2627
{ id: 'blueprint', icon: TreeStructure, label: 'Blueprint' },
2728
{ id: 'map', icon: Graph, label: 'Mind Map' },
28-
{ id: 'brutalist', icon: Bug, label: 'Brutalist' },
2929
];
3030

3131
return (
@@ -55,7 +55,15 @@ const ViewSwitcher = ({ currentView, setView }) => {
5555
};
5656

5757
const AboutPage = () => {
58-
const [view, setView] = useState('dossier');
58+
const [searchParams, setSearchParams] = useSearchParams();
59+
const validViews = ['dossier', 'hud', 'blueprint', 'map', 'brutalist'];
60+
const viewParam = searchParams.get('v');
61+
const view = validViews.includes(viewParam) ? viewParam : 'brutalist';
62+
63+
const setView = (newView) => {
64+
setSearchParams({ v: newView }, { replace: true });
65+
};
66+
5967
const { unlockAchievement } = useAchievements();
6068
const { isPaletteOpen, setIsPaletteOpen } = useCommandPalette();
6169

0 commit comments

Comments
 (0)