page title
This commit is contained in:
+17
-12
@@ -78,6 +78,7 @@ import {
|
||||
countNodesBySection,
|
||||
type NodeSectionCounts,
|
||||
} from './sidebarCounts'
|
||||
import { documentTitleFor, SECTION_TITLES } from './documentTitle'
|
||||
import {
|
||||
isResourceSectionId,
|
||||
navigateTo,
|
||||
@@ -112,18 +113,6 @@ const NAV_ITEMS: ReadonlyArray<{ id: SectionId; label: string }> = [
|
||||
{ id: 'vms', label: 'Virtual Machines' },
|
||||
]
|
||||
|
||||
const SECTION_TITLES: Record<SectionId, string> = {
|
||||
overview: 'Overview',
|
||||
vms: 'Virtual Machines',
|
||||
docker: 'Docker',
|
||||
containers: 'Containers',
|
||||
logs: 'Logs',
|
||||
profile: 'Profile',
|
||||
configuration: 'Configuration',
|
||||
setup: 'Setup',
|
||||
login: 'Sign in',
|
||||
}
|
||||
|
||||
const CONFIG_TABS: ReadonlyArray<{ id: ConfigTabId; label: string }> = [
|
||||
{ id: 'overview', label: 'Overview' },
|
||||
{ id: 'users', label: 'Users' },
|
||||
@@ -3906,6 +3895,22 @@ function App() {
|
||||
}
|
||||
}, [bootState.kind])
|
||||
|
||||
useEffect(() => {
|
||||
if (bootState.kind === 'loading') {
|
||||
document.title = documentTitleFor('loading')
|
||||
return
|
||||
}
|
||||
if (bootState.kind === 'setup') {
|
||||
document.title = documentTitleFor('setup')
|
||||
return
|
||||
}
|
||||
if (bootState.kind === 'login') {
|
||||
document.title = documentTitleFor('login')
|
||||
return
|
||||
}
|
||||
document.title = documentTitleFor(activeSection)
|
||||
}, [bootState.kind, activeSection])
|
||||
|
||||
function goToSection(section: SectionId) {
|
||||
if (section === 'setup' || section === 'login') {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user