mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 00:15:09 +03:00
14c9bdff89
The router, the sidebar, the page titles and the command palette each kept their own list of the panel's pages, so a page added to one could go missing from another without any test noticing. They all read src/routes/panelRoutes.tsx now, and a contract test holds the manifest to the router, the translation bundle and the palette keywords. The unused useZodForm helper goes, and CONTRIBUTING, frontend/CLAUDE.md and the frontend README describe the useForm + rhfZodValidate pattern the panel's forms actually use.
18 lines
522 B
TypeScript
18 lines
522 B
TypeScript
import { useEffect } from 'react';
|
|
import { useLocation } from 'react-router';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { PANEL_TITLE_KEYS } from '@/routes/panelRoutes';
|
|
|
|
export function usePageTitle() {
|
|
const { pathname } = useLocation();
|
|
const { t } = useTranslation();
|
|
|
|
useEffect(() => {
|
|
const key = PANEL_TITLE_KEYS[pathname];
|
|
const title = key ? t(key) : '3X-UI';
|
|
const host = window.location.hostname;
|
|
document.title = host ? `${host} - ${title}` : title;
|
|
}, [pathname, t]);
|
|
}
|