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: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/png" href="/roakey.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PyRIT - Python Risk Identification Tool</title>
<title>Co-PyRIT</title>
</head>
<body>
<div id="root"></div>
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/Layout/MainLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,12 @@ describe("MainLayout", () => {
</MainLayout>
);

expect(screen.getByText("Co-PyRIT")).toBeInTheDocument();
expect(
screen.getByText("Python Risk Identification Tool")
).toBeInTheDocument();

// Wait for async useEffect to complete
await waitFor(() => {
expect(mockedVersionApi.getVersion).toHaveBeenCalled();
});
expect(await screen.findByText("Co-PyRIT 1.0.0")).toBeInTheDocument();
expect(document.title).toBe("Co-PyRIT 1.0.0");
});

it("renders children content", async () => {
Expand Down Expand Up @@ -179,6 +176,8 @@ describe("MainLayout", () => {
await waitFor(() => {
expect(mockedVersionApi.getVersion).toHaveBeenCalled();
});
expect(screen.getByText("Co-PyRIT")).toBeInTheDocument();
expect(document.title).toBe("Co-PyRIT");
});

it("renders a 'Take a tour' button in the top bar when onStartTour is provided", async () => {
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/Layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ export default function MainLayout({
versionApi.getVersion()
.then(data => {
setVersion(data.version)
document.title = `Co-PyRIT ${data.version}`
setCommit(data.version.includes('.dev') ? data.commit ?? null : null)
setDatabaseInfo(data.database_info ?? null)
})
.catch(() => setVersion('Unknown'))
.catch(() => {
setVersion('Unknown')
document.title = 'Co-PyRIT'
})
}, [])

const title = version === 'Unknown' ? 'Co-PyRIT' : `Co-PyRIT ${version}`

return (
<div className={styles.root}>
<div className={styles.topBar}>
Expand All @@ -61,7 +67,7 @@ export default function MainLayout({
className={styles.logo}
/>
</Tooltip>
<Text className={styles.title}>Co-PyRIT</Text>
<Text className={styles.title}>{title}</Text>
<Text className={styles.subtitle}>Python Risk Identification Tool</Text>
<div className={styles.spacer} />
{onStartTour && (
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { AuthProvider } from './auth/AuthProvider'
import { ThemeProvider } from './hooks/useTheme'
import './styles/global.css'

document.title = 'Co-PyRIT'

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ThemeProvider>
Expand Down
Loading