From 5dbfd006c2ef7eadb513adee73b19ce06f6ddb41 Mon Sep 17 00:00:00 2001 From: dnviti Date: Mon, 22 Dec 2025 18:02:00 +0100 Subject: [PATCH] used new icons for mtg symbols --- src/client/src/components/ManaIcon.tsx | 54 +++++++++++++ src/client/src/main.tsx | 1 + src/client/src/modules/game/GameView.tsx | 39 ++++----- src/client/src/modules/game/PhaseStrip.tsx | 5 +- src/client/src/utils/textUtils.tsx | 94 ++++++++++++++++++++++ src/package-lock.json | 7 ++ src/package.json | 1 + 7 files changed, 181 insertions(+), 20 deletions(-) create mode 100644 src/client/src/components/ManaIcon.tsx create mode 100644 src/client/src/utils/textUtils.tsx diff --git a/src/client/src/components/ManaIcon.tsx b/src/client/src/components/ManaIcon.tsx new file mode 100644 index 0000000..11aa19d --- /dev/null +++ b/src/client/src/components/ManaIcon.tsx @@ -0,0 +1,54 @@ +import React from 'react'; + +type ManaSymbol = + | 'w' // White + | 'u' // Blue + | 'b' // Black + | 'r' // Red + | 'g' // Green + | 'c' // Colorless + | 'x' | 'y' | 'z' // Variables + | 't' | 'tap' // Tap + | 'q' | 'untap' // Untap + | 'e' | 'energy' // Energy + | 'p' // Phyrexian generic? (check font) + | 'vp' // Velcro/Planechase? + | 's' // Snow + | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' // Numbers + | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' // Higher numbers usually specialized, check support + | 'infinity' + | string; // Allow others + +interface ManaIconProps { + symbol: ManaSymbol; + size?: 'sm' | 'md' | 'lg' | 'xl' | '2x' | '3x' | '4x' | '5x'; // 'ms-2x' etc from the font or custom sizing + className?: string; + shadow?: boolean; // 'ms-cost' adds a shadow usually + fixedWidth?: boolean; // 'ms-fw' +} + +export const ManaIcon: React.FC = ({ + symbol, + size, + className = '', + shadow = false, + fixedWidth = false, +}) => { + // Normalize symbol to lowercase + const sym = symbol.toLowerCase(); + + // Construct class names + // ms is the base class + const classes = [ + 'ms', + `ms-${sym}`, + size ? `ms-${size}` : '', + shadow ? 'ms-cost' : '', // 'ms-cost' is often used formana costs to give them a circle/shadow look. + fixedWidth ? 'ms-fw' : '', + className, + ] + .filter(Boolean) + .join(' '); + + return