mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +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": {
|
||||
"free": "Free",
|
||||
"back": "Back",
|
||||
"compare": "Compare",
|
||||
"swap": {
|
||||
@@ -1054,7 +1055,8 @@
|
||||
"purchase": "Purchase price",
|
||||
"restoration": "Restoration price",
|
||||
"sale": "Sale price",
|
||||
"research": "Research XP"
|
||||
"set": "Set",
|
||||
"price": "Price"
|
||||
},
|
||||
|
||||
"tech_tree": {
|
||||
|
||||
@@ -17,8 +17,21 @@ const NATIONAL_BANNER_POSITION_OVERRIDES: Partial<Record<Nation, string>> = {
|
||||
export function MetaSection() {
|
||||
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
||||
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 { 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 (
|
||||
<Flex justify="center" mt="-9">
|
||||
@@ -148,24 +161,28 @@ export function MetaSection() {
|
||||
/>
|
||||
</Flex>
|
||||
</Listing>
|
||||
{/* TODO: ADD RESEARCH COST */}
|
||||
{/* {protagonist.research_cost && (
|
||||
<Listing
|
||||
label={strings.website.tools.tankopedia.meta.research}
|
||||
>
|
||||
<Flex align="center" gap="1">
|
||||
{(
|
||||
protagonist.research_cost.research_cost_type!
|
||||
.value as number
|
||||
).toLocaleString(locale)}
|
||||
<img
|
||||
style={{ width: '1em', height: '1em' }}
|
||||
alt="xp"
|
||||
src={asset('icons/currencies/xp.webp')}
|
||||
/>
|
||||
</Flex>
|
||||
</Listing>
|
||||
)} */}
|
||||
<Listing label={strings.website.tools.tankopedia.meta.set}>
|
||||
{set.tank_set_ui!.tank_set_displayed_name}
|
||||
</Listing>
|
||||
<Listing label={strings.website.tools.tankopedia.meta.price}>
|
||||
<Flex align="center" gap="1">
|
||||
{reward.tank_set_reward_price === undefined ? (
|
||||
strings.website.tools.tankopedia.meta.free
|
||||
) : (
|
||||
<>
|
||||
{price?.toLocaleString(locale)}
|
||||
|
||||
<img
|
||||
style={{ width: '1em', height: '1em' }}
|
||||
alt="xp"
|
||||
src={
|
||||
'https://wotblitz-gc.gcdn.co/dlc/ultra_test2_25abc2385a5/assets/Medusa/Currency/T_UI_Currency_Silver_S.webp'
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Flex>
|
||||
</Listing>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -8,5 +8,5 @@ import type { GetPackedMetadataAsyncResponse } from '@blitzkit/closed/src/unreal
|
||||
export const metadata = new MetadataAccessor(
|
||||
await requestAutoProxyClient<GetPackedMetadataAsyncResponse>(
|
||||
'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 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 { MetaSection } from 'packages/website/src/components/Tankopedia_ue/MetaSection';
|
||||
import {
|
||||
@@ -12,13 +13,23 @@ import { TankopediaEphemeral_ue } from 'packages/website/src/stores/tankopediaEp
|
||||
interface PageProps extends LocaleAcceptorProps {
|
||||
tank: TankCatalogComponent;
|
||||
compensation: CompensationComponent;
|
||||
set: TankSetCatalogComponent;
|
||||
catalogueId: string;
|
||||
}
|
||||
|
||||
export function Page({ tank, compensation, localeContext }: PageProps) {
|
||||
export function Page({
|
||||
tank,
|
||||
compensation,
|
||||
set,
|
||||
localeContext,
|
||||
catalogueId,
|
||||
}: PageProps) {
|
||||
return (
|
||||
<LocaleProvider {...localeContext}>
|
||||
<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">
|
||||
<MetaSection />
|
||||
</PageWrapper>
|
||||
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
import { slugify } from '@blitzkit/core';
|
||||
import locales from '@blitzkit/i18n/locales.json';
|
||||
import type { GetStaticPaths } from 'astro';
|
||||
import { tankToSet } from 'packages/website/src/core/blitz/tankToSet';
|
||||
import { metadata } from '../../../../core/blitz/metadata';
|
||||
import BaseLayout from '../../../../layouts/BaseLayout.astro';
|
||||
import { getStaticPaths as parentGetStaticPaths } from '../index.astro';
|
||||
@@ -44,6 +45,7 @@ export const getStaticPaths = (async () => {
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
const { item, locale, strings } = Astro.props;
|
||||
const set = await tankToSet(metadata, item);
|
||||
const tankComponents = await metadata.get(item);
|
||||
const tank = await tankComponents.get<TankCatalogComponent>(
|
||||
'tankCatalogComponent',
|
||||
@@ -54,5 +56,12 @@ const compensation = await tankComponents.get<CompensationComponent>(
|
||||
---
|
||||
|
||||
<BaseLayout {locale} {strings}>
|
||||
<Page client:load {tank} {compensation} localeContext={{ locale, strings }} />
|
||||
<Page
|
||||
client:load
|
||||
catalogueId={item}
|
||||
{set}
|
||||
{tank}
|
||||
{compensation}
|
||||
localeContext={{ locale, strings }}
|
||||
/>
|
||||
</BaseLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { CompensationComponent } from '@protos/blitz_static_compensation_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 { subscribeWithSelector } from 'zustand/middleware';
|
||||
import { createContextualStore } from '../core/zustand/createContextualStore';
|
||||
@@ -7,6 +8,8 @@ import { createContextualStore } from '../core/zustand/createContextualStore';
|
||||
interface TankopediaEphemeral_ue {
|
||||
tank: TankCatalogComponent;
|
||||
compensation: CompensationComponent;
|
||||
set: TankSetCatalogComponent;
|
||||
catalogueId: string;
|
||||
}
|
||||
|
||||
export const TankopediaEphemeral_ue = createContextualStore(
|
||||
|
||||
Submodule submodules/blitzkit-closed updated: 25f8838ba5...793d8c9f4e.
Reference in new issue
Block a user