Refactor UI imports and update component paths
Some checks failed
Build Frontend / build (push) Failing after 7s

Replaces imports from 'components/ui' with 'components/common' across the app and dashboard pages, and updates model and API imports to use new paths under 'lib'. Removes redundant authentication checks from several dashboard pages. Adds new dashboard components and utility files, and reorganizes hooks and services into the 'lib' directory for improved structure.
This commit is contained in:
g
2026-01-13 05:02:13 +00:00
parent a6e6cd0757
commit fe01f31538
173 changed files with 1512 additions and 867 deletions

View File

@@ -1,12 +1,12 @@
"use client";
import { useState, useRef, lazy, Suspense } from "react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Button } from "@/components/common/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/common/dialog";
import { Send, Bold, Italic, Code, Link as LinkIcon, Image as ImageIcon, X, Eye, EyeOff, Package } from "lucide-react";
import { toast } from "sonner";
import { clientFetch } from "@/lib/api";
import { Textarea } from "@/components/ui/textarea";
import { Textarea } from "@/components/common/textarea";
import Image from "next/image";
import ProductSelector from "./product-selector";
@@ -108,7 +108,7 @@ export default function BroadcastDialog({ open, setOpen }: BroadcastDialogProps)
?.split("=")[1];
if (!authToken) {
document.location.href = "/login";
document.location.href = "/auth/login";
throw new Error("No authentication token found");
}
@@ -365,4 +365,5 @@ __italic text__
</DialogContent>
</Dialog>
);
}
}

View File

@@ -1,6 +1,6 @@
import { Dialog, DialogContent } from "@/components/ui/dialog";
import { Dialog, DialogContent } from "@/components/common/dialog";
import { ChevronLeft, ChevronRight, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Button } from "@/components/common/button";
import { useEffect } from "react";
interface ImageViewerModalProps {
@@ -96,4 +96,4 @@ export function ImageViewerModal({ isOpen, onClose, imageUrl, onNavigate }: Imag
</DialogContent>
</Dialog>
);
}
}

View File

@@ -1,11 +1,11 @@
"use client";
import { useState } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/common/dialog";
import { Button } from "@/components/common/button";
import { Upload, AlertCircle } from "lucide-react";
import { toast } from "sonner";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Alert, AlertDescription } from "@/components/common/alert";
interface ImportProductsModalProps {
open: boolean;
@@ -193,4 +193,4 @@ export default function ImportProductsModal({ open, setOpen, onImportComplete }:
</DialogContent>
</Dialog>
);
}
}

View File

@@ -1,10 +1,10 @@
"use client";
import { useState, useEffect } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/common/dialog";
import { Button } from "@/components/common/button";
import { Input } from "@/components/common/input";
import { Textarea } from "@/components/common/textarea";
import {
Select,
SelectContent,
@@ -13,7 +13,7 @@ import {
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
} from "@/components/common/select";
import { ImageUpload } from "@/components/forms/image-upload";
import { PricingTiers } from "@/components/forms/pricing-tiers";
import type { ProductModalProps, ProductData } from "@/lib/types";
@@ -21,8 +21,8 @@ import { toast } from "sonner";
import type React from "react";
import { Plus } from "lucide-react";
import { apiRequest } from "@/lib/api";
import { Switch } from "@/components/ui/switch";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/common/switch";
import { Badge } from "@/components/common/badge";
type CategorySelectProps = {
categories: { _id: string; name: string; parentId?: string }[];
@@ -485,4 +485,5 @@ const UnitTypeSelect: React.FC<{
</Button>
</div>
</div>
);
);

View File

@@ -1,10 +1,10 @@
"use client";
import { useState, useEffect } from "react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Checkbox } from "@/components/ui/checkbox";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/common/button";
import { Input } from "@/components/common/input";
import { Checkbox } from "@/components/common/checkbox";
import { ScrollArea } from "@/components/common/scroll-area";
import { Search, Package } from "lucide-react";
import { apiRequest } from "@/lib/api";
@@ -127,4 +127,5 @@ export default function ProductSelector({ selectedProducts, onSelectionChange }:
)}
</div>
);
}
}

View File

@@ -1,10 +1,10 @@
"use client";
import { useState, useEffect } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/common/dialog";
import { Button } from "@/components/common/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/common/card";
import { Badge } from "@/components/common/badge";
import { TrendingUp, TrendingDown, Calculator, DollarSign, Loader2, Info } from "lucide-react";
import { toast } from "sonner";
import { apiRequest } from "@/lib/api";
@@ -336,3 +336,5 @@ export const ProfitAnalysisModal: React.FC<ProfitAnalysisModalProps> = ({
</Dialog>
);
};

View File

@@ -1,9 +1,9 @@
"use client";
import { ChangeEvent, FormEvent } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/common/dialog";
import { Button } from "@/components/common/button";
import { Input } from "@/components/common/input";
import { ShippingData } from "@/lib/types";
interface ShippingModalProps {
@@ -80,3 +80,4 @@ export const ShippingModal = ({
</Dialog>
);
};