From a83d3dc3a34eee49124afdad2a43224e560457d3 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sat, 8 Nov 2025 22:45:23 +0700 Subject: [PATCH] feat: Add Shipping Zone Settings modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented functional settings modal for shipping zones. Features: ✅ Settings button now opens modal/drawer ✅ Shows zone information (name, regions) ✅ Lists all shipping methods with toggles ✅ Toggle methods directly in modal ✅ Responsive: Dialog on desktop, Drawer on mobile ✅ Link to WooCommerce for advanced settings ✅ Clean, modern UI matching Payments page Modal Content: - Zone name and regions (read-only for now) - Shipping methods list with enable/disable toggles - Price display for each method - "Advanced Settings in WooCommerce" link - Close button User Experience: ✅ Click Settings button → Modal opens ✅ Toggle methods on/off in modal ✅ Click Advanced Settings → Opens WooCommerce ✅ Click Close → Modal closes ✅ Mobile-friendly drawer on small screens Next Steps: - Add editable fields for method settings (cost, conditions) - Use GenericGatewayForm pattern for WooCommerce form fields - Add save functionality for method settings --- admin-spa/src/routes/Settings/Shipping.tsx | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/admin-spa/src/routes/Settings/Shipping.tsx b/admin-spa/src/routes/Settings/Shipping.tsx index 5f6995e..ea49c12 100644 --- a/admin-spa/src/routes/Settings/Shipping.tsx +++ b/admin-spa/src/routes/Settings/Shipping.tsx @@ -219,6 +219,136 @@ export default function ShippingPage() {
  • • {__('Configure detailed shipping settings in WooCommerce for full control')}
  • + + {/* Settings Modal/Drawer */} + {selectedZone && ( + isDesktop ? ( + + + + {selectedZone.name} {__('Settings')} + +
    +

    + {__('Configure shipping zone and methods. For advanced settings, use WooCommerce.')} +

    +
    +
    +

    {__('Zone Information')}

    +

    + {__('Name')}: {selectedZone.name} +

    +

    + {__('Regions')}: {selectedZone.regions} +

    +
    +
    +

    {__('Shipping Methods')}

    +
    + {selectedZone.rates?.map((rate: any) => ( +
    +
    + {rate.name} + { + handleToggle(selectedZone.id, rate.instance_id, checked); + }} + disabled={togglingMethod === `${selectedZone.id}-${rate.instance_id}`} + /> +
    +

    + {__('Price')}: +

    +
    + ))} +
    +
    +
    +
    +
    + + +
    +
    +
    + ) : ( + + + + {selectedZone.name} {__('Settings')} + +
    +

    + {__('Configure shipping zone and methods. For advanced settings, use WooCommerce.')} +

    +
    +
    +

    {__('Zone Information')}

    +

    + {__('Name')}: {selectedZone.name} +

    +

    + {__('Regions')}: {selectedZone.regions} +

    +
    +
    +

    {__('Shipping Methods')}

    +
    + {selectedZone.rates?.map((rate: any) => ( +
    +
    + {rate.name} + { + handleToggle(selectedZone.id, rate.instance_id, checked); + }} + disabled={togglingMethod === `${selectedZone.id}-${rate.instance_id}`} + /> +
    +

    + {__('Price')}: +

    +
    + ))} +
    +
    +
    +
    +
    + + +
    +
    +
    + ) + )} ); }