import type { ReactNode } from "react";
import { Footer } from "../../components/Footer";
import { AccountNav } from "./AccountNav";

// Shared shell for every logged-in /konto/* page (bestellungen, merkliste,
// profil) — the <main>/<Footer> wrapping plus the persistent AccountNav
// were previously duplicated per page, with the equivalent of the nav
// buried as plain links at the bottom of the orders page's own content
// (unreachable once the order list got long enough to push it below the
// fold). Each page keeps its own auth-check/redirect and data-fetching
// exactly as before — this only replaces the outer chrome, not the
// page-specific logic each page still needs (e.g. merkliste's return-URL
// login redirect, profil's second profile-fetch redirect).
//
// "Eingeloggt als …" is NOT rendered here (even though `customer` used to
// be the only prop this shell needed) — it belongs directly under each
// page's own title so it reads as "page title, then who's logged in", not
// above the title before the page has even introduced itself. See
// AccountIdentity.tsx, rendered by each page right after its own heading.
export async function KontoShell({ children }: { children: ReactNode }) {
  return (
    <>
      <main className="flex flex-col flex-1 bg-bg-base">
        <div className="flex flex-col sm:flex-row gap-6 sm:gap-10 w-full max-w-[75rem] mx-auto px-[var(--layout-padding-x)] pt-8 sm:pt-10 pb-16">
          <AccountNav />
          <div className="flex-1 min-w-0 flex flex-col gap-6">{children}</div>
        </div>
      </main>
      <Footer />
    </>
  );
}
