Template
Every page was importing Header and Footer and repeating the same store name, logo, copyright and nav links. Hoisting both into the root layout renders them once, and a new config/site.ts holds the values they shared. The body becomes a flex column so the footer sits at the bottom of short pages. not-found and error now render inside that chrome, so their full-viewport centering drops to 60vh. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D1vsTA4MX6qFd7nqSAKtdV
31 lines
973 B
TypeScript
31 lines
973 B
TypeScript
import { redirect } from 'next/navigation';
|
|
import OrderHistory from '@/components/shopify/order-history';
|
|
import { getSessionToken } from '@/services/shopify/session';
|
|
import { getCustomer } from '@/services/shopify/customer';
|
|
|
|
export const metadata = { title: 'Order history — Shop' };
|
|
|
|
export default async function Page() {
|
|
const token = await getSessionToken();
|
|
if (!token) redirect('/account/login');
|
|
|
|
const customer = await getCustomer(token, 20);
|
|
// An expired or revoked token reads as signed out.
|
|
if (!customer) redirect('/account/login');
|
|
|
|
return (
|
|
<main className="max-w-screen-2xl mx-auto w-full px-8 py-12">
|
|
<h1 className="text-2xl md:text-3xl font-normal text-foreground">
|
|
Order history
|
|
</h1>
|
|
<p className="mt-1 text-sm text-muted-foreground">
|
|
{customer.displayName} · {customer.email}
|
|
</p>
|
|
|
|
<div className="mt-10">
|
|
<OrderHistory customer={customer} />
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|