mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
demote componnents
This commit is contained in:
18 files changed
+437
-441
No files matched your search
-37
@@ -1,37 +0,0 @@
|
||||
.sandbox {
|
||||
flex-grow: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
@media (pointer: fine) {
|
||||
padding-top: var(--space-4);
|
||||
}
|
||||
}
|
||||
|
||||
.loadout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-5);
|
||||
|
||||
background-color: var(--gray-2);
|
||||
|
||||
position: sticky;
|
||||
top: 0;
|
||||
|
||||
max-height: 100dvh;
|
||||
overflow-y: auto;
|
||||
|
||||
padding: var(--space-5);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.sandbox,
|
||||
.loadout {
|
||||
&[data-tabbed="false"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import { useMemo } from "react";
|
||||
import { api } from "../../../../../api/dynamic";
|
||||
import { ScrollerOrientation } from "../../../../../components/Scroller";
|
||||
import { ScrollerCurtains } from "../../../../../components/ScrollerCurtains";
|
||||
import type { ThicknessRange } from "../../../../../components/TankStaticArmor";
|
||||
import { TankopediaCharacteristics } from "../../../../../components/TankopediaCharacteristics";
|
||||
import { TankopediaGameModeAbilities } from "../../../../../components/TankopediaGameModeAbilities";
|
||||
import { TankopediaLoadout } from "../../../../../components/TankopediaLoadout";
|
||||
import { TankopediaSandbox } from "../../../../../components/TankopediaSandbox";
|
||||
import { TankopediaTabs } from "../../../../../components/TankopediaTabs";
|
||||
import { TankopediaTitle } from "../../../../../components/TankopediaTitle";
|
||||
import { TankopediaVideos } from "../../../../../components/TankopediaVideos";
|
||||
import { defaultEqualizer } from "../../../../../config/equalizer";
|
||||
import { withErrorWrapper } from "../../../../../hocs/withErrorWrapper";
|
||||
import { withLocale } from "../../../../../hocs/withLocale";
|
||||
import { useCharacteristics } from "../../../../../hooks/useCharacteristics";
|
||||
import { Tankopedia, TankopediaTab } from "../../../../../stores/tankopedia";
|
||||
import styles from "./_index.module.css";
|
||||
|
||||
interface TankProps {
|
||||
id: number;
|
||||
}
|
||||
|
||||
const tanks = await api.tanks();
|
||||
|
||||
export const Sandbox = withErrorWrapper(
|
||||
withLocale<TankProps>(({ id }) => {
|
||||
const protagonistTank = tanks.tanks[id];
|
||||
|
||||
Tankopedia.useInitialization(() => protagonistTank);
|
||||
|
||||
const protagonist = Tankopedia.use((state) => state.protagonist);
|
||||
const equalize = Tankopedia.use((state) => state.environment.equalize);
|
||||
|
||||
const characteristics = useCharacteristics("protagonist");
|
||||
const antagonistCharacteristics = useCharacteristics("antagonist");
|
||||
|
||||
const thicknessRange = useMemo(() => {
|
||||
const entries = Object.values(tanks.tanks);
|
||||
const filtered = entries.filter(
|
||||
(thisTank) => thisTank.tier === protagonistTank.tier,
|
||||
);
|
||||
const value =
|
||||
(filtered.reduce((accumulator, thisTank) => {
|
||||
return (
|
||||
accumulator +
|
||||
thisTank.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration!.near *
|
||||
((equalize ? thisTank.equalizer : undefined) ?? defaultEqualizer)
|
||||
.penetration
|
||||
);
|
||||
}, 0) /
|
||||
filtered.length) *
|
||||
(3 / 4);
|
||||
|
||||
return { value } satisfies ThicknessRange;
|
||||
}, [protagonist, equalize]);
|
||||
|
||||
return (
|
||||
<div className={styles.sandbox}>
|
||||
<TankopediaTitle />
|
||||
<TankopediaSandbox
|
||||
antagonistCharacteristics={antagonistCharacteristics}
|
||||
thicknessRange={thicknessRange}
|
||||
/>
|
||||
<TankopediaCharacteristics characteristics={characteristics} />
|
||||
<TankopediaGameModeAbilities />
|
||||
<TankopediaVideos />
|
||||
<TankopediaTabs />
|
||||
</div>
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
export const Loadout = withErrorWrapper(
|
||||
withLocale<TankProps>(({ id }) => {
|
||||
Tankopedia.useInitialization(() => tanks.tanks[id]);
|
||||
|
||||
const tabbed = Tankopedia.use(
|
||||
(state) => state.tab === TankopediaTab.Loadout,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={styles.loadout} data-tabbed={tabbed}>
|
||||
<ScrollerCurtains orientation={ScrollerOrientation.Vertical} />
|
||||
<TankopediaLoadout />
|
||||
</div>
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -3,10 +3,16 @@ import { api } from "../../../../../api/dynamic";
|
||||
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
||||
import ColorRanks from "../../../../../components/ColorRanks.astro";
|
||||
import ColorScale from "../../../../../components/ColorScale.astro";
|
||||
import { TankopediaCharacteristics } from "../../../../../components/TankopediaCharacteristics";
|
||||
import TankopediaGameModeAbilities from "../../../../../components/TankopediaGameModeAbilities.astro";
|
||||
import { TankopediaLoadout } from "../../../../../components/TankopediaLoadout";
|
||||
import { TankopediaSandbox } from "../../../../../components/TankopediaSandbox";
|
||||
import { TankopediaTabs } from "../../../../../components/TankopediaTabs";
|
||||
import TankopediaTitle from "../../../../../components/TankopediaTitle.astro";
|
||||
import TankopediaVideos from "../../../../../components/TankopediaVideos.astro";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Loadout, Sandbox } from "./_index";
|
||||
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
const tanks = await api.tanks();
|
||||
@@ -31,12 +37,32 @@ const { id, locale } = Astro.props;
|
||||
display: flex;
|
||||
|
||||
gap: var(--space-4);
|
||||
|
||||
.sandbox {
|
||||
flex-grow: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
@media (pointer: fine) {
|
||||
padding-top: var(--space-4);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<BaseLayout tool={tools.tanks} {locale} accent="violet">
|
||||
<div class="page">
|
||||
<Sandbox {id} {locale} client:load />
|
||||
<Loadout {id} {locale} client:load />
|
||||
<div class="sandbox">
|
||||
<TankopediaTitle {id} {locale} />
|
||||
<TankopediaSandbox {id} {locale} client:load />
|
||||
<TankopediaCharacteristics {id} {locale} client:load />
|
||||
<TankopediaGameModeAbilities {id} {locale} />
|
||||
<TankopediaVideos {id} {locale} />
|
||||
<TankopediaTabs {id} {locale} client:load />
|
||||
</div>
|
||||
|
||||
<TankopediaLoadout {id} {locale} client:load />
|
||||
</div>
|
||||
</BaseLayout>
|
||||
Reference in new issue
Block a user