fix: icon api

This commit is contained in:
tresabhi committed 2025-01-17 19:06:07 -06:00
1 parent 1c00bc81f8
commit 644686582e
2 files changed
+14 -10

No files matched your search

@@ -30,6 +30,7 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE;
import { SUPPORTED_LOCALES } from '@blitzkit/i18n'; import { SUPPORTED_LOCALES } from '@blitzkit/i18n';
import { getBestLocale } from '../core/i18n/getBestLocale'; import { getBestLocale } from '../core/i18n/getBestLocale';
const isAPI = window.location.pathname.startsWith('/api');
const isI18nPath = SUPPORTED_LOCALES.some((locale) => const isI18nPath = SUPPORTED_LOCALES.some((locale) =>
window.location.pathname.startsWith(`/${locale}`), window.location.pathname.startsWith(`/${locale}`),
); );
@@ -38,7 +39,7 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE;
window.location.pathname.startsWith(`/${locale}`), window.location.pathname.startsWith(`/${locale}`),
); );
if (bestLocale !== currentPathLocale) { if (!isAPI && bestLocale !== currentPathLocale) {
window.location.pathname = isI18nPath window.location.pathname = isI18nPath
? window.location.pathname.replace( ? window.location.pathname.replace(
`/${currentPathLocale}`, `/${currentPathLocale}`,
@@ -2,6 +2,7 @@ import { TankSandbox } from '../../../../../components/Tankopedia/HeroSection/co
import { awaitableModelDefinitions } from '../../../../../core/awaitables/modelDefinitions'; import { awaitableModelDefinitions } from '../../../../../core/awaitables/modelDefinitions';
import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions'; import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions';
import { awaitableTankDefinitions } from '../../../../../core/awaitables/tankDefinitions'; import { awaitableTankDefinitions } from '../../../../../core/awaitables/tankDefinitions';
import { LocaleProvider } from '../../../../../hooks/useLocale';
import { App } from '../../../../../stores/app'; import { App } from '../../../../../stores/app';
import { Duel } from '../../../../../stores/duel'; import { Duel } from '../../../../../stores/duel';
import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral'; import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
@@ -23,15 +24,17 @@ export function Page({ id }: PageProps) {
const model = modelDefinitions.models[id]; const model = modelDefinitions.models[id];
return ( return (
<App.Provider> <LocaleProvider locale="en">
<TankopediaPersistent.Provider> <App.Provider>
<Duel.Provider data={{ provisionDefinitions, tank }}> <TankopediaPersistent.Provider>
<TankopediaEphemeral.Provider data={model}> <Duel.Provider data={{ provisionDefinitions, tank }}>
<Content /> <TankopediaEphemeral.Provider data={model}>
</TankopediaEphemeral.Provider> <Content />
</Duel.Provider> </TankopediaEphemeral.Provider>
</TankopediaPersistent.Provider> </Duel.Provider>
</App.Provider> </TankopediaPersistent.Provider>
</App.Provider>
</LocaleProvider>
); );
} }