From 0546ddefbda9a48ac3f4bbac55a3c9a5deda4365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 29 Aug 2025 23:24:12 -0500 Subject: [PATCH] fix: better shot card alignment --- .../Armor/components/ShotDisplayCard.tsx | 92 +++++++++++-------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/packages/website/src/components/Armor/components/ShotDisplayCard.tsx b/packages/website/src/components/Armor/components/ShotDisplayCard.tsx index e2e673a9f..b5c0a2dc5 100644 --- a/packages/website/src/components/Armor/components/ShotDisplayCard.tsx +++ b/packages/website/src/components/Armor/components/ShotDisplayCard.tsx @@ -37,44 +37,48 @@ function LayerEntry({ const { locale, strings } = useLocale(); return ( - - - {layerIndex} - - - {layerName} - + + + + {layerIndex} + + - {layer.type === null && ( - <> - + + + {layerName} + + + + + {layer.type === null && ( + <> + + {literals(strings.common.units.mm, [ + Math.round(layer.distance * 1000).toLocaleString(locale), + ])} + + + + {literals( + strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats + .ricochet_loss, + [Math.max(-100, -50 * layer.distance).toFixed(0)], + )} + + + )} + + {layer.type === ArmorType.External && ( + {literals(strings.common.units.mm, [ - Math.round(layer.distance * 1000).toLocaleString(locale), + Math.round(layer.thickness).toLocaleString(locale), ])} - - - {literals( - strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats - .ricochet_loss, - [Math.max(-100, -50 * layer.distance).toFixed(0)], - )} - - - )} - - {layer.type === ArmorType.External && ( - - {literals(strings.common.units.mm, [ - Math.round(layer.thickness).toLocaleString(locale), - ])} - - )} - - {(layer.type === ArmorType.Primary || - layer.type === ArmorType.Spaced) && ( - <> - + )} + {(layer.type === ArmorType.Primary || + layer.type === ArmorType.Spaced) && ( + {literals( angle === undefined ? strings.common.units.mm @@ -86,7 +90,12 @@ function LayerEntry({ ], )} + )} + + {(layer.type === ArmorType.Primary || + layer.type === ArmorType.Spaced) && ( + {literals( strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats @@ -94,9 +103,9 @@ function LayerEntry({ [Math.round(layer.thickness).toLocaleString(locale)], )} - + )} - + ); } @@ -115,7 +124,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) { const inTitleColor = shotStatusColors[shot.in.status]; return ( - + @@ -127,7 +136,12 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) { )} - + {shot.in.layers.map((layer, index) => { const layerName = strings.website.tools.tankopedia.sandbox.dynamic.shot_card @@ -161,7 +175,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) { /> ); })} - +
{shot.out && shot.out.layers.length > 0 && (