11import React , { useEffect } from 'react' ;
22import { motion , AnimatePresence } from 'framer-motion' ;
3- import { Link , useSearchParams } from 'react-router-dom' ;
3+ import { Link , useParams , Navigate } from 'react-router-dom' ;
44import {
55 ArrowLeft ,
66 TreeStructure ,
@@ -19,7 +19,7 @@ import Brutalist from './about-views/Brutalist';
1919import { useAchievements } from '../context/AchievementContext' ;
2020import useSeo from '../hooks/useSeo' ;
2121
22- const ViewSwitcher = ( { currentView, setView } ) => {
22+ const ViewSwitcher = ( { currentView } ) => {
2323 const views = [
2424 { id : 'brutalist' , icon : Bug , label : 'Brutalist' } ,
2525 { id : 'dossier' , icon : Article , label : 'Dossier' } ,
@@ -31,9 +31,9 @@ const ViewSwitcher = ({ currentView, setView }) => {
3131 return (
3232 < div className = "fixed bottom-8 left-1/2 -translate-x-1/2 z-50 bg-black/50 backdrop-blur-md p-2 rounded-full border border-white/10 shadow-2xl flex gap-2" >
3333 { views . map ( ( view ) => (
34- < button
34+ < Link
3535 key = { view . id }
36- onClick = { ( ) => setView ( view . id ) }
36+ to = { `/about/ ${ view . id } ` }
3737 className = { `relative px-4 py-2 rounded-full flex items-center gap-2 transition-all ${
3838 currentView === view . id
3939 ? 'bg-white text-black font-bold shadow-lg'
@@ -48,21 +48,15 @@ const ViewSwitcher = ({ currentView, setView }) => {
4848 className = "absolute inset-0 bg-white rounded-full mix-blend-difference -z-10"
4949 />
5050 ) }
51- </ button >
51+ </ Link >
5252 ) ) }
5353 </ div >
5454 ) ;
5555} ;
5656
5757const AboutPage = ( ) => {
58- const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
58+ const { viewId } = useParams ( ) ;
5959 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- } ;
6660
6761 const { unlockAchievement } = useAchievements ( ) ;
6862 const { isPaletteOpen, setIsPaletteOpen } = useCommandPalette ( ) ;
@@ -82,13 +76,14 @@ const AboutPage = () => {
8276
8377 useEffect ( ( ) => {
8478 unlockAchievement ( 'curious_soul' ) ;
85- // Hide overflow on body when this component is mounted
86- document . body . style . overflow = 'hidden' ;
87- return ( ) => {
88- document . body . style . overflow = 'auto' ;
89- } ;
9079 } , [ unlockAchievement ] ) ;
9180
81+ if ( ! validViews . includes ( viewId ) ) {
82+ return < Navigate to = "/404" replace /> ;
83+ }
84+
85+ const view = viewId ;
86+
9287 const getButtonStyle = ( currentView ) => {
9388 switch ( currentView ) {
9489 case 'dossier' :
@@ -107,7 +102,7 @@ const AboutPage = () => {
107102 } ;
108103
109104 return (
110- < div className = "fixed inset-0 z-[100] bg-black overflow-hidden " >
105+ < div className = "min-h-screen bg-black relative " >
111106 { /* Global Back Button */ }
112107 < motion . div
113108 initial = { { opacity : 0 , y : - 20 } }
@@ -134,7 +129,7 @@ const AboutPage = () => {
134129 animate = { { opacity : 1 } }
135130 exit = { { opacity : 0 } }
136131 transition = { { duration : 0.5 } }
137- className = "w-full h-full overflow-y-auto "
132+ className = "w-full h-full"
138133 >
139134 { view === 'hud' && < NeuromancerHUD /> }
140135 { view === 'blueprint' && < SystemArchitecture /> }
@@ -145,7 +140,7 @@ const AboutPage = () => {
145140 </ AnimatePresence >
146141
147142 { /* Switcher Controls */ }
148- < ViewSwitcher currentView = { view } setView = { setView } />
143+ < ViewSwitcher currentView = { view } />
149144 < CommandPalette isOpen = { isPaletteOpen } setIsOpen = { setIsPaletteOpen } />
150145 </ div >
151146 ) ;
0 commit comments