mirror of
https://github.com/KivotosRailway/website.git
synced 2026-11-03 11:06:32 +09:00
优化代码
This commit is contained in:
@@ -21,7 +21,7 @@ function isIcpVisibleHost(hostname: string) {
|
||||
|
||||
export function SiteFooter() {
|
||||
const [locale, setLocale] = useState<Locale>(useRouteLocale());
|
||||
const [showIcp, setShowIcp] = useState(false);
|
||||
const [showIcp] = useState(() => typeof window !== "undefined" && isIcpVisibleHost(window.location.hostname));
|
||||
|
||||
useEffect(() => {
|
||||
const syncLocale = (nextLocale: Locale) => setLocale(nextLocale);
|
||||
@@ -37,7 +37,6 @@ export function SiteFooter() {
|
||||
const currentLocale = getInitialLocale();
|
||||
syncLocale(currentLocale);
|
||||
applyLocale(currentLocale);
|
||||
setShowIcp(isIcpVisibleHost(window.location.hostname));
|
||||
window.addEventListener("kr-locale-change", handleLocaleChange);
|
||||
window.addEventListener("storage", handleStorage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user