fix: Vertical tabs visibility and add mobile search/filter

Fixed 3 critical issues:

1. Fixed Vertical Tabs - Cards All Showing
   - Updated VerticalTabForm to hide inactive sections
   - Only active section visible (className: hidden for others)
   - Proper tab switching now works

2. Added Mobile Search/Filter to Coupons
   - Created CouponFilterSheet component
   - Added mobile search bar with icon
   - Filter button with active count badge
   - Matches Products pattern exactly
   - Sheet with Apply/Reset buttons

3. Removed max-height from VerticalTabForm
   - User removed max-h-[calc(100vh-200px)]
   - Content now flows naturally
   - Better for forms with varying heights

Components Created:
- CouponFilterSheet.tsx - Mobile filter bottom sheet
  - Discount type filter
  - Apply/Reset actions
  - Active filter count

Changes to Coupons/index.tsx:
- Added mobile search bar (md:hidden)
- Added filter sheet state
- Added activeFiltersCount
- Search icon + SlidersHorizontal icon
- Filter badge indicator

Changes to VerticalTabForm:
- Hide inactive sections (className: hidden)
- Only show section matching activeTab
- Proper visibility control

Result:
 Vertical tabs work correctly (only one section visible)
 Mobile search/filter on Coupons (like Products)
 Filter count badge
 Professional mobile UX

Next: Move customer site member checkbox to settings
This commit is contained in:
dwindown
2025-11-20 20:32:46 +07:00
parent be671b66ec
commit e8ca3ceeb2
5 changed files with 186 additions and 58 deletions

View File

@@ -92,13 +92,15 @@ export function VerticalTabForm({ tabs, children, className }: VerticalTabFormPr
{/* Content Area */}
<div
ref={contentRef}
className="flex-1 overflow-y-auto max-h-[calc(100vh-200px)] pr-2"
className="flex-1 overflow-y-auto pr-2"
>
{React.Children.map(children, (child) => {
if (React.isValidElement(child) && child.props['data-section-id']) {
const sectionId = child.props['data-section-id'];
const isActive = sectionId === activeTab;
return React.cloneElement(child as React.ReactElement<any>, {
ref: (el: HTMLElement) => registerSection(sectionId, el),
className: isActive ? '' : 'hidden',
});
}
return child;