import { clsx } from "@akanjs/client";
import { cnst, usePage } from "@myapp/client";
interface IcecreamOrderViewProps {
className?: string;
icecreamOrder: cnst.IcecreamOrder;
}
export const General = ({ className, icecreamOrder }: IcecreamOrderViewProps) => {
const { l } = usePage();
return (
<div className={clsx(className, "animate-fadeIn mx-auto w-full space-y-6 rounded-xl p-8 shadow-lg")}>
<div className="flex items-center gap-3 border-b pb-4">
<span className="text-3xl font-extrabold text-pink-600">🍦</span>
<span className="text-2xl font-bold">{l("icecreamOrder.modelName")}</span>
<span className="text-base-content/50 ml-auto text-xs">#{icecreamOrder.id}</span>
</div>
<div className="grid grid-cols-2 gap-x-6 gap-y-4">
<div className="text-base-content/50 font-semibold">{l.field("icecreamOrder", "size")}</div>
<div>{l.enum("icecreamOrder", "size", icecreamOrder.size.toString())}</div>
<div className="text-base-content/50 font-semibold">{l.field("icecreamOrder", "toppings")}</div>
<div className="flex flex-wrap gap-2">
{icecreamOrder.toppings.length === 0 ? (
<span className="text-gray-400 italic">X</span>
) : (
icecreamOrder.toppings.map((topping) => (
<span
key={topping}
className="inline-block rounded-full bg-pink-100 px-2 py-1 text-xs font-medium text-pink-700"
>
{l.enum("icecreamOrder", "toppings", topping)}
</span>
))
)}
</div>
<div className="text-base-content/50 font-semibold">{l.field("icecreamOrder", "status")}</div>
<div>
<span
className={clsx(
"inline-block rounded-full px-2 py-1 text-xs font-semibold",
icecreamOrder.status === "active"
? "bg-green-100 text-green-700"
: icecreamOrder.status === "processing"
? "bg-yellow-100 text-yellow-700"
: "bg-blue-100 text-blue-700"
)}
>
{l.enum("icecreamOrder", "status", icecreamOrder.status)}
</span>
</div>
<div className="text-base-content/50 font-semibold">{l.field("icecreamOrder", "createdAt")}</div>
<div className="text-gray-500">{icecreamOrder.createdAt.format("YYYY-MM-DD HH:mm:ss")}</div>
<div className="text-base-content/50 font-semibold">{l.field("icecreamOrder", "updatedAt")}</div>
<div className="text-gray-500">{icecreamOrder.updatedAt.format("YYYY-MM-DD HH:mm:ss")}</div>
</div>
</div>
);
};