Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/standalone/src/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import NotFound from './components/AppLayout/NotFound';
import LoginPage from './components/Login/LoginPage';
import { AuthContext } from './context/AuthContext';

const APP_TITLE = 'Flight Control';

const EnrollmentRequestDetails = React.lazy(
() =>
import(
Expand Down Expand Up @@ -144,7 +142,7 @@ const ErrorPage = () => {
};

const TitledRoute = ({ title, children }: React.PropsWithChildren<{ title: string }>) => {
useDocumentTitle(`${APP_TITLE} | ${title}`);
useDocumentTitle(title);
return (
<React.Suspense
fallback={
Expand Down
9 changes: 7 additions & 2 deletions libs/ui-components/src/hooks/useDocumentTitle.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as React from 'react';
import { useAppContext } from './useAppContext';

// a custom hook for setting the page title
export function useDocumentTitle(title: string) {
const { settings } = useAppContext();
const appTitle = settings.isRHEM ? 'Edge Manager' : 'Flight Control';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const documentTitle = `${appTitle} | ${title}`;

React.useEffect(() => {
const originalTitle = document.title;
document.title = title;
document.title = documentTitle;
return () => {
document.title = originalTitle;
};
}, [title]);
}, [documentTitle]);
}
Loading