fix: Zone modal blank + Tax route redirect + Simplify notifications (Shopify style)

## 1. Fixed Blank Zone Modal 
**Problem:** Console error "setIsModalOpen is not defined"

**Fix:**
- Removed unused isModalOpen/setIsModalOpen state
- Use selectedZone state to control modal open/close
- Dialog/Drawer opens when selectedZone is truthy
- Simplified onClick handlers

## 2. Fixed Tax Settings Blank Page 
**Problem:** URL /settings/taxes (plural) was blank

**Fix:**
- Added redirect route from /settings/taxes → /settings/tax
- Maintains backward compatibility
- Users can access via either URL

## 3. Simplified Notifications (Shopify/Marketplace Style) 
**Philosophy:** "App for daily needs and quick access"

**Changes:**
-  Removed individual "Edit in WooCommerce" links (cluttered)
-  Removed "Email Sender" section (not daily need)
-  Removed redundant "Advanced Settings" link at bottom
-  Simplified info card with practical tips
-  Clean toggle-only interface like Shopify
-  Single link to advanced settings in info card

**What Shopify/Marketplaces Do:**
- Simple on/off toggles for each notification
- Brief description of what each email does
- Practical tips about which to enable
- Single link to advanced customization
- No clutter, focus on common tasks

**What We Provide:**
- Toggle to enable/disable each email
- Clear descriptions
- Quick tips for best practices
- Link to WooCommerce for templates/styling

**What WooCommerce Provides:**
- Email templates and HTML/CSS
- Subject lines and content
- Sender details
- Custom recipients

Perfect separation of concerns! 🎯
This commit is contained in:
dwindown
2025-11-10 00:06:27 +07:00
parent a373b141b7
commit 06213d2ed4
3 changed files with 60 additions and 163 deletions

View File

@@ -243,10 +243,7 @@ export default function ShippingPage() {
<Button
variant="ghost"
size="sm"
onClick={() => {
setSelectedZone(zone);
setIsModalOpen(true);
}}
onClick={() => setSelectedZone(zone)}
>
<Edit className="h-4 w-4" />
</Button>
@@ -325,7 +322,7 @@ export default function ShippingPage() {
{/* Settings Modal/Drawer */}
{selectedZone && (
isDesktop ? (
<Dialog open={isModalOpen} onOpenChange={setIsModalOpen}>
<Dialog open={!!selectedZone} onOpenChange={(open) => !open && setSelectedZone(null)}>
<DialogContent className="max-w-2xl max-h-[90vh] flex flex-col p-0">
<DialogHeader className="px-6 py-4 border-b">
<DialogTitle>{selectedZone.name}</DialogTitle>
@@ -497,14 +494,14 @@ export default function ShippingPage() {
{__('Edit in WooCommerce')}
</a>
</Button>
<Button onClick={() => setIsModalOpen(false)}>
<Button onClick={() => setSelectedZone(null)}>
{__('Done')}
</Button>
</div>
</DialogContent>
</Dialog>
) : (
<Drawer open={isModalOpen} onOpenChange={setIsModalOpen}>
<Drawer open={!!selectedZone} onOpenChange={(open) => !open && setSelectedZone(null)}>
<DrawerContent className="max-h-[90vh] flex flex-col">
<DrawerHeader className="border-b">
<DrawerTitle>{selectedZone.name}</DrawerTitle>
@@ -668,7 +665,7 @@ export default function ShippingPage() {
{__('Edit in WooCommerce')}
</a>
</Button>
<Button onClick={() => setIsModalOpen(false)} className="w-full">
<Button onClick={() => setSelectedZone(null)} className="w-full">
{__('Done')}
</Button>
</div>