From 1132018d16b7dbc8fa0b78cd49879e8385af1c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:32:08 -0500 Subject: [PATCH] feat: seperable buttons and remove antagonist configurer --- .../components/ConfigurationChildWrapper.tsx | 9 +- .../components/Miscellaneous.tsx | 4 - .../Model/CharacteristicsSection.tsx | 3 +- .../components/Model/components/Options.tsx | 157 ++---------------- src/components/ConsumablesManager.tsx | 12 +- src/components/CrewSkillManager.tsx | 2 - src/components/EquipmentManager.tsx | 12 +- .../ModuleButtons/ConsumableButton.tsx | 9 +- .../ModuleButtons/TankComponentButton.tsx | 11 -- src/components/ModuleManager.tsx | 12 -- src/components/ProvisionsManager.tsx | 5 +- 11 files changed, 36 insertions(+), 200 deletions(-) diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/components/ConfigurationChildWrapper.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/components/ConfigurationChildWrapper.tsx index 3c83a2f74..f164672eb 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/components/ConfigurationChildWrapper.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/components/ConfigurationChildWrapper.tsx @@ -1,15 +1,16 @@ -import { Flex } from '@radix-ui/themes'; +import { Flex, FlexProps } from '@radix-ui/themes'; import { ReactNode } from 'react'; -interface ConfigurationChildWrapperProps { +type ConfigurationChildWrapperProps = FlexProps & { children: ReactNode; -} +}; export function ConfigurationChildWrapper({ children, + ...props }: ConfigurationChildWrapperProps) { return ( - + {children} ); diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/components/Miscellaneous.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/components/Miscellaneous.tsx index d82594867..2713ba63d 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/components/Miscellaneous.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/components/Miscellaneous.tsx @@ -47,8 +47,6 @@ export function Miscellaneous() { left: '50%', transform: 'translate(calc(-50% + 4px), calc(-50% + 4px))', }} - first - last onClick={() => { mutateDuel((draft) => { draft.protagonist.camouflage = !camouflage; @@ -59,8 +57,6 @@ export function Miscellaneous() { 0} - first - last banner={ cooldownBooster === 0 ? undefined diff --git a/src/app/tools/tankopedia/[id]/components/Model/CharacteristicsSection.tsx b/src/app/tools/tankopedia/[id]/components/Model/CharacteristicsSection.tsx index f9a803d1f..7347b9e1b 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/CharacteristicsSection.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/CharacteristicsSection.tsx @@ -36,7 +36,7 @@ export function CharacteristicsSection() { justify="center" direction={{ initial: 'column', sm: 'row' }} > - + Configuration @@ -45,7 +45,6 @@ export function CharacteristicsSection() { - - + {[...antagonistUniqueGuns] .reverse() .map(({ gun, turret }, index) => ( @@ -196,8 +190,6 @@ export function Options({ thicknessRange }: OptionsProps) { draft.antagonist.shell = gun.shells[0]; }) } - first={index === 0} - last={index === antagonistUniqueGuns.length - 1} selected={gun.id === antagonistGun.id} discriminator={TIER_ROMAN_NUMERALS[gun.tier]} /> @@ -343,136 +335,21 @@ export function Options({ thicknessRange }: OptionsProps) { onValueChange={setTab} style={{ position: 'relative' }} > - - - - - - - Search - Configure - - - - - { - mutateDuel((draft) => { - draft.antagonist.tank = tank; - draft.antagonist.engine = tank.engines.at(-1)!; - draft.antagonist.track = tank.tracks.at(-1)!; - draft.antagonist.turret = tank.turrets.at(-1)!; - draft.antagonist.gun = - draft.antagonist.turret.guns.at(-1)!; - draft.antagonist.shell = - draft.antagonist.gun.shells[0]; - }); - setAntagonistSelectorOpen(false); - }} - /> - - - - - - - - {antagonistTank.name} modules - - - - - {antagonistTank.turrets.map((turret, index) => ( - { - mutateDuel((draft) => { - draft.antagonist.turret = turret; - draft.antagonist.gun = - turret.guns.at(-1)!; - draft.antagonist.shell = - draft.antagonist.gun.shells[0]; - }); - mutateTankopediaEphemeral((draft) => { - draft.shot = undefined; - }); - }} - selected={antagonistTurret.id === turret.id} - discriminator={ - TIER_ROMAN_NUMERALS[turret.tier] - } - module="turret" - /> - ))} - - - {antagonistTurret.guns.map((gun, index) => ( - { - mutateDuel((draft) => { - draft.antagonist.gun = gun; - draft.antagonist.shell = gun.shells[0]; - }); - }} - selected={antagonistGun.id === gun.id} - discriminator={TIER_ROMAN_NUMERALS[gun.tier]} - module="gun" - /> - ))} - - - - - - Properties - -
    -
  • - Turret: {antagonistTurret.name} -
  • -
  • - Gun: {antagonistGun.name} -
  • -
  • Shells:
  • -
      - {antagonistGun.shells.map((shell) => ( -
    • - {SHELL_NAMES[shell.type]}:{' '} - - {resolveNearPenetration(shell.penetration)} - mm - - , {shell.damage.armor}HP -
    • - ))} -
    -
-
-
-
-
+ { + mutateDuel((draft) => { + draft.antagonist.tank = tank; + draft.antagonist.engine = tank.engines.at(-1)!; + draft.antagonist.track = tank.tracks.at(-1)!; + draft.antagonist.turret = tank.turrets.at(-1)!; + draft.antagonist.gun = + draft.antagonist.turret.guns.at(-1)!; + draft.antagonist.shell = draft.antagonist.gun.shells[0]; + }); + setAntagonistSelectorOpen(false); + }} + /> diff --git a/src/components/ConsumablesManager.tsx b/src/components/ConsumablesManager.tsx index a9119731e..e10c78f2b 100644 --- a/src/components/ConsumablesManager.tsx +++ b/src/components/ConsumablesManager.tsx @@ -24,14 +24,7 @@ export function ConsumablesManager({ hasHighEndConsumables, }: ConsumablesManagerProps) { return ( - + {consumables.map((consumable, index) => { const isSelected = selected.some((id) => id === consumable.id); @@ -53,9 +46,6 @@ export function ConsumablesManager({ : undefined } key={consumable.id} - first={index === 0} - last={index === consumables.length - 1} - rowChild disabled={disabled && !isSelected} consumable={consumable.id} selected={isSelected} diff --git a/src/components/CrewSkillManager.tsx b/src/components/CrewSkillManager.tsx index a3686bfef..7f3b3c64f 100644 --- a/src/components/CrewSkillManager.tsx +++ b/src/components/CrewSkillManager.tsx @@ -30,8 +30,6 @@ export function CrewSkillManager({ 0} discriminator={ level === 0 ? undefined : TIER_ROMAN_NUMERALS[level as Tier] diff --git a/src/components/EquipmentManager.tsx b/src/components/EquipmentManager.tsx index 08b3d3edc..e0fa540f8 100644 --- a/src/components/EquipmentManager.tsx +++ b/src/components/EquipmentManager.tsx @@ -23,8 +23,10 @@ export function EquipmentManager({ { const draft = cloneDeep(matrix); @@ -40,8 +42,10 @@ export function EquipmentManager({ /> { const draft = cloneDeep(matrix); diff --git a/src/components/ModuleButtons/ConsumableButton.tsx b/src/components/ModuleButtons/ConsumableButton.tsx index 950ccb8a2..370074de8 100644 --- a/src/components/ModuleButtons/ConsumableButton.tsx +++ b/src/components/ModuleButtons/ConsumableButton.tsx @@ -23,17 +23,13 @@ export function ConsumableButton({ return ( {(cooldown || duration) && ( - + {duration && ( 0 ? 'green' @@ -50,6 +46,7 @@ export function ConsumableButton({ )} {cooldown && ( { selected?: boolean; - first?: boolean; - last?: boolean; - rowChild?: boolean; children?: ReactNode; discriminator?: ReactNode; disabled?: boolean; @@ -17,9 +14,6 @@ export interface TankComponentButtonProps export function TankComponentButton({ variant, selected, - first = false, - last = false, - rowChild, discriminator, special, children, @@ -38,11 +32,6 @@ export function TankComponentButton({ minWidth: 48, height: 40, position: 'relative', - borderTopLeftRadius: first ? undefined : 0, - borderTopRightRadius: last ? undefined : 0, - borderBottomLeftRadius: first ? undefined : 0, - borderBottomRightRadius: last ? undefined : 0, - margin: rowChild ? -0.5 : 'unset', overflow: 'hidden', cursor: 'unset', pointerEvents: variant === 'ghost' ? 'none' : undefined, diff --git a/src/components/ModuleManager.tsx b/src/components/ModuleManager.tsx index e51014e1e..832925116 100644 --- a/src/components/ModuleManager.tsx +++ b/src/components/ModuleManager.tsx @@ -41,9 +41,6 @@ export function ModuleManager({ setTurretMenuOpen(true)} /> @@ -85,9 +82,6 @@ export function ModuleManager({ setGunMenuOpen(true)} /> @@ -128,9 +122,6 @@ export function ModuleManager({ setEngineMenuOpen(true)} /> @@ -170,9 +161,6 @@ export function ModuleManager({ setTrackMenuOpen(true)} /> diff --git a/src/components/ProvisionsManager.tsx b/src/components/ProvisionsManager.tsx index 689e75305..b8aafd752 100644 --- a/src/components/ProvisionsManager.tsx +++ b/src/components/ProvisionsManager.tsx @@ -15,16 +15,13 @@ export function ProvisionsManager({ disabled, }: ProvisionsManagerProps) { return ( - + {provisions.map((provision, index) => { const isSelected = selected.includes(provision); return (