Home: minor cleanup
All checks were successful
/ depoly (push) Successful in 1m20s

This commit is contained in:
thislight 2025-01-03 22:14:03 +08:00
parent 1128a01e4c
commit 70a8e15be9
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -38,7 +38,7 @@ type StringRes = Record<
const Home: ParentComponent = (props) => { const Home: ParentComponent = (props) => {
let panelList: HTMLDivElement; let panelList: HTMLDivElement;
const [t] = createTranslator( const [t, [stringRes]] = createTranslator(
(code) => import(`./i18n/${code}.json`) as Promise<{ default: StringRes }>, (code) => import(`./i18n/${code}.json`) as Promise<{ default: StringRes }>,
); );
const now = createTimeSource(); const now = createTimeSource();
@ -105,17 +105,15 @@ const Home: ParentComponent = (props) => {
const windowSize = useWindowSize(); const windowSize = useWindowSize();
createEffect((last) => { createEffect((last) => {
if (last !== windowSize.width) { const { width } = windowSize;
if (last !== width) {
requestRecalculateTabIndicator(); requestRecalculateTabIndicator();
} }
return width;
}); });
const [inTransition] = useTransition();
createEffect(() => { createEffect(() => {
if (!inTransition()) { requestRecalculateTabIndicator();
requestAnimationFrame(recalculateTabIndicator);
}
}); });
const isTabFocus = (idx: number) => { const isTabFocus = (idx: number) => {