CI / go-test (push) Canceled after 0s
CI / postgres-durable-first (push) Canceled after 0s
CI / codegen (push) Canceled after 0s
CI / govulncheck (push) Canceled after 0s
CI / race (push) Canceled after 0s
CI / fuzz-smoke (push) Canceled after 0s
CI / golangci (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CodeQL Advanced / Analyze (go) (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
Release 3X-UI / build (386) (push) Canceled after 0s
Release 3X-UI / build (amd64) (push) Canceled after 0s
Release 3X-UI / build (arm64) (push) Canceled after 0s
Release 3X-UI / build (armv5) (push) Canceled after 0s
Release 3X-UI / build (armv6) (push) Canceled after 0s
Release 3X-UI / build (armv7) (push) Canceled after 0s
Release 3X-UI / build (s390x) (push) Canceled after 0s
Release 3X-UI / Build for Windows (amd64) (push) Canceled after 0s
Release 3X-UI / Publish rolling dev release (push) Canceled after 0s
28 lines
765 B
TypeScript
28 lines
765 B
TypeScript
import { useEffect } from 'react';
|
|
import { useLocation } from 'react-router';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
const TITLE_KEYS: Record<string, string> = {
|
|
'/': 'menu.dashboard',
|
|
'/inbounds': 'menu.inbounds',
|
|
'/clients': 'menu.clients',
|
|
'/nodes': 'menu.nodes',
|
|
'/hosts': 'menu.hosts',
|
|
'/settings': 'menu.settings',
|
|
'/xray': 'menu.xray',
|
|
'/outbound': 'menu.outbounds',
|
|
'/routing': 'menu.routing',
|
|
};
|
|
|
|
export function usePageTitle() {
|
|
const { pathname } = useLocation();
|
|
const { t } = useTranslation();
|
|
|
|
useEffect(() => {
|
|
const key = TITLE_KEYS[pathname];
|
|
const title = key ? t(key) : '3X-UI';
|
|
const host = window.location.hostname;
|
|
document.title = host ? `${host} - ${title}` : title;
|
|
}, [pathname, t]);
|
|
}
|