agent / frontend /components /step-shell.tsx
Echodelta06's picture
Update: correction demarrage
2226b44
Raw History Blame Contribute Delete
3.38 kB
"use client";
import Image from "next/image";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { useRouter } from "next/navigation";
import { AppStepper, type StepItem } from "@/components/app-stepper";
import { NavHint } from "@/components/nav-hint";
import { Button } from "@/components/ui/button";
import { useTranslation } from "@/lib/language-context";
import { cn } from "@/lib/utils";
type StepShellProps = {
steps: StepItem[];
currentStep: number;
previousHref?: string;
nextHref?: string;
showNavHint?: boolean;
children: React.ReactNode;
};
// Shell layout partage par toutes les etapes du tunnel.
export function StepShell({ steps, currentStep, previousHref, nextHref, showNavHint = true, children }: StepShellProps) {
const router = useRouter();
const { t } = useTranslation();
const currentLabel = steps.find((step) => step.id === currentStep)?.label ?? t("common.stepFallback");
return (
<main className="relative min-h-screen bg-background text-foreground">
<div className="mx-auto flex w-full max-w-7xl flex-col px-4 pb-10 pt-8 md:px-10">
{/* Barre haute commune: navigation etat par etape + actions prev/next */}
<header className="mb-8 flex items-center gap-4 border-b border-[#d4f3d71f] pb-5">
<div className="shrink-0">
<Button
variant="outline"
size="icon"
className={cn("h-10 w-10", !previousHref && "opacity-40")}
disabled={!previousHref}
onClick={() => {
if (previousHref) router.push(previousHref);
}}
>
<span>
<ChevronLeft className="h-4 w-4" />
</span>
</Button>
</div>
<div className="flex-1">
{/* Mobile/fenetres etroites: navigation compacte sans scroll horizontal. */}
<div className="flex items-center justify-center px-2 text-center md:hidden">
<span className="max-w-[220px] truncate text-sm font-semibold text-[#dcebe3]">{currentLabel}</span>
</div>
{/* Desktop: stepper complet par etapes. */}
<div className="hidden md:block">
<AppStepper steps={steps} currentStep={currentStep} />
</div>
</div>
<div className="shrink-0">
<Button
variant="outline"
size="icon"
className={cn("h-10 w-10", nextHref && "nav-next-pulse", !nextHref && "opacity-40")}
disabled={!nextHref}
onClick={() => {
if (nextHref) router.push(nextHref);
}}
>
<span>
<ChevronRight className="h-4 w-4" />
</span>
</Button>
</div>
</header>
{children}
{showNavHint ? <NavHint /> : null}
</div>
{/* Branding persistant en bas a gauche */}
<a
href="https://t4transaction.com/"
target="_blank"
rel="noreferrer"
className="fixed bottom-4 left-4 z-10"
>
<Image
src="/name_logo_t4grey.png"
alt="T4 transaction"
width={260}
height={45}
className="w-[170px] opacity-35 transition-opacity hover:opacity-60 md:w-[220px]"
/>
</a>
</main>
);
}