"use client"; import React, { type FC } from "react"; import { useClientOrders } from "@/hooks/useClientOrders"; import { fmtDate, fmtAmount } from "@/lib/formatters"; import { statusColor, statusLabel } from "@/lib/order-status"; import { clearSession, type ClientSession } from "@/lib/session"; import type { OrderStatus } from "@/types/client"; import { Spinner } from "../../Components/UI"; // ─── Order status tracker ───────────────────── const STATUS_STEPS: OrderStatus[] = ["CREATED", "IN_TRANSIT", "DELIVERED"]; const STEP_LABELS = ["تم الإنشاء", "قيد التوصيل", "تم التسليم"]; const StepIcon: FC<{ step: number }> = ({ step }) => { if (step === 0) return ( ); if (step === 1) return ( ); return ( ); }; const OrderTracker: FC<{ status: OrderStatus }> = ({ status }) => { const idx = STATUS_STEPS.indexOf(status === "CANCELLED" ? "CREATED" : status); return (
مرحبًا بعودتك، {session.name}
جارٍ تحميل الطلبات…
{error}
{s.label}
{s.value}
الطلب الحالي
{activeOrder.id}
لا يوجد طلب نشط حاليًا.
سجل الطلبات
{pastOrders.length} طلبات| {h} | ))}||||
|---|---|---|---|---|
| {order.id} | {fmtDate(order.createdAt)} | {order.description} | {statusLabel(order.status)} | {fmtAmount(order.totalAmount)} |