mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 07:43:49 +01:00
migrate tier list
This commit is contained in:
108 files changed
+1238
-922
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
||||
import { Flex, Heading, Text } from "@radix-ui/themes";
|
||||
import { PageWrapper } from "../../../../../components/PageWrapper";
|
||||
import { mixStaticPaths } from "../../../../../core/blitzkit/mixStaticPaths";
|
||||
import { tools } from "../../../../../constants/tools";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../../index.astro";
|
||||
import { AUTH_PROVIDER_NAMES, AUTH_PROVIDERS, Authorize } from "./_index";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import { Section } from "../../../../components/Section";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import { createDefaultEnvironment } from "@blitzkit/core";
|
||||
import { useEffect } from "react";
|
||||
import { api } from "../../../../api/dynamic";
|
||||
import { CompareControls } from "../../../../components/CompareControls";
|
||||
import { CompareTable } from "../../../../components/CompareTable";
|
||||
import { EmptyState } from "../../../../components/EmptyState";
|
||||
import { Section } from "../../../../components/Section";
|
||||
import { tankToCompareMember } from "../../../../core/blitzkit/tankToCompareMember";
|
||||
import { withErrorWrapper } from "../../../../hocs/withErrorWrapper";
|
||||
import { withLocale } from "../../../../hocs/withLocale";
|
||||
import { useStrings } from "../../../../hooks/useStrings";
|
||||
import { CompareEphemeral } from "../../../../stores/compareEphemeral";
|
||||
import styles from "./_index.module.css";
|
||||
|
||||
const [skillDefinitions, tankDefinitions] = await Promise.all([
|
||||
api.skills(),
|
||||
api.tanks(),
|
||||
]);
|
||||
|
||||
export const Page = withLocale(
|
||||
withErrorWrapper(() => {
|
||||
CompareEphemeral.useInitialization(() =>
|
||||
createDefaultEnvironment(skillDefinitions),
|
||||
);
|
||||
|
||||
return <Content />;
|
||||
}),
|
||||
);
|
||||
|
||||
function Content() {
|
||||
const strings = useStrings();
|
||||
const members = CompareEphemeral.use((state) => state.members);
|
||||
|
||||
// Tanks come from the url on load
|
||||
useEffect(() => {
|
||||
const tanks = new URLSearchParams(window.location.search).get("tanks");
|
||||
|
||||
if (tanks === null) return;
|
||||
|
||||
CompareEphemeral.mutate((draft) => {
|
||||
draft.members = tanks
|
||||
.split(",")
|
||||
.map((id) => tankDefinitions.tanks[Number(id)])
|
||||
.filter((tank) => tank !== undefined)
|
||||
.map(tankToCompareMember);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// ...and are written back whenever they change
|
||||
useEffect(() => {
|
||||
const search = new URLSearchParams(window.location.search);
|
||||
|
||||
search.set("tanks", members.map(({ state }) => state.tank).join(","));
|
||||
|
||||
window.history.replaceState(
|
||||
{},
|
||||
"",
|
||||
`${window.location.pathname}?${search.toString()}`,
|
||||
);
|
||||
}, [members]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Section>
|
||||
<div className={styles.top}>
|
||||
<CompareControls />
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{members.length > 0 && (
|
||||
<Section overflow>
|
||||
<CompareTable />
|
||||
</Section>
|
||||
)}
|
||||
|
||||
{members.length === 0 && (
|
||||
<Section>
|
||||
<EmptyState
|
||||
title={strings.compare.no_tanks.title}
|
||||
body={strings.compare.no_tanks.body}
|
||||
/>
|
||||
</Section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
---
|
||||
import ColorScale from "../../../../components/ColorScale.astro";
|
||||
import { CompareControls } from "../../../../components/CompareControls";
|
||||
import { CompareTable } from "../../../../components/CompareTable";
|
||||
import CompareURLManager from "../../../../components/CompareURLManager.astro";
|
||||
import { Section } from "../../../../components/Section";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
@@ -15,8 +18,25 @@ const { locale } = Astro.props;
|
||||
<ColorScale color="amber" />
|
||||
<ColorScale color="blue" />
|
||||
|
||||
<style>
|
||||
.controls {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<BaseLayout tool={tools.compare} accent="pink" {locale}>
|
||||
<!-- TODO: add svg art for this tool -->
|
||||
<ToolBanner tool={tools.compare} {locale} />
|
||||
<Page {locale} client:load />
|
||||
<CompareURLManager />
|
||||
|
||||
<Section>
|
||||
<div class="controls">
|
||||
<CompareControls {locale} client:load />
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<Section overflow>
|
||||
<CompareTable {locale} client:load />
|
||||
</Section>
|
||||
</BaseLayout>
|
||||
@@ -2,7 +2,7 @@
|
||||
import { CheckIcon, StarFilledIcon } from "@radix-ui/react-icons";
|
||||
import { Badge } from "../../../components/Badge";
|
||||
import ColorScale from "../../../components/ColorScale.astro";
|
||||
import { tools } from "../../../constants/tools";
|
||||
import { tools } from "../../../config/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
import type { Color } from "../../../ui/color";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import CreditsPromo from "../../../../components/CreditsPromo.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import ToolLayout from "../../../../layouts/ToolLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import { readFile } from "fs/promises";
|
||||
import { mixStaticPaths } from "../../../../../../core/blitzkit/mixStaticPaths";
|
||||
import { tools } from "../../../../../../constants/tools";
|
||||
import { tools } from "../../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../../../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { MagicWandIcon, StarFilledIcon } from "@radix-ui/react-icons";
|
||||
import { Flex, Heading, Link } from "@radix-ui/themes";
|
||||
import { compareVersions } from "compare-versions";
|
||||
import { PageWrapper } from "../../../../../components/PageWrapper";
|
||||
import { tools } from "../../../../../constants/tools";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../../index.astro";
|
||||
|
||||
@@ -31,7 +31,7 @@ import { Text } from "../../../../../components/Text";
|
||||
import {
|
||||
embedConfigurations,
|
||||
extractEmbedConfigDefaults,
|
||||
} from "../../../../../constants/embeds";
|
||||
} from "../../../../../config/embeds";
|
||||
import {
|
||||
LocaleProvider,
|
||||
type LocaleAcceptorProps,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import {
|
||||
embedConfigurations,
|
||||
embedRenderers,
|
||||
extractEmbedConfigDefaults,
|
||||
} from "../../../../../../constants/embeds";
|
||||
} from "../../../../../../config/embeds";
|
||||
import {
|
||||
LocaleProvider,
|
||||
type LocaleAcceptorProps,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
||||
import { embedConfigurations } from "../../../../../constants/embeds";
|
||||
import { tools } from "../../../../../constants/tools";
|
||||
import { embedConfigurations } from "../../../../../config/embeds";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Link } from "../../../../components/Link";
|
||||
import { LinkI18n } from "../../../../components/LinkI18n";
|
||||
import { Text } from "../../../../components/Text";
|
||||
import { discordLink } from "../../../../config/socials";
|
||||
import { embedConfigurations } from "../../../../constants/embeds";
|
||||
import { embedConfigurations } from "../../../../config/embeds";
|
||||
import {
|
||||
type LocaleAcceptorProps,
|
||||
LocaleProvider,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import ColorScale from "../../../../components/ColorScale.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import HomeGames from "../../../components/HomeGames.astro";
|
||||
import HomePlayers from "../../../components/HomePlayers.astro";
|
||||
import HomeTanks from "../../../components/HomeTanks.astro";
|
||||
import HomeTechnical from "../../../components/HomeTechnical.astro";
|
||||
import { tools, type Tool } from "../../../constants/tools";
|
||||
import { tools, type Tool } from "../../../config/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import ToolOpenGraph from "../../../../components/ToolOpenGraph.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import ColorScale from "../../../../components/ColorScale.astro";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import ToolOpenGraph from "../../../../components/ToolOpenGraph.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index.tsx";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import ToolLayout from "../../../../layouts/ToolLayout.astro";
|
||||
import type { getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { api } from "../../../../../api/dynamic";
|
||||
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
||||
import ColorRanks from "../../../../../components/ColorRanks.astro";
|
||||
import ColorScale from "../../../../../components/ColorScale.astro";
|
||||
import { tools } from "../../../../../constants/tools";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Loadout, Sandbox } from "./_index";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TankSearchBar } from "../../../../components/TankSearchBar";
|
||||
import { TankSearchFilters } from "../../../../components/TankSearchFilters";
|
||||
import { TankSearchResults } from "../../../../components/TankSearchResults";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import ToolLayout from "../../../../layouts/ToolLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
<ToolLayout {locale} tool={tools.tier_list}>
|
||||
<Page {locale} client:load />
|
||||
</ToolLayout>
|
||||
@@ -1,30 +0,0 @@
|
||||
import { PageWrapper } from "../../../../components/PageWrapper";
|
||||
import { TankSearchFilters } from "../../../../components/TankSearchFilters";
|
||||
import { TierListControls } from "../../../../components/TierList/Controls";
|
||||
import { TierListTable } from "../../../../components/TierList/Table";
|
||||
import { TierListTiles } from "../../../../components/TierList/Tiles";
|
||||
import { URLManager } from "../../../../components/TierList/URLManager";
|
||||
import {
|
||||
LocaleProvider,
|
||||
type LocaleAcceptorProps,
|
||||
} from "../../../../hooks/useLocale";
|
||||
|
||||
export function Page({ locale }: LocaleAcceptorProps) {
|
||||
return (
|
||||
<LocaleProvider locale={locale}>
|
||||
<Content />
|
||||
</LocaleProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function Content() {
|
||||
return (
|
||||
<PageWrapper color="orange" maxWidth="100rem">
|
||||
<URLManager />
|
||||
<TierListControls />
|
||||
<TierListTable />
|
||||
<TankSearchFilters />
|
||||
<TierListTiles />
|
||||
</PageWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
import ColorScale from "../../../../components/ColorScale.astro";
|
||||
import { ScrollerCurtains } from "../../../../components/ScrollerCurtains";
|
||||
import { Section } from "../../../../components/Section";
|
||||
import { TankSearchFilters } from "../../../../components/TankSearchFilters";
|
||||
import { TierListControls } from "../../../../components/TierListControls";
|
||||
import { TierListTable } from "../../../../components/TierListTable";
|
||||
import { TierListTiles } from "../../../../components/TierListTiles";
|
||||
import TierListURLManager from "../../../../components/TierListURLManager.astro";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tierListColors } from "../../../../config/tierList";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
{tierListColors.map((color) => (
|
||||
<ColorScale {color} />
|
||||
))}
|
||||
<ColorScale color="red" />
|
||||
|
||||
<BaseLayout tool={tools.tier_list} accent="orange" {locale}>
|
||||
<ToolBanner tool={tools.tier_list} {locale} />
|
||||
<TierListURLManager />
|
||||
|
||||
<Section>
|
||||
<TierListControls {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TierListTable {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<TankSearchFilters {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TierListTiles {locale} client:load />
|
||||
</Section>
|
||||
</BaseLayout>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import { mixStaticPaths } from "../../../../../../astro/mixStaticPaths";
|
||||
import { embedConfigurations } from "../../../../../../constants/embeds";
|
||||
import { embedConfigurations } from "../../../../../../config/embeds";
|
||||
import LegacyRedirect from "../../../../../../layouts/LegacyRedirect.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
|
||||
|
||||
Reference in new issue
Block a user