From 1f88120c9d8a9e3286a3285d12d2461d22a05b93 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 6 Nov 2025 00:20:38 +0700 Subject: [PATCH] feat: Mobile improvements + simplify payment categories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mobile Improvements: 1. Modal footer buttons now stack vertically on mobile - Order: Save Settings (primary) -> View in WooCommerce -> Cancel - Full width buttons on mobile for easier tapping - Responsive padding: px-4 on mobile, px-6 on desktop 2. Refresh button moved inline with title - Added action prop to SettingsLayout - Refresh button now appears next to Payments title - Cleaner, more compact layout Payment Categories Simplified: 3. Removed Payment Providers section - PayPal, Stripe are also 3rd party, not different - Confusing to separate providers from other gateways - All non-manual gateways now in single category 4. Renamed to Online Payment Methods - Was: Manual + Payment Providers + 3rd Party - Now: Manual + Online Payment Methods - Clearer distinction: offline vs online payments 5. Unified styling for all online gateways - Same card style as manual methods - Status badges (Enabled/Disabled) - Requirements alerts - Manage button always visible Mobile UX: - Footer buttons: flex-col on mobile, flex-row on desktop - Proper button ordering with CSS order utilities - Responsive spacing and padding - Touch-friendly button sizes Files Modified: - Payments.tsx: Mobile footer + simplified categories - SettingsLayout.tsx: Added action prop for header actions Result: ✅ Better mobile experience ✅ Clearer payment method organization ✅ Consistent styling across all gateways --- admin-spa/src/routes/Settings/Payments.tsx | 109 +++++------------- .../Settings/components/SettingsLayout.tsx | 15 ++- 2 files changed, 37 insertions(+), 87 deletions(-) diff --git a/admin-spa/src/routes/Settings/Payments.tsx b/admin-spa/src/routes/Settings/Payments.tsx index 55ded37..c0a8ba5 100644 --- a/admin-spa/src/routes/Settings/Payments.tsx +++ b/admin-spa/src/routes/Settings/Payments.tsx @@ -113,8 +113,8 @@ export default function PaymentsPage() { // Categorize gateways const manualGateways = gateways.filter((g: PaymentGateway) => g.type === 'manual'); - const providerGateways = gateways.filter((g: PaymentGateway) => g.type === 'provider'); - const otherGateways = gateways.filter((g: PaymentGateway) => g.type === 'other'); + // Combine provider and other into single "3rd party" category + const thirdPartyGateways = gateways.filter((g: PaymentGateway) => g.type === 'provider' || g.type === 'other'); if (isLoading) { return ( @@ -128,9 +128,10 @@ export default function PaymentsPage() { return ( <> - - {/* Refresh button */} -
+ Refresh -
+ } + > {/* Manual Payment Methods - First priority */} - {/* Payment Providers - Second priority */} - - {providerGateways.length === 0 ? ( -

- No payment providers installed.{' '} - - Browse payment gateways - - -

- ) : ( + {/* 3rd Party Payment Methods - All online payment gateways */} + {thirdPartyGateways.length > 0 && ( +
- {providerGateways.map((gateway: PaymentGateway) => ( + {thirdPartyGateways.map((gateway: PaymentGateway) => (
○ Disabled )}
-

- {gateway.description} -

+ {gateway.method_description && ( +

+ {gateway.method_description} +

+ )} {!gateway.requirements.met && ( @@ -270,57 +261,6 @@ export default function PaymentsPage() {
))} - )} -
- - {/* 3rd Party Gateways */} - {otherGateways.length > 0 && ( - -
- {otherGateways.map((gateway: PaymentGateway) => ( -
-
-
-
- -
-
-

{gateway.method_title || gateway.title}

- {gateway.method_description && ( -

- {gateway.method_description} -

- )} -
-
-
- {gateway.enabled && ( - - )} - handleToggle(gateway.id, checked)} - disabled={togglingGateway === gateway.id} - /> -
-
-
- ))} -
)}
@@ -332,7 +272,7 @@ export default function PaymentsPage() { {selectedGateway.title} Settings -
+
{/* Footer outside scrollable area */} -
+
-
+
diff --git a/admin-spa/src/routes/Settings/components/SettingsLayout.tsx b/admin-spa/src/routes/Settings/components/SettingsLayout.tsx index 556e4b0..3208703 100644 --- a/admin-spa/src/routes/Settings/components/SettingsLayout.tsx +++ b/admin-spa/src/routes/Settings/components/SettingsLayout.tsx @@ -9,6 +9,7 @@ interface SettingsLayoutProps { onSave?: () => Promise; saveLabel?: string; isLoading?: boolean; + action?: React.ReactNode; } export function SettingsLayout({ @@ -18,6 +19,7 @@ export function SettingsLayout({ onSave, saveLabel = 'Save changes', isLoading = false, + action, }: SettingsLayoutProps) { const [isSaving, setIsSaving] = useState(false); @@ -62,10 +64,15 @@ export function SettingsLayout({
{!onSave && (
-

{title}

- {description && ( -

{description}

- )} +
+
+

{title}

+ {description && ( +

{description}

+ )} +
+ {action &&
{action}
} +
)}