From a5080f1b2e65bd92797deec61fa1b74bbe427105 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Thu, 9 Apr 2026 12:58:38 +0100 Subject: [PATCH] feat: show positive/negative sign on most instructions --- src/components/mii/instructions.tsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/mii/instructions.tsx b/src/components/mii/instructions.tsx index 7a7b18b..0782335 100644 --- a/src/components/mii/instructions.tsx +++ b/src/components/mii/instructions.tsx @@ -30,6 +30,10 @@ function not(value: any) { return value !== undefined && value !== null; } +function numberValue(value: number, cutoff: number = 25) { + return value === cutoff ? "0" : value > cutoff ? `+${value - cutoff}` : `${value - cutoff}`; +} + function GridPosition({ index, cols = 5 }: { index: number; cols?: number }) { const row = Math.floor(index / cols) + 1; const col = (index % cols) + 1; @@ -101,11 +105,11 @@ function Section({ name, instructions, children, isSubSection }: SectionProps) { )} - {not(height) && {height}} - {not(distance) && {distance}} - {not(rotation) && {rotation}} - {not(size) && {size}} - {not(stretch) && {stretch}} + {not(height) && {numberValue(height!, 0)}} + {not(distance) && {numberValue(distance!, 0)}} + {not(rotation) && {numberValue(rotation!, 0)}} + {not(size) && {numberValue(size!, 0)}} + {not(stretch) && {numberValue(stretch!, 0)}} {children} @@ -194,13 +198,13 @@ export default function MiiInstructions({ instructions }: Props) { )} {(height || weight || datingPreferences || voice || personality) && ( -
+

Misc

- {not(height) && {height === 64 ? "0" : height! > 64 ? `+${height! - 64}` : `${height! - 64}`}} - {not(weight) && {weight === 64 ? "0" : weight! > 64 ? `+${weight! - 64}` : `${weight! - 64}`}} + {not(height) && {numberValue(height!, 64)}} + {not(weight) && {numberValue(weight!, 64)}}
{birthday && ( @@ -221,10 +225,10 @@ export default function MiiInstructions({ instructions }: Props) {

Voice

- {not(voice.speed) && {voice.speed}} - {not(voice.pitch) && {voice.pitch}} - {not(voice.depth) && {voice.depth}} - {not(voice.delivery) && {voice.delivery}} + {not(voice.speed) && {numberValue(voice.speed!, 25)}} + {not(voice.pitch) && {numberValue(voice.pitch!, 25)}} + {not(voice.depth) && {numberValue(voice.depth!, 25)}} + {not(voice.delivery) && {numberValue(voice.delivery!, 25)}} {not(voice.tone) && {voice.tone}}