Skip to content

Commit 7aff285

Browse files
committed
Gate personal user page behind feature flag
1 parent b1450ff commit 7aff285

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

src/App.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import client from './apolloClient';
55
import { usePageTracking } from './hooks/usePageTracking';
66
import { CompetitionLayout } from './layouts/CompetitionLayout';
77
import { RootLayout } from './layouts/RootLayout';
8+
import { FEATURE_FLAGS } from './lib/featureFlags';
89
import About from './pages/About';
910
import CompetitionAdmin from './pages/Competition/Admin';
1011
import CompetitionEvents from './pages/Competition/ByGroup/Events';
@@ -169,9 +170,16 @@ const Navigation = () => {
169170
<Route path="*" element={<p>Path not resolved</p>} />
170171
</Route>
171172
<Route path="/users/:userId" element={<UserLogin />} />
172-
<Route path="/me" element={<Navigate to="/me/competitions" replace />} />
173-
<Route path="/me/results/:resultsMode" element={<Navigate to="/me/results" replace />} />
174-
<Route path="/me/:tab" element={<UserPage />} />
173+
{FEATURE_FLAGS.personalUserPage && (
174+
<>
175+
<Route path="/me" element={<Navigate to="/me/competitions" replace />} />
176+
<Route
177+
path="/me/results/:resultsMode"
178+
element={<Navigate to="/me/results" replace />}
179+
/>
180+
<Route path="/me/:tab" element={<UserPage />} />
181+
</>
182+
)}
175183
<Route path="about" element={<About />} />
176184
<Route path="live-activities" element={<LiveActivitiesAbout />} />
177185
<Route path="settings" element={<Settings />} />

src/layouts/RootLayout/Header.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Link, useParams } from 'react-router-dom';
55
import { Popover } from 'react-tiny-popover';
66
import { useCompetition } from '@/hooks/queries/useCompetition';
77
import { UserCompsResponse } from '@/lib/api';
8+
import { FEATURE_FLAGS } from '@/lib/featureFlags';
89
import { useAuth } from '@/providers/AuthProvider';
910
import { useWCIF } from '@/providers/WCIFProvider';
1011

@@ -76,9 +77,11 @@ export default function Header() {
7677
<div
7778
className="z-50 mt-2 border-2 shadow-xl bg-panel border-tertiary-weak"
7879
onClick={() => setIsPopoverOpen(!isPopoverOpen)}>
79-
<Link to="/me" className="block w-32 px-3 py-2 link-inline hover-bg-tertiary">
80-
My profile
81-
</Link>
80+
{FEATURE_FLAGS.personalUserPage && (
81+
<Link to="/me" className="block w-32 px-3 py-2 link-inline hover-bg-tertiary">
82+
My profile
83+
</Link>
84+
)}
8285
<Link to="/settings" className="block w-32 px-3 py-2 link-inline hover-bg-tertiary">
8386
Settings
8487
</Link>

src/lib/featureFlags.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const enabledValues = new Set(['1', 'true', 'yes', 'on']);
2+
3+
const isEnabled = (value: string | undefined) =>
4+
value ? enabledValues.has(value.toLowerCase()) : false;
5+
6+
export const FEATURE_FLAGS = {
7+
personalUserPage: isEnabled(import.meta.env.VITE_FEATURE_PERSONAL_USER_PAGE),
8+
};

src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ interface ImportMetaEnv {
88
readonly VITE_NOTIFY_COMP_ORIGIN?: string;
99
readonly VITE_NOTIFYCOMP_API_ORIGIN?: string;
1010
readonly VITE_NOTIFYCOMP_WS_ORIGIN?: string;
11+
readonly VITE_FEATURE_PERSONAL_USER_PAGE?: string;
1112
}

0 commit comments

Comments
 (0)