@@ -36,6 +36,7 @@ import LiveActivitiesAbout from './pages/LiveActivities/About';
3636import Settings from './pages/Settings' ;
3737import Support from './pages/Support' ;
3838import Test from './pages/Test' ;
39+ import UserPage from './pages/User' ;
3940import UserLogin from './pages/UserLogin' ;
4041import { AppProvider } from './providers/AppProvider' ;
4142import { AuthProvider , useAuth } from './providers/AuthProvider' ;
@@ -86,6 +87,24 @@ const PsychSheet = () => {
8687 return null ;
8788} ;
8889
90+ const CompetitionPersonByWcaIdRedirect = ( { to } : { to : 'results' | 'records' } ) => {
91+ const { competitionId, wcaId } = useParams ( ) as { competitionId : string ; wcaId : string } ;
92+ const { wcif } = useWCIF ( ) ;
93+ const person = wcif ?. persons . find ( ( p ) => p . wcaId ?. toUpperCase ( ) === wcaId . toUpperCase ( ) ) ;
94+
95+ if ( ! wcif ) {
96+ return null ;
97+ }
98+
99+ if ( ! person ) {
100+ return < Navigate to = { `/competitions/${ competitionId } ` } replace /> ;
101+ }
102+
103+ return (
104+ < Navigate to = { `/competitions/${ competitionId } /persons/${ person . registrantId } /${ to } ` } replace />
105+ ) ;
106+ } ;
107+
89108const CompetitionRedirect = ( { to } : { to : string } ) => {
90109 const { competitionId } = useParams ( ) as { competitionId : string } ;
91110
@@ -103,6 +122,14 @@ const Navigation = () => {
103122 < Route path = "/competitions/:competitionId" element = { < CompetitionLayout /> } >
104123 < Route index element = { < CompetitionHome /> } />
105124
125+ < Route
126+ path = "persons/wca/:wcaId/results"
127+ element = { < CompetitionPersonByWcaIdRedirect to = "results" /> }
128+ />
129+ < Route
130+ path = "persons/wca/:wcaId/records"
131+ element = { < CompetitionPersonByWcaIdRedirect to = "records" /> }
132+ />
106133 < Route path = "persons/:registrantId/*" element = { < CompetitionPerson /> } />
107134 < Route path = "personal-bests/:wcaId" element = { < CompetitionPersonalBests /> } />
108135 < Route path = "personal-records/:wcaId" element = { < CompetitionPersonalBests /> } />
@@ -142,6 +169,7 @@ const Navigation = () => {
142169 < Route path = "*" element = { < p > Path not resolved</ p > } />
143170 </ Route >
144171 < Route path = "/users/:userId" element = { < UserLogin /> } />
172+ < Route path = "/me" element = { < UserPage /> } />
145173 < Route path = "about" element = { < About /> } />
146174 < Route path = "live-activities" element = { < LiveActivitiesAbout /> } />
147175 < Route path = "settings" element = { < Settings /> } />
0 commit comments