Fix IDE errors from ESLint cleanup

This commit is contained in:
Dwindi Ramadhana
2026-03-12 04:08:57 +07:00
parent 90169b508d
commit ab10c25c28
34 changed files with 155 additions and 258 deletions

View File

@@ -291,13 +291,6 @@ export default function Addresses() {
}
};
// Check if a field should be wide (full width)
const isFieldWide = (field: CheckoutField): boolean => {
const fieldName = field.key.replace(/^billing_/, '');
return ['address_1', 'address_2', 'email'].includes(fieldName) ||
field.class?.includes('form-row-wide') || false;
};
if (loading) {
return (
<div className="flex items-center justify-center py-12">

View File

@@ -1,9 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Download, Loader2, FileText, ExternalLink } from 'lucide-react';
import { Download, Loader2, FileText } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { api } from '@/lib/api/client';
import { toast } from 'sonner';
import { formatPrice } from '@/lib/currency';
import SEOHead from '@/components/SEOHead';
interface DownloadItem {

View File

@@ -49,6 +49,7 @@ export default function OrderDetails() {
if (orderId) {
loadOrder();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [orderId]);
const loadOrder = async () => {

View File

@@ -22,6 +22,7 @@ export default function Orders() {
useEffect(() => {
loadOrders();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [page]);
const loadOrders = async () => {

View File

@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Heart, ShoppingCart, Trash2, X } from 'lucide-react';
import { api } from '@/lib/api/client';
import { useCartStore } from '@/lib/cart/store';
import { Button } from '@/components/ui/button';
import { formatPrice } from '@/lib/currency';
import { toast } from 'sonner';
@@ -26,15 +25,20 @@ interface WishlistItem {
export default function Wishlist() {
const navigate = useNavigate();
const { addItem } = useCartStore();
const [items, setItems] = useState<WishlistItem[]>([]);
const [loading, setLoading] = useState(true);
const { isEnabled, isLoading: modulesLoading } = useModules();
const { settings: wishlistSettings } = useModuleSettings('wishlist');
useEffect(() => {
if (isEnabled('wishlist')) {
loadWishlist();
}
}, [isEnabled]);
if (modulesLoading) {
return (
<div className="min-h-screen flex items-center justify-center">
<div className="flex items-center justify-center min-h-screen">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"></div>
</div>
);
@@ -57,10 +61,6 @@ export default function Wishlist() {
);
}
useEffect(() => {
loadWishlist();
}, []);
const loadWishlist = async () => {
try {
const data = await api.get<WishlistItem[]>('/account/wishlist');
@@ -91,7 +91,7 @@ export default function Wishlist() {
}
try {
const response = await api.post('/cart/add', {
await api.post('/cart/add', {
product_id: item.product_id,
quantity: 1,
});

View File

@@ -84,7 +84,7 @@ export function AccountLayout({ children }: AccountLayoutProps) {
// Full page reload to clear cookies and refresh state
const basePath = (window as any).woonoowCustomer?.basePath || '/store';
window.location.href = window.location.origin + basePath + '/';
} catch (error) {
} catch {
// Even on error, try to redirect and let server handle session
const basePath = (window as any).woonoowCustomer?.basePath || '/store';
window.location.href = window.location.origin + basePath + '/';
@@ -99,7 +99,7 @@ export function AccountLayout({ children }: AccountLayoutProps) {
};
// Logout Button with AlertDialog
const LogoutButton = () => (
const renderLogoutButton = () => (
<AlertDialog>
<AlertDialogTrigger asChild>
<button
@@ -131,7 +131,7 @@ export function AccountLayout({ children }: AccountLayoutProps) {
);
// Sidebar Navigation
const SidebarNav = () => (
const renderSidebarNav = () => (
<aside className="bg-white rounded-lg border p-4">
<div className="mb-6">
<div className="flex items-center gap-3 pb-4 border-b">
@@ -171,13 +171,13 @@ export function AccountLayout({ children }: AccountLayoutProps) {
);
})}
<LogoutButton />
{renderLogoutButton()}
</nav>
</aside>
);
// Tab Navigation (Mobile)
const TabNav = () => (
const renderTabNav = () => (
<div className="bg-white rounded-lg border mb-6 lg:hidden">
<nav className="flex overflow-x-auto">
{menuItems.map((item) => {
@@ -201,23 +201,21 @@ export function AccountLayout({ children }: AccountLayoutProps) {
);
// Responsive layout: Tabs on mobile, Sidebar on desktop
return (
<div className="py-8">
{/* Mobile: Tab Navigation */}
<TabNav />
<div className="py-8">
{/* Mobile: Tab Navigation */}
{renderTabNav()}
{/* Desktop: Sidebar + Content */}
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
<div className="hidden lg:block lg:col-span-1">
<SidebarNav />
</div>
<div className="lg:col-span-3">
<div className="bg-white rounded-lg border p-6">
{children}
</div>
{/* Desktop: Sidebar + Content */}
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
<div className="hidden lg:block lg:col-span-1">
{renderSidebarNav()}
</div>
<div className="lg:col-span-3">
<div className="bg-white rounded-lg border p-6">
{children}
</div>
</div>
</div>
);
</div>
}