From 7852295465626b445012bfeb1d20a9acdf6a22ec Mon Sep 17 00:00:00 2001 From: alexander-schefe Date: Mon, 22 Sep 2025 11:02:06 +0200 Subject: [PATCH] fix: hide wiki in prod --- packages/frontend/src/components/navigation.tsx | 9 ++++++--- packages/frontend/src/global.d.ts | 1 + packages/frontend/src/helper/wiki-helper.ts | 3 +++ packages/frontend/src/routes.tsx | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 packages/frontend/src/helper/wiki-helper.ts diff --git a/packages/frontend/src/components/navigation.tsx b/packages/frontend/src/components/navigation.tsx index 9779e28b..3eba5de3 100644 --- a/packages/frontend/src/components/navigation.tsx +++ b/packages/frontend/src/components/navigation.tsx @@ -18,6 +18,7 @@ import { useAuthentication } from '../hooks/use-authentication' import strings from '../locales/localization' import Avatar from './avatar' import Dropdown from './dropdown' +import { isWikiFeatureEnabled } from '../helper/wiki-helper' const Navigation: React.FC = () => { const { data, loading } = useNavigationDataQuery() @@ -69,9 +70,11 @@ const Navigation: React.FC = () => { {strings.navigation.settings} - - {strings.navigation.wiki} - + {isWikiFeatureEnabled() && ( + + {strings.navigation.wiki} + + )} ) diff --git a/packages/frontend/src/global.d.ts b/packages/frontend/src/global.d.ts index 4c1c8fcd..9f2d983c 100644 --- a/packages/frontend/src/global.d.ts +++ b/packages/frontend/src/global.d.ts @@ -28,6 +28,7 @@ declare const ENVIRONMENT: { backendUrl: string frontendUrl: string supportMail: string + nodeEnv: string } declare const REVISION: string diff --git a/packages/frontend/src/helper/wiki-helper.ts b/packages/frontend/src/helper/wiki-helper.ts new file mode 100644 index 00000000..50fd70a8 --- /dev/null +++ b/packages/frontend/src/helper/wiki-helper.ts @@ -0,0 +1,3 @@ +export const isWikiFeatureEnabled = (): boolean => { + return ENVIRONMENT.nodeEnv === 'development' || ENVIRONMENT.nodeEnv === 'staging' +} diff --git a/packages/frontend/src/routes.tsx b/packages/frontend/src/routes.tsx index 3db591b9..4883c086 100644 --- a/packages/frontend/src/routes.tsx +++ b/packages/frontend/src/routes.tsx @@ -24,6 +24,7 @@ import SupportPage from './pages/support-page' import TraineePage from './pages/trainee-page' import TrainerReportsPage from './pages/trainer-reports-page' import AzubiWikiPage from './pages/azubi-wiki-page' +import { isWikiFeatureEnabled } from './helper/wiki-helper' type RoutesProps = { currentUser?: @@ -72,7 +73,7 @@ const AppRoutes: React.FunctionComponent = ({ currentUser }) => { } /> } /> } /> - } /> + {isWikiFeatureEnabled() && } />} ) : ( } />