feat(wizard): move progress stepper to left sidebar

This commit is contained in:
DanielS
2026-08-11 17:26:49 +02:00
parent 7346b42ff3
commit 1478c61ea8
4 changed files with 164 additions and 169 deletions

View File

@@ -844,138 +844,110 @@ export function OrderWizard({
} }
return ( return (
<div className={`mx-auto px-4 ${step === 3 ? 'max-w-screen-2xl' : 'max-w-5xl'}`}> <div className="max-w-7xl mx-auto px-4 py-6">
{/* Dynamic Header */} <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
{step !== 3 && ( {/* Left Side Status Stepper for ALL steps */}
<div className="text-center mb-12"> <div className="lg:col-span-3 bg-slate-900/50 backdrop-blur-md border border-white/10 rounded-2xl p-6 space-y-6 sticky top-6">
<h1 className="text-5xl font-extrabold tracking-tight mb-4 text-gradient"> <div>
Konfigurieren Sie Ihre Lösung <h2 className="text-xs font-bold uppercase tracking-wider text-slate-400 mb-1">
</h1> Fortschritt
<p className="text-slate-400 text-lg max-w-2xl mx-auto"> </h2>
Wählen Sie das passende Paket und die benötigten Module für Ihr Business. <p className="text-lg font-extrabold text-white">
</p> Bestell-Wizard
</p>
</div>
<ProgressStepper step={step} basketItemsCount={basketItems.length} orientation="vertical" />
</div> </div>
)}
{/* Global Stepper for Steps 1, 2, 4 */} {/* Right Main Content Column */}
{step !== 3 && ( <div className="lg:col-span-9 space-y-6">
<div className="pt-12 pb-6"> {/* Dynamic Header */}
<ProgressStepper step={step} basketItemsCount={basketItems.length} /> {step !== 3 && (
</div> <div className="mb-8">
)} <h1 className="text-4xl font-extrabold tracking-tight mb-2 text-gradient">
Konfigurieren Sie Ihre Lösung
</h1>
<p className="text-slate-400 text-base">
Wählen Sie das passende Paket und die benötigten Module für Ihr Business.
</p>
</div>
)}
<AnimatePresence mode="wait"> <AnimatePresence mode="wait">
{/* Step 1: Customer */} {/* Step 1: Customer */}
{step === 1 && ( {step === 1 && (
<motion.div <motion.div
key="step1" key="step1"
initial={{ opacity: 0, x: 20 }} initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }} animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -20 }} exit={{ opacity: 0, x: -20 }}
className="space-y-6" className="space-y-6"
> >
<StepCustomer <StepCustomer
isAdmin={isAdmin} isAdmin={isAdmin}
companies={companies} companies={companies}
selectedCompanyId={selectedCompanyId} selectedCompanyId={selectedCompanyId}
setSelectedCompanyId={setSelectedCompanyId} setSelectedCompanyId={setSelectedCompanyId}
customerMode={customerMode} customerMode={customerMode}
setCustomerMode={setCustomerMode} setCustomerMode={setCustomerMode}
endCustomers={endCustomers} endCustomers={endCustomers}
searchTerm={searchTerm} searchTerm={searchTerm}
setSearchTerm={setSearchTerm} setSearchTerm={setSearchTerm}
filteredEndCustomers={filteredEndCustomers} filteredEndCustomers={filteredEndCustomers}
selectedEndCustomerId={selectedEndCustomerId} selectedEndCustomerId={selectedEndCustomerId}
setSelectedEndCustomerId={setSelectedEndCustomerId} setSelectedEndCustomerId={setSelectedEndCustomerId}
newCustomerForm={newCustomerForm} newCustomerForm={newCustomerForm}
setNewCustomerForm={setNewCustomerForm} setNewCustomerForm={setNewCustomerForm}
handleCreateCustomer={handleCreateCustomer} handleCreateCustomer={handleCreateCustomer}
isCreatingCustomer={isCreatingCustomer} isCreatingCustomer={isCreatingCustomer}
nextStep={nextStep} nextStep={nextStep}
/> />
</motion.div> </motion.div>
)} )}
{/* Step 2: Billing Model */} {/* Step 2: Billing Model */}
{step === 2 && ( {step === 2 && (
<motion.div <motion.div
key="step2" key="step2"
initial={{ opacity: 0, x: 20 }} initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }} animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -20 }} exit={{ opacity: 0, x: -20 }}
className="space-y-6" className="space-y-6"
> >
<StepBilling <StepBilling
selectedBillingInterval={selectedBillingInterval} selectedBillingInterval={selectedBillingInterval}
handleBillingIntervalChange={handleBillingIntervalChange} handleBillingIntervalChange={handleBillingIntervalChange}
customerMode={customerMode} customerMode={customerMode}
selectedEndCustomerId={selectedEndCustomerId} selectedEndCustomerId={selectedEndCustomerId}
lastLicenseDate={lastLicenseDate} lastLicenseDate={lastLicenseDate}
setLastLicenseDate={setLastLicenseDate} setLastLicenseDate={setLastLicenseDate}
prevStep={prevStep} prevStep={prevStep}
nextStep={nextStep} nextStep={nextStep}
/> />
</motion.div> </motion.div>
)} )}
{/* Step 3: Software Selector */}
{step === 3 && ( {step === 3 && (
<motion.div <motion.div
key="step3" key="step3"
initial={{ opacity: 0, x: 20 }} initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }} animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -20 }} exit={{ opacity: 0, x: -20 }}
className="h-[calc(100vh-140px)] overflow-hidden" className="h-[calc(100vh-100px)] overflow-hidden"
> >
<div className="grid grid-cols-1 lg:grid-cols-6 gap-6 h-full items-stretch"> <div className="grid grid-cols-1 lg:grid-cols-6 gap-6 h-full items-stretch">
{/* LEFT: Categories Sidebar Menu */} {/* LEFT inside step 3: Categories Sidebar Menu */}
<div className="lg:col-span-2 flex flex-col justify-start pr-4 space-y-6"> <div className="lg:col-span-2 flex flex-col justify-start pr-4 space-y-4 overflow-y-auto">
<div> <div>
<h1 className="text-3xl font-extrabold tracking-tight mb-2 text-gradient"> <h1 className="text-xl font-extrabold tracking-tight mb-1 text-gradient">
Konfigurieren Sie Ihre Lösung Kategorien & Optionen
</h1> </h1>
<p className="text-slate-400 text-sm"> <p className="text-slate-400 text-xs">
Wählen Sie das passende Paket und die benötigten Module für Ihr Business. Wählen Sie das passende Paket und die benötigten Module für Ihr Business.
</p> </p>
</div> </div>
{/* Left Sidebar Status Stepper (matching ProgressStepper sky-blue design) */} <div className="flex flex-col gap-2">
<div className="space-y-2 py-4 border-t border-b border-white/5">
<p className="text-xs font-bold uppercase tracking-wider text-slate-500">
Status
</p>
<div className="flex flex-row flex-wrap items-center gap-x-3 gap-y-2 pl-1">
<div className="flex items-center gap-1.5">
<div className="w-6 h-6 rounded-full bg-sky-500 border-2 border-sky-400 flex items-center justify-center shadow-[0_0_10px_rgba(56,189,248,0.4)]">
<Check className="w-3.5 h-3.5 text-slate-950 stroke-[3]" />
</div>
<span className="text-xs text-sky-300 font-semibold">Kunde</span>
</div>
<div className="w-6 h-[2px] bg-gradient-to-r from-sky-500 to-sky-400 rounded-full shadow-[0_0_6px_rgba(56,189,248,0.5)]" />
<div className="flex items-center gap-1.5">
<div className="w-6 h-6 rounded-full bg-sky-500 border-2 border-sky-400 flex items-center justify-center shadow-[0_0_10px_rgba(56,189,248,0.4)]">
<Check className="w-3.5 h-3.5 text-slate-950 stroke-[3]" />
</div>
<span className="text-xs text-sky-300 font-semibold">Modell</span>
</div>
<div className="w-6 h-[2px] bg-gradient-to-r from-sky-500 to-sky-400 rounded-full shadow-[0_0_6px_rgba(56,189,248,0.5)]" />
<div className="flex items-center gap-1.5">
<div className="w-6 h-6 rounded-full bg-slate-950 border-2 border-sky-400 text-sky-400 flex items-center justify-center text-xs font-bold shadow-[0_0_15px_rgba(56,189,248,0.5)]">
3
</div>
<span className="text-xs text-sky-300 font-bold">Software</span>
</div>
<div className="w-6 h-[2px] bg-slate-800 rounded-full" />
<div className="flex items-center gap-1.5">
<div className="w-6 h-6 rounded-full bg-slate-900 border-2 border-slate-800 text-slate-500 flex items-center justify-center text-xs">
4
</div>
<span className="text-xs text-slate-500 font-medium">Abschluss</span>
</div>
</div>
</div>
<div className="flex flex-col gap-2">
{visibleCategories.map((cat) => { {visibleCategories.map((cat) => {
const sel = selections[cat.id] const sel = selections[cat.id]
const hasSelection = (sel?.productIds && sel.productIds.length > 0) || !!sel?.productId const hasSelection = (sel?.productIds && sel.productIds.length > 0) || !!sel?.productId
@@ -1059,9 +1031,8 @@ export function OrderWizard({
</div> </div>
</div> </div>
{/* RIGHT: Stepper Header + Summary sidebar */} {/* RIGHT: Summary sidebar */}
<div className="lg:col-span-2 flex flex-col h-full overflow-hidden pl-4"> <div className="lg:col-span-2 flex flex-col h-full overflow-hidden pl-2">
<div className="flex-1 overflow-hidden"> <div className="flex-1 overflow-hidden">
<SummarySidebar <SummarySidebar
visibleCategories={visibleCategories} visibleCategories={visibleCategories}
@@ -1143,6 +1114,8 @@ export function OrderWizard({
{/* Toast Notification Container */} {/* Toast Notification Container */}
<ToastNotification toast={toast} onClose={() => setToast(null)} /> <ToastNotification toast={toast} onClose={() => setToast(null)} />
</div>
</div>
</div> </div>
) )
} }

View File

@@ -7,14 +7,70 @@ import { Check } from 'lucide-react'
interface ProgressStepperProps { interface ProgressStepperProps {
step: number step: number
basketItemsCount: number basketItemsCount: number
orientation?: 'horizontal' | 'vertical'
} }
const STEP_LABELS = ['Kunde', 'Modell', 'Software', 'Abschluss'] const STEP_LABELS = ['Kunde', 'Modell', 'Software', 'Abschluss']
export function ProgressStepper({ step, basketItemsCount }: ProgressStepperProps) { export function ProgressStepper({ step, basketItemsCount, orientation = 'horizontal' }: ProgressStepperProps) {
// Calculate progress percentage for active line (Step 1: 0%, Step 2: 33.3%, Step 3: 66.6%, Step 4: 100%)
const progressPercent = ((step - 1) / 3) * 100 const progressPercent = ((step - 1) / 3) * 100
if (orientation === 'vertical') {
return (
<div className="flex flex-col gap-6 relative py-2 pl-2">
{/* Background Line */}
<div className="absolute left-[20px] top-[20px] bottom-[20px] w-[2px] bg-slate-800 z-0 rounded-full" />
{/* Animated Active Line */}
<motion.div
className="absolute left-[20px] top-[20px] w-[2px] bg-gradient-to-b from-blue-600 via-sky-400 to-cyan-400 z-0 rounded-full shadow-[0_0_12px_rgba(56,189,248,0.8)]"
initial={{ height: '0%' }}
animate={{ height: `${progressPercent}%` }}
transition={{ duration: 0.5, ease: [0.25, 0.1, 0.25, 1] }}
/>
{[1, 2, 3, 4].map(s => {
const isDone = step > s
const isActive = step === s
return (
<div key={s} className="relative z-10 flex items-center gap-3">
<motion.div
initial={false}
animate={{
scale: isActive ? 1.1 : 1,
}}
transition={{ type: 'spring', stiffness: 300, damping: 20 }}
className={`w-9 h-9 rounded-full flex items-center justify-center font-bold text-xs shrink-0 transition-all duration-300 ${
isDone
? 'bg-sky-500 text-slate-950 shadow-[0_0_15px_rgba(56,189,248,0.6)] border-2 border-sky-400'
: isActive
? 'bg-slate-950 border-2 border-sky-400 text-sky-400 shadow-[0_0_20px_rgba(56,189,248,0.7)]'
: 'bg-slate-900 border-2 border-slate-800 text-slate-500'
}`}
>
{isDone ? <Check className="w-4 h-4 stroke-[3]" /> : s}
</motion.div>
<span
className={`text-xs font-semibold tracking-wide transition-colors duration-300 flex items-center gap-1.5 ${
isActive || isDone ? 'text-sky-300' : 'text-slate-500'
}`}
>
{STEP_LABELS[s - 1]}
{s === 3 && basketItemsCount > 0 && (
<span className="bg-sky-500 text-slate-950 text-[10px] w-4 h-4 rounded-full flex items-center justify-center font-extrabold shadow-sm">
{basketItemsCount}
</span>
)}
</span>
</div>
)
})}
</div>
)
}
return ( return (
<div className="max-w-xl mx-auto mb-10 px-4"> <div className="max-w-xl mx-auto mb-10 px-4">
<div className="flex justify-between relative"> <div className="flex justify-between relative">

View File

@@ -70,7 +70,7 @@ export function StepSummary({
<div className="lg:col-span-5 flex flex-col h-full overflow-hidden pr-4 space-y-6"> <div className="lg:col-span-5 flex flex-col h-full overflow-hidden pr-4 space-y-6">
<div className="flex-1 overflow-y-auto pr-1 space-y-6 pb-4 subpixel-antialiased scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent"> <div className="flex-1 overflow-y-auto pr-1 space-y-6 pb-4 subpixel-antialiased scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent">
{/* Header & Status Stepper */} {/* Header */}
<div className="space-y-4"> <div className="space-y-4">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-12 h-12 bg-primary/20 rounded-xl flex items-center justify-center border border-primary/50 shrink-0"> <div className="w-12 h-12 bg-primary/20 rounded-xl flex items-center justify-center border border-primary/50 shrink-0">
@@ -85,39 +85,6 @@ export function StepSummary({
</p> </p>
</div> </div>
</div> </div>
{/* Vertikaler Status-Stepper */}
<div className="space-y-4 py-4 border-t border-b border-white/5">
<p className="text-[10px] font-bold uppercase tracking-wider text-slate-500">
Schritt 4 von 4 Zusammenfassung & Abschluss
</p>
<div className="flex flex-col gap-3 pl-1">
<div className="flex items-center gap-3">
<div className="w-6 h-6 rounded-full bg-green-500/20 border border-green-500/35 flex items-center justify-center text-green-400 text-xs">
<Icons.Check className="w-3.5 h-3.5" />
</div>
<span className="text-sm text-slate-400 font-medium">Kunde</span>
</div>
<div className="flex items-center gap-3">
<div className="w-6 h-6 rounded-full bg-green-500/20 border border-green-500/35 flex items-center justify-center text-green-400 text-xs">
<Icons.Check className="w-3.5 h-3.5" />
</div>
<span className="text-sm text-slate-400 font-medium">Modell</span>
</div>
<div className="flex items-center gap-3">
<div className="w-6 h-6 rounded-full bg-green-500/20 border border-green-500/35 flex items-center justify-center text-green-400 text-xs">
<Icons.Check className="w-3.5 h-3.5" />
</div>
<span className="text-sm text-slate-400 font-medium">Software</span>
</div>
<div className="flex items-center gap-3">
<div className="w-6 h-6 rounded-full bg-primary/20 border border-primary text-primary flex items-center justify-center text-xs font-bold shadow-[0_0_10px_rgba(59,130,246,0.2)]">
4
</div>
<span className="text-sm text-white font-bold">Abschluss</span>
</div>
</div>
</div>
</div> </div>
{/* Kunden-Info Card */} {/* Kunden-Info Card */}

View File

@@ -253,14 +253,14 @@ export function SummarySidebar({
{/* Kassen-Liste unten (selectable) */} {/* Kassen-Liste unten (selectable) */}
{basketItems.length > 0 && ( {basketItems.length > 0 && (
<div className="shrink-0 pt-3 border-t border-white/10 space-y-2"> <div className="shrink-0 pt-3 pb-2 mb-4 border-t border-white/10 space-y-3">
<p className="text-xs font-semibold text-slate-500 uppercase tracking-wider">Kassen ({basketItems.length}):</p> <p className="text-xs font-semibold text-slate-500 uppercase tracking-wider">Kassen ({basketItems.length}):</p>
<div className="flex flex-wrap gap-1.5 max-h-28 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent"> <div className="flex flex-wrap gap-2 max-h-36 overflow-y-auto pr-1 pb-1 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent">
{basketItems.map((item, idx) => ( {basketItems.map((item, idx) => (
<button <button
key={idx} key={idx}
onClick={() => setSelectedBasketIdx(selectedBasketIdx === idx ? null : idx)} onClick={() => setSelectedBasketIdx(selectedBasketIdx === idx ? null : idx)}
className={`flex items-center gap-2 text-xs px-3 py-2 rounded-lg border transition-all duration-200 text-left group ${ className={`flex items-center gap-2 text-xs px-3 py-2.5 rounded-lg border transition-all duration-200 text-left group ${
selectedBasketIdx === idx selectedBasketIdx === idx
? 'bg-sky-500/15 border-sky-500/40 text-white shadow-[0_0_10px_rgba(56,189,248,0.15)]' ? 'bg-sky-500/15 border-sky-500/40 text-white shadow-[0_0_10px_rgba(56,189,248,0.15)]'
: idx === editingIdx : idx === editingIdx
@@ -278,7 +278,7 @@ export function SummarySidebar({
{/* Selected basket item actions */} {/* Selected basket item actions */}
{selectedBasketIdx !== null && basketItems[selectedBasketIdx] && ( {selectedBasketIdx !== null && basketItems[selectedBasketIdx] && (
<div className="flex items-center gap-2 pt-1"> <div className="flex items-center gap-2 pt-2 border-t border-white/5">
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<p className="text-xs text-white font-medium truncate">{basketItems[selectedBasketIdx].deviceName}</p> <p className="text-xs text-white font-medium truncate">{basketItems[selectedBasketIdx].deviceName}</p>
<p className="text-[10px] text-slate-500 capitalize"> <p className="text-[10px] text-slate-500 capitalize">
@@ -314,25 +314,24 @@ export function SummarySidebar({
</div> </div>
)} )}
</CardContent> </CardContent>
<CardFooter className="flex flex-col gap-3 shrink-0"> <CardFooter className="flex flex-col gap-2 shrink-0 p-4 pt-0">
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="w-full border-sky-500/30 text-white hover:bg-sky-500/10 gap-2 h-10 text-sm" className="w-full border-sky-500/40 bg-sky-500/10 text-sky-200 hover:bg-sky-500/20 hover:text-white gap-2 h-9 text-xs font-semibold shadow-sm"
onClick={() => setIsOpen(true)} onClick={() => setIsOpen(true)}
disabled={isNextStepDisabled} disabled={!hasActiveSelection && isNextStepDisabled}
> >
<UserPlus className="w-4 h-4" /> {editingIdx !== null ? '💾 Kasse bearbeiten' : (hasActiveSelection ? 'Kasse speichern' : 'Kasse anlegen')} <UserPlus className="w-3.5 h-3.5" /> {editingIdx !== null ? '💾 Kasse bearbeiten' : (hasActiveSelection ? 'Kasse speichern' : '+ Kasse anlegen')}
</Button> </Button>
<Separator className="bg-white/10 my-1" />
<Button <Button
className="w-full h-12 text-lg" className="w-full h-10 text-sm font-bold bg-gradient-to-r from-blue-600 to-sky-500 hover:from-blue-500 hover:to-sky-400"
onClick={nextStep} onClick={nextStep}
disabled={basketItems.length === 0 && isNextStepDisabled} disabled={basketItems.length === 0 && isNextStepDisabled}
> >
Weiter <ChevronRight className="ml-2 w-5 h-5" /> Weiter <ChevronRight className="ml-1 w-4 h-4" />
</Button> </Button>
<Button variant="ghost" className="w-full text-white" onClick={prevStep}> <Button variant="ghost" className="w-full text-slate-400 hover:text-white h-8 text-xs" onClick={prevStep}>
Zurück zum Abrechnungsmodell Zurück zum Abrechnungsmodell
</Button> </Button>
</CardFooter> </CardFooter>