From 697497b11ea7dc1bfbcac8e71f51cdcf0da1f0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:53:00 -0500 Subject: [PATCH] feat: remove useWideFormat --- src/app/tools/session/page.tsx | 4 +- .../[id]/components/Model/HeroSection.tsx | 45 ++++++++----------- .../[id]/components/Model/TechTreeSection.tsx | 30 ++++++++----- src/hooks/useWideFormat.ts | 22 --------- 4 files changed, 39 insertions(+), 62 deletions(-) delete mode 100644 src/hooks/useWideFormat.ts diff --git a/src/app/tools/session/page.tsx b/src/app/tools/session/page.tsx index f13d37320..8993e04e2 100644 --- a/src/app/tools/session/page.tsx +++ b/src/app/tools/session/page.tsx @@ -44,7 +44,6 @@ import searchPlayersAcrossRegions, { import { tankDefinitions } from '../../../core/blitzkit/tankDefinitions'; import { tankAverages } from '../../../core/blitzstars/tankAverages'; import { deltaTankStats } from '../../../core/statistics/deltaTankStats'; -import { useWideFormat } from '../../../hooks/useWideFormat'; import * as Session from '../../../stores/session'; import { IndividualTankStats } from '../../../types/tanksStats'; @@ -54,7 +53,6 @@ export default function Page({ searchParams: { id?: string }; }) { const [loaded, setLoaded] = useState(false); - const wideFormat = useWideFormat(640); const awaitedTankDefinitions = use(tankDefinitions); const awaitedTankAvearges = use(tankAverages); const [showSearch, setShowSearch] = useState(false); @@ -318,7 +316,7 @@ export default function Page({ state.protagonist!.tank); const antagonist = Duel.use((state) => state.antagonist!.tank); - const wideFormat = useWideFormat(880); const compareTanks = protagonist.id === antagonist.id ? [protagonist.id] @@ -25,41 +22,34 @@ export function HeroSection() { return ( -
-
+
); diff --git a/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx b/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx index f89bd8f9d..08b8c4fed 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/TechTreeSection.tsx @@ -1,12 +1,11 @@ import { ChevronRightIcon } from '@radix-ui/react-icons'; -import { ChevronDownIcon, Flex, Text } from '@radix-ui/themes'; +import { Box, ChevronDownIcon, Flex, Heading, Text } from '@radix-ui/themes'; import Link from 'next/link'; import { ComponentProps, 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 { useWideFormat } from '../../../../../../hooks/useWideFormat'; import * as Duel from '../../../../../../stores/duel'; export function TreeArrow({ @@ -51,7 +50,6 @@ export function TreeArrow({ } export function TechTreeSection() { - const wideFormat = useWideFormat(720); const awaitedTankDefinitions = use(tankDefinitions); const tank = Duel.use((state) => state.protagonist!.tank); @@ -139,21 +137,23 @@ export function TechTreeSection() { size={tank.ancestors && tank.successors ? 880 : 480} gap="0" > - {/* + Tech tree - */} + + + {/* BIG TODO: use number format to shorten currencies */} {tank.ancestors && ( <> - + + + + + + )} @@ -196,11 +201,16 @@ export function TechTreeSection() { {tank.successors && ( <> - + + + + + + size; - } - - const [wideFormat, setWideFormat] = useState(hasWideFormat()); - - useEffect(() => { - function handleResize() { - setWideFormat(hasWideFormat()); - } - - window.addEventListener('resize', handleResize); - }, []); - - return wideFormat; -}