From fa2ae6951b4b885655f0bd3b0f18bea2a04fc7de Mon Sep 17 00:00:00 2001 From: dwindown Date: Mon, 10 Nov 2025 22:23:35 +0700 Subject: [PATCH] fix: Refine Store Details UX and currency display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Changes ### 1. Split Store Identity and Brand Cards ✅ **Before:** Single tall "Store Identity" card **After:** Two focused cards **Store Identity Card:** - Store name - Store tagline - Contact email - Customer support email - Store phone **Brand Card:** - Store logo - Store icon - Brand colors (Primary, Accent, Error) - Reset to default button **Result:** Better organization, easier to scan --- ### 2. Fix Currency Symbol Fallback ✅ **Issue:** When currency has no symbol (like AUD), showed € instead **Screenshot:** Preview showed "€1.234.568" for Australian dollar **Fix:** ```typescript // Get currency symbol from currencies data, fallback to currency code const currencyInfo = currencies.find((c: any) => c.code === settings.currency); let symbol = settings.currency; // Default to currency code if (currencyInfo?.symbol && !currencyInfo.symbol.includes('&#')) { // Use symbol only if it exists and doesn't contain HTML entities symbol = currencyInfo.symbol; } ``` **Result:** - AUD → Shows "AUD1234" instead of "€1234" - IDR → Shows "Rp1234" (has symbol) - USD → Shows "$1234" (has symbol) - Currencies without symbols → Show currency code --- ### 3. Move Overview Card to First Position ✅ **Before:** Overview card at the bottom **After:** Overview card at the top **Rationale:** - Quick glance at store location, currency, timezone - Sets context for the rest of the settings - Industry standard (Shopify shows overview first) **Card Content:** ``` 📍 Store Location: Australia Currency: Australian dollar • Timezone: Australia/Sydney ``` --- ## Final Card Order 1. **Store Overview** (new position) 2. **Store Identity** (name, tagline, contacts) 3. **Brand** (logo, icon, colors) 4. **Store Address** 5. **Currency & Formatting** 6. **Standards & Formats** **Result:** Logical flow, better UX, professional layout --- admin-spa/src/routes/Settings/Store.tsx | 164 +++++++++++++----------- 1 file changed, 87 insertions(+), 77 deletions(-) diff --git a/admin-spa/src/routes/Settings/Store.tsx b/admin-spa/src/routes/Settings/Store.tsx index 34d80be..fdca450 100644 --- a/admin-spa/src/routes/Settings/Store.tsx +++ b/admin-spa/src/routes/Settings/Store.tsx @@ -200,7 +200,14 @@ export default function StoreDetailsPage() { .replace('.', settings.decimalSep) .replace(/\B(?=(\d{3})+(?!\d))/g, settings.thousandSep); - const symbol = settings.currency === 'IDR' ? 'Rp' : settings.currency === 'USD' ? '$' : '€'; + // Get currency symbol from currencies data, fallback to currency code + const currencyInfo = currencies.find((c: any) => c.code === settings.currency); + let symbol = settings.currency; // Default to currency code + + if (currencyInfo?.symbol && !currencyInfo.symbol.includes('&#')) { + // Use symbol only if it exists and doesn't contain HTML entities + symbol = currencyInfo.symbol; + } switch (settings.currencyPosition) { case 'left': @@ -223,6 +230,26 @@ export default function StoreDetailsPage() { onSave={handleSave} isLoading={isLoading} > + {/* Store Overview */} +
+ {(() => { + const currencyFlag = flagsData.find((f: any) => f.code === settings.currency); + const currencyInfo = currencies.find((c: any) => c.code === settings.currency); + const countryName = currencyFlag?.country || settings.country; + + return ( + <> +

+ 📍 Store Location: {countryName} +

+

+ Currency: {currencyInfo?.name || settings.currency} • Timezone: {settings.timezone} +

+ + ); + })()} +
+ {/* Store Identity */} + + updateSetting('storeTagline', e.target.value)} + placeholder="Quality products, delivered fast" + /> + + + - - updateSetting('storeTagline', e.target.value)} - placeholder="Quality products, delivered fast" - /> - - + {/* Brand */} + - - {/* Brand Colors */} - -
- updateSetting('primaryColor', color)} - /> +
+

Brand Colors

+
+ updateSetting('primaryColor', color)} + /> - updateSetting('accentColor', color)} - /> + updateSetting('accentColor', color)} + /> - updateSetting('errorColor', color)} - /> -
+ updateSetting('errorColor', color)} + /> +
-
- -

- Changes apply after saving -

+
+ +

+ Changes apply after saving +

+
@@ -562,26 +592,6 @@ export default function StoreDetailsPage() {
- - {/* Summary Card - Professional, No Flag */} -
- {(() => { - const currencyFlag = flagsData.find((f: any) => f.code === settings.currency); - const currencyInfo = currencies.find((c: any) => c.code === settings.currency); - const countryName = currencyFlag?.country || settings.country; - - return ( - <> -

- 📍 Store Location: {countryName} -

-

- Currency: {currencyInfo?.name || settings.currency} • Timezone: {settings.timezone} -

- - ); - })()} -
); }