Add design reviews section to customer account page
Shows pending design approvals in customer account menu for easy access without needing email links, useful for testing without email service. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
87b269e57c
commit
6f07c38145
@@ -30,6 +30,12 @@ export default async function AccountPage() {
|
|||||||
include: { items: true },
|
include: { items: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const designReviews = await prisma.designApproval.findMany({
|
||||||
|
where: { customerEmail: customer.email, status: 'IN_REVIEW' },
|
||||||
|
include: { product: true },
|
||||||
|
orderBy: { createdAt: 'desc' },
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-3xl px-6 py-12">
|
<div className="mx-auto max-w-3xl px-6 py-12">
|
||||||
<div className="flex items-baseline justify-between gap-3">
|
<div className="flex items-baseline justify-between gap-3">
|
||||||
@@ -50,6 +56,34 @@ export default async function AccountPage() {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2 className="mt-10 font-display text-xl">Design reviews</h2>
|
||||||
|
{designReviews.length === 0 ? (
|
||||||
|
<p className="mt-3 text-sm text-muted">No designs awaiting review.</p>
|
||||||
|
) : (
|
||||||
|
<div className="mt-4 divide-y divide-line border-t border-line">
|
||||||
|
{designReviews.map((design) => (
|
||||||
|
<Link
|
||||||
|
key={design.id}
|
||||||
|
href={`/designs/${design.id}/review`}
|
||||||
|
className="flex items-center gap-4 py-4 hover:bg-surface"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={design.designPreviewUrl}
|
||||||
|
alt="design preview"
|
||||||
|
className="h-14 w-14 border border-line object-cover"
|
||||||
|
/>
|
||||||
|
<div className="flex-1">
|
||||||
|
<p className="font-medium">{design.product.name}</p>
|
||||||
|
<p className="text-sm text-muted">
|
||||||
|
{new Date(design.createdAt).toLocaleDateString(undefined, { dateStyle: 'medium' })}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<span className="text-sm text-clay">Review →</span>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<h2 className="mt-10 font-display text-xl">Order history</h2>
|
<h2 className="mt-10 font-display text-xl">Order history</h2>
|
||||||
{orders.length === 0 ? (
|
{orders.length === 0 ? (
|
||||||
<p className="mt-3 text-sm text-muted">No orders yet.</p>
|
<p className="mt-3 text-sm text-muted">No orders yet.</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user