added empty pages

This commit is contained in:
Jelaletdin12
2025-12-15 17:55:34 +05:00
parent e886359c5c
commit 6d0064b106
22 changed files with 531 additions and 296 deletions

View File

@@ -1,32 +1,30 @@
import { Package } from "lucide-react"
import { Button } from "@/components/ui/button"
import Link from "next/link"
import { Button } from "@/components/ui/button";
import { ShoppingCart } from "lucide-react";
import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation";
interface EmptyOrdersProps {
locale?: string
message?: string
actionText?: string
actionHref?: string
}
export default function EmptyOrders({
locale = "ru",
message = "No orders yet",
actionText = "Start Shopping",
actionHref = "/",
}: EmptyOrdersProps) {
export default function EmptyOrders() {
const t=useTranslations();
const router=useRouter();
return (
<div className="min-h-[400px] flex flex-col items-center justify-center p-4">
<Package className="h-16 w-16 text-gray-300 mb-4" />
<h2 className="text-2xl font-semibold text-gray-600 mb-2">{message}</h2>
<p className="text-gray-500 mb-6 text-center max-w-sm">
{locale === "ru"
? "У вас еще нет заказов. Начните покупки прямо сейчас!"
: "You haven't placed any orders yet. Start shopping now!"}
</p>
<Link href={actionHref}>
<Button className="rounded-xl">{actionText}</Button>
</Link>
<div className="flex min-h-[60vh] items-center justify-center px-4">
<div className="w-full max-w-md rounded-2xl bg-gradient-to-br from-blue-50 to-white p-8 text-center shadow-lg">
<div className="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-blue-100">
<ShoppingCart className="h-10 w-10 text-blue-600" />
</div>
<h2 className="mb-2 text-2xl font-semibold text-gray-900">
{t("orders_empty")}
</h2>
<p className="mb-6 text-sm text-gray-500">
{t("orders_empty_message")}
</p>
<Button onClick={()=>router.push("/")} className="w-full rounded-xl bg-blue-600 px-6 py-3 text-sm font-medium text-white transition hover:bg-blue-700 active:scale-95">
{t("start_shopping")}
</Button>
</div>
</div>
)
}
);
}

View File

@@ -28,7 +28,7 @@ import { useToast } from "@/hooks/use-toast";
import { useOrders, useCancelOrder } from "@/lib/hooks";
import { useTranslations } from "next-intl";
import type { Order } from "@/lib/types/api";
import EmptyOrders from "./EmptyOrders";
interface OrdersPageClientProps {
locale: string;
}
@@ -181,12 +181,7 @@ export default function OrdersPageClient({ locale }: OrdersPageClientProps) {
if (isError || !orders || orders.length === 0) {
return (
<div className="container mx-auto p-4 min-h-screen">
<h1 className="text-3xl font-bold mb-6">{t("my_orders")}</h1>
<div className="flex items-center justify-center min-h-[60vh]">
<p className="text-2xl text-gray-400">{t("no_orders")}</p>
</div>
</div>
<EmptyOrders/>
);
}