diff --git a/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx b/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx new file mode 100644 index 000000000..aae3905a9 --- /dev/null +++ b/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx @@ -0,0 +1,146 @@ +import { ChevronRightIcon } from '@radix-ui/react-icons'; +import { Flex, Heading, Text } from '@radix-ui/themes'; +import Link from 'next/link'; +import { use } from 'react'; +import PageWrapper from '../../../../../../components/PageWrapper'; +import { asset } from '../../../../../../core/blitzkit/asset'; +import { tankDefinitions } from '../../../../../../core/blitzkit/tankDefinitions'; +import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants'; +import { useDuel } from '../../../../../../stores/duel'; + +function Arrow() { + return ( + + + + + + ); +} + +export function TechTreeSection() { + const awaitedTankDefinitions = use(tankDefinitions); + const tank = useDuel((state) => state.protagonist!.tank); + + if (tank.treeType !== 'researchable') return null; + + function Card({ id }: { id: number }) { + const ancestor = awaitedTankDefinitions[id]; + + return ( + + + + + + + + {TIER_ROMAN_NUMERALS[ancestor.tier]} + + {ancestor.name} + + + + + + + {tank.xp?.toLocaleString()} + + + + + + + {tank.price.value?.toLocaleString()} + + + + + + + ); + } + + return ( + + Tech tree + + + {tank.ancestors && ( + <> + + {tank.ancestors.map((id) => ( + + ))} + + + + + )} + + + + + + {tank.successors && ( + <> + + + + {tank.successors.map((id) => ( + + ))} + + + )} + + + ); +} diff --git a/src/app/tools/tankopedia/[id]/page.tsx b/src/app/tools/tankopedia/[id]/page.tsx index 2b2bcded0..f2cdf175f 100644 --- a/src/app/tools/tankopedia/[id]/page.tsx +++ b/src/app/tools/tankopedia/[id]/page.tsx @@ -8,6 +8,7 @@ import { mutateTankopediaTemporary } from '../../../../stores/tankopedia'; import { CharacteristicsSection } from './components/Model/CharacteristicsSection'; import { HeroSection } from './components/Model/HeroSection'; import { HistoricalSection } from './components/Model/HistoricalSection'; +import { TechTreeSection } from './components/Model/TechTreeSection'; import { TankopediaSeparator } from './components/TankopediaSeparator'; import { Videos } from './components/Videos'; @@ -62,6 +63,7 @@ export default function Page({ params }: { params: { id: string } }) { <> {/* */} +