mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: some set info in meta section
This commit is contained in:
1 parent
e38713f365
commit
ae5e38139b
8 files changed
+93
-24
No files matched your search
@@ -1037,6 +1037,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"free": "Free",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"compare": "Compare",
|
"compare": "Compare",
|
||||||
"swap": {
|
"swap": {
|
||||||
@@ -1054,7 +1055,8 @@
|
|||||||
"purchase": "Purchase price",
|
"purchase": "Purchase price",
|
||||||
"restoration": "Restoration price",
|
"restoration": "Restoration price",
|
||||||
"sale": "Sale price",
|
"sale": "Sale price",
|
||||||
"research": "Research XP"
|
"set": "Set",
|
||||||
|
"price": "Price"
|
||||||
},
|
},
|
||||||
|
|
||||||
"tech_tree": {
|
"tech_tree": {
|
||||||
|
|||||||
@@ -17,8 +17,21 @@ const NATIONAL_BANNER_POSITION_OVERRIDES: Partial<Record<Nation, string>> = {
|
|||||||
export function MetaSection() {
|
export function MetaSection() {
|
||||||
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
||||||
const tank = TankopediaEphemeral_ue.use((state) => state.tank);
|
const tank = TankopediaEphemeral_ue.use((state) => state.tank);
|
||||||
|
const set = TankopediaEphemeral_ue.use((state) => state.set);
|
||||||
|
const catalogueId = TankopediaEphemeral_ue.use((state) => state.catalogueId);
|
||||||
const ClassIcon = classIcons_ue[tank.tank_class];
|
const ClassIcon = classIcons_ue[tank.tank_class];
|
||||||
const { locale, strings } = useLocale();
|
const { locale, strings } = useLocale();
|
||||||
|
const reward = set.tank_set_rewards.find(
|
||||||
|
(reward) =>
|
||||||
|
reward.tank_set_reward_on_level &&
|
||||||
|
reward.tank_set_reward_on_level.reward_list.some(
|
||||||
|
(rewardOnLevel) =>
|
||||||
|
rewardOnLevel.tank_reward &&
|
||||||
|
rewardOnLevel.tank_reward.tank_catalog_id === catalogueId,
|
||||||
|
),
|
||||||
|
)!;
|
||||||
|
const price =
|
||||||
|
reward.tank_set_reward_price?.price_list[0].currency_price!.amount;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex justify="center" mt="-9">
|
<Flex justify="center" mt="-9">
|
||||||
@@ -148,24 +161,28 @@ export function MetaSection() {
|
|||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Listing>
|
</Listing>
|
||||||
{/* TODO: ADD RESEARCH COST */}
|
<Listing label={strings.website.tools.tankopedia.meta.set}>
|
||||||
{/* {protagonist.research_cost && (
|
{set.tank_set_ui!.tank_set_displayed_name}
|
||||||
<Listing
|
</Listing>
|
||||||
label={strings.website.tools.tankopedia.meta.research}
|
<Listing label={strings.website.tools.tankopedia.meta.price}>
|
||||||
>
|
<Flex align="center" gap="1">
|
||||||
<Flex align="center" gap="1">
|
{reward.tank_set_reward_price === undefined ? (
|
||||||
{(
|
strings.website.tools.tankopedia.meta.free
|
||||||
protagonist.research_cost.research_cost_type!
|
) : (
|
||||||
.value as number
|
<>
|
||||||
).toLocaleString(locale)}
|
{price?.toLocaleString(locale)}
|
||||||
<img
|
|
||||||
style={{ width: '1em', height: '1em' }}
|
<img
|
||||||
alt="xp"
|
style={{ width: '1em', height: '1em' }}
|
||||||
src={asset('icons/currencies/xp.webp')}
|
alt="xp"
|
||||||
/>
|
src={
|
||||||
</Flex>
|
'https://wotblitz-gc.gcdn.co/dlc/ultra_test2_25abc2385a5/assets/Medusa/Currency/T_UI_Currency_Silver_S.webp'
|
||||||
</Listing>
|
}
|
||||||
)} */}
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
|
</Listing>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ import type { GetPackedMetadataAsyncResponse } from '@blitzkit/closed/src/unreal
|
|||||||
export const metadata = new MetadataAccessor(
|
export const metadata = new MetadataAccessor(
|
||||||
await requestAutoProxyClient<GetPackedMetadataAsyncResponse>(
|
await requestAutoProxyClient<GetPackedMetadataAsyncResponse>(
|
||||||
'GetPackedMetadataAsyncRequest',
|
'GetPackedMetadataAsyncRequest',
|
||||||
).then((packed) => unpackMetadata(packed)),
|
).then(unpackMetadata),
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import type { TankSetCatalogComponent } from '@protos/blitz_static_tank_set_component';
|
||||||
|
import type { MetadataAccessor } from 'submodules/blitzkit-closed/src';
|
||||||
|
|
||||||
|
export async function tankToSet(metadata: MetadataAccessor, tank: string) {
|
||||||
|
for (const [id] of metadata.items) {
|
||||||
|
if (!id.startsWith('TankSetEntity')) continue;
|
||||||
|
|
||||||
|
const components = await metadata.get(id);
|
||||||
|
const set = await components.get<TankSetCatalogComponent>(
|
||||||
|
'tankSetCatalogComponent',
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const reward of set.tank_set_rewards) {
|
||||||
|
if (!reward.tank_set_reward_on_level) continue;
|
||||||
|
|
||||||
|
for (const rewardOnLevel of reward.tank_set_reward_on_level.reward_list) {
|
||||||
|
if (!rewardOnLevel.tank_reward) continue;
|
||||||
|
|
||||||
|
if (rewardOnLevel.tank_reward.tank_catalog_id === tank) {
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Tank ${tank} not found in any set`);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { CompensationComponent } from '@protos/blitz_static_compensation_component';
|
import type { CompensationComponent } from '@protos/blitz_static_compensation_component';
|
||||||
import { type TankCatalogComponent } from '@protos/blitz_static_tank_component';
|
import { type TankCatalogComponent } from '@protos/blitz_static_tank_component';
|
||||||
|
import type { TankSetCatalogComponent } from '@protos/blitz_static_tank_set_component';
|
||||||
import { PageWrapper } from 'packages/website/src/components/PageWrapper';
|
import { PageWrapper } from 'packages/website/src/components/PageWrapper';
|
||||||
import { MetaSection } from 'packages/website/src/components/Tankopedia_ue/MetaSection';
|
import { MetaSection } from 'packages/website/src/components/Tankopedia_ue/MetaSection';
|
||||||
import {
|
import {
|
||||||
@@ -12,13 +13,23 @@ import { TankopediaEphemeral_ue } from 'packages/website/src/stores/tankopediaEp
|
|||||||
interface PageProps extends LocaleAcceptorProps {
|
interface PageProps extends LocaleAcceptorProps {
|
||||||
tank: TankCatalogComponent;
|
tank: TankCatalogComponent;
|
||||||
compensation: CompensationComponent;
|
compensation: CompensationComponent;
|
||||||
|
set: TankSetCatalogComponent;
|
||||||
|
catalogueId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Page({ tank, compensation, localeContext }: PageProps) {
|
export function Page({
|
||||||
|
tank,
|
||||||
|
compensation,
|
||||||
|
set,
|
||||||
|
localeContext,
|
||||||
|
catalogueId,
|
||||||
|
}: PageProps) {
|
||||||
return (
|
return (
|
||||||
<LocaleProvider {...localeContext}>
|
<LocaleProvider {...localeContext}>
|
||||||
<App.Provider>
|
<App.Provider>
|
||||||
<TankopediaEphemeral_ue.Provider data={{ tank, compensation }}>
|
<TankopediaEphemeral_ue.Provider
|
||||||
|
data={{ tank, compensation, set, catalogueId }}
|
||||||
|
>
|
||||||
<PageWrapper p="0" maxWidth="unset" color="purple" gap="9" pb="9">
|
<PageWrapper p="0" maxWidth="unset" color="purple" gap="9" pb="9">
|
||||||
<MetaSection />
|
<MetaSection />
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import type {
|
|||||||
import { slugify } from '@blitzkit/core';
|
import { slugify } from '@blitzkit/core';
|
||||||
import locales from '@blitzkit/i18n/locales.json';
|
import locales from '@blitzkit/i18n/locales.json';
|
||||||
import type { GetStaticPaths } from 'astro';
|
import type { GetStaticPaths } from 'astro';
|
||||||
|
import { tankToSet } from 'packages/website/src/core/blitz/tankToSet';
|
||||||
import { metadata } from '../../../../core/blitz/metadata';
|
import { metadata } from '../../../../core/blitz/metadata';
|
||||||
import BaseLayout from '../../../../layouts/BaseLayout.astro';
|
import BaseLayout from '../../../../layouts/BaseLayout.astro';
|
||||||
import { getStaticPaths as parentGetStaticPaths } from '../index.astro';
|
import { getStaticPaths as parentGetStaticPaths } from '../index.astro';
|
||||||
@@ -44,6 +45,7 @@ export const getStaticPaths = (async () => {
|
|||||||
}) satisfies GetStaticPaths;
|
}) satisfies GetStaticPaths;
|
||||||
|
|
||||||
const { item, locale, strings } = Astro.props;
|
const { item, locale, strings } = Astro.props;
|
||||||
|
const set = await tankToSet(metadata, item);
|
||||||
const tankComponents = await metadata.get(item);
|
const tankComponents = await metadata.get(item);
|
||||||
const tank = await tankComponents.get<TankCatalogComponent>(
|
const tank = await tankComponents.get<TankCatalogComponent>(
|
||||||
'tankCatalogComponent',
|
'tankCatalogComponent',
|
||||||
@@ -54,5 +56,12 @@ const compensation = await tankComponents.get<CompensationComponent>(
|
|||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout {locale} {strings}>
|
<BaseLayout {locale} {strings}>
|
||||||
<Page client:load {tank} {compensation} localeContext={{ locale, strings }} />
|
<Page
|
||||||
|
client:load
|
||||||
|
catalogueId={item}
|
||||||
|
{set}
|
||||||
|
{tank}
|
||||||
|
{compensation}
|
||||||
|
localeContext={{ locale, strings }}
|
||||||
|
/>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { CompensationComponent } from '@protos/blitz_static_compensation_component';
|
import type { CompensationComponent } from '@protos/blitz_static_compensation_component';
|
||||||
import type { TankCatalogComponent } from '@protos/blitz_static_tank_component';
|
import type { TankCatalogComponent } from '@protos/blitz_static_tank_component';
|
||||||
|
import type { TankSetCatalogComponent } from '@protos/blitz_static_tank_set_component';
|
||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import { subscribeWithSelector } from 'zustand/middleware';
|
import { subscribeWithSelector } from 'zustand/middleware';
|
||||||
import { createContextualStore } from '../core/zustand/createContextualStore';
|
import { createContextualStore } from '../core/zustand/createContextualStore';
|
||||||
@@ -7,6 +8,8 @@ import { createContextualStore } from '../core/zustand/createContextualStore';
|
|||||||
interface TankopediaEphemeral_ue {
|
interface TankopediaEphemeral_ue {
|
||||||
tank: TankCatalogComponent;
|
tank: TankCatalogComponent;
|
||||||
compensation: CompensationComponent;
|
compensation: CompensationComponent;
|
||||||
|
set: TankSetCatalogComponent;
|
||||||
|
catalogueId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TankopediaEphemeral_ue = createContextualStore(
|
export const TankopediaEphemeral_ue = createContextualStore(
|
||||||
|
|||||||
Submodule submodules/blitzkit-closed updated: 25f8838ba5...793d8c9f4e.
Reference in new issue
Block a user