feat: Complete toolbar standardization - add refresh button and fix reset filters

**Issue:**
- Orders: Missing refresh button (Products had it)
- Orders: Reset button had red background style
- Products: Reset button had text link style
- Inconsistent UX between modules

**Solution:**
1. Updated PROJECT_SOP.md with complete toolbar standards
2. Added refresh button to Orders (now mandatory for all CRUD)
3. Standardized reset filters button style (text link)

**Changes to PROJECT_SOP.md:**
- Added "Refresh (Required)" button type
- Added "Reset Filters" button type (text link style)
- Updated rules: 11 mandatory rules (was 8)
- Rule 2: Refresh button MUST exist in all CRUD lists
- Rule 3: Reset filters use text link (NOT button with background)
- Updated toolbar layout example with complete structure

**Changes to Orders/index.tsx:**
- Added refresh button (always visible)
- Reset button: bg-red-500/10 text-red-600 → text-muted-foreground hover:text-foreground underline
- Reset button text: "Reset" → "Clear filters"
- Removed loading indicator (q.isFetching)

**Result:**
 Both modules now have refresh button
 Consistent reset filters style (text link)
 Consistent button placement and behavior
 Complete toolbar standardization

**Standards Now Include:**
1. Delete button (red, conditional)
2. Refresh button (always visible, REQUIRED)
3. Reset filters (text link, conditional)
4. Export/secondary actions (light, optional)

Ready for Coupons and Customers CRUD implementation! 🎉
This commit is contained in:
dwindown
2025-11-20 10:27:57 +07:00
parent a36094f6df
commit dfbd992a22
2 changed files with 52 additions and 24 deletions

View File

@@ -255,6 +255,15 @@ export default function Orders() {
{__('Delete')} ({selectedIds.length})
</button>
)}
<button
className="border rounded-md px-3 py-2 text-sm hover:bg-accent disabled:opacity-50 inline-flex items-center gap-2"
onClick={handleRefresh}
disabled={q.isLoading || isRefreshing}
>
<RefreshCw className={`w-4 h-4 ${isRefreshing ? 'animate-spin' : ''}`} />
{__('Refresh')}
</button>
</div>
<div className="flex gap-2 items-center">
@@ -299,13 +308,12 @@ export default function Orders() {
{activeFiltersCount > 0 && (
<button
className="rounded-md px-3 py-2 text-sm bg-red-500/10 text-red-600"
className="text-sm text-muted-foreground hover:text-foreground underline"
onClick={handleResetFilters}
>
{__('Reset')}
{__('Clear filters')}
</button>
)}
{q.isFetching && <span className="text-sm opacity-70">{__('Loading…')}</span>}
</div>
</div>
</div>