优化代码

This commit is contained in:
2026-09-17 04:14:24 +08:00
parent d76d476e75
commit 7f6323f64c
18 changed files with 443 additions and 618 deletions
+1 -2
View File
@@ -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);