From 0314855a0d12a81c931f1a3dd0c4df63599b3c13 Mon Sep 17 00:00:00 2001 From: Igor Propisnov Date: Tue, 30 Jul 2024 10:07:08 +0200 Subject: [PATCH] added partial first page of basic event setup step --- .../create-event/create-event.component.html | 70 ++++++++++---- .../create-event/create-event.component.ts | 67 ++++++------- .../steps/basic-step.component.html | 45 ++++++--- .../steps/basic-step.component.ts | 8 +- .../dropdown/dropdown.component.html | 95 +++++++++++++++++++ .../components/dropdown/dropdown.component.ts | 69 ++++++++++++++ frontend/src/app/shared/components/index.ts | 1 + 7 files changed, 287 insertions(+), 68 deletions(-) create mode 100644 frontend/src/app/shared/components/dropdown/dropdown.component.html create mode 100644 frontend/src/app/shared/components/dropdown/dropdown.component.ts create mode 100644 frontend/src/app/shared/components/index.ts diff --git a/frontend/src/app/pages/event-root/create-event/create-event.component.html b/frontend/src/app/pages/event-root/create-event/create-event.component.html index 0f9bd86..a8f3fc3 100644 --- a/frontend/src/app/pages/event-root/create-event/create-event.component.html +++ b/frontend/src/app/pages/event-root/create-event/create-event.component.html @@ -1,6 +1,25 @@
-
-
+
+
    + @for (step of steps; track $index) { +
  • + {{ step }} +
  • + } +
+
+ +
+
@if (currentStep() === 0) { @@ -10,23 +29,34 @@
- - -
    - @for (step of steps; track $index) { -
  • - {{ step }} -
  • - } -
+ class="w-full bg-neutral max-w-full sticky bottom-0 z-20 px-4 sm:px-8 py-4"> +
+ + +
diff --git a/frontend/src/app/pages/event-root/create-event/create-event.component.ts b/frontend/src/app/pages/event-root/create-event/create-event.component.ts index 307ba6b..11d69d5 100644 --- a/frontend/src/app/pages/event-root/create-event/create-event.component.ts +++ b/frontend/src/app/pages/event-root/create-event/create-event.component.ts @@ -4,15 +4,9 @@ import { ChangeDetectionStrategy, signal, WritableSignal, - ElementRef, OnInit, } from '@angular/core'; -import { - BackgroundPatternService, - ThemeService, -} from '../../../shared/service'; - import { BasicStepComponent } from './steps/basic-step.component'; @Component({ @@ -24,42 +18,51 @@ import { BasicStepComponent } from './steps/basic-step.component'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class CreateEventComponent implements OnInit { - public actionbar: { 'background-image': string } | null = null; public currentStep: WritableSignal = signal(0); public readonly steps: string[] = ['Basic', 'Tickets', 'Review']; - public constructor( - private readonly backgroundPatternService: BackgroundPatternService, - private readonly themeService: ThemeService, - private readonly el: ElementRef - ) {} + public constructor() {} - public ngOnInit(): void { - this.setBackground(); + public ngOnInit(): void {} + + public getStepContent(index: number): string { + if (index < this.currentStep()) { + return this.isStepValid(index) ? '✓' : '?'; + } else { + return (index + 1).toString(); + } } - public setBackground(): void { - const theme = this.themeService.getTheme(); - let opacity: number; - - if (theme === 'dark') { - opacity = 0.05; - } else { - opacity = 0.1; + public goToStep(stepIndex: number): void { + if (stepIndex < this.currentStep()) { + this.currentStep.set(stepIndex); + } else if (this.canAdvanceToStep(stepIndex)) { + this.currentStep.set(stepIndex); } + } - const colorPrimaryC = getComputedStyle( - this.el.nativeElement - ).getPropertyValue('--pc'); + public canAdvanceToStep(stepIndex: number): boolean { + for (let i = this.currentStep(); i < stepIndex; i++) { + if (!this.isStepValid(i)) { + return false; + } + } + return true; + } - const svgUrlActionbar = this.backgroundPatternService.getBankNotePattern( - colorPrimaryC, - opacity - ); + public isStepValid(stepIndex: number): boolean { + // TODO: Implementiere die tatsächliche Validierungslogik hier + // Für Demonstrationszwecke nehmen wir an, dass der erste Schritt immer gültig ist, + // und die anderen zufällig gültig oder ungültig sind + return true; - this.actionbar = { - 'background-image': `url("${svgUrlActionbar}")`, - }; + // In Zukunft könnte es so aussehen: + // switch(stepIndex) { + // case 0: return this.isBasicStepValid(); + // case 1: return this.isTicketsStepValid(); + // case 2: return this.isReviewStepValid(); + // default: return false; + // } } public nextStep(): void { diff --git a/frontend/src/app/pages/event-root/create-event/steps/basic-step.component.html b/frontend/src/app/pages/event-root/create-event/steps/basic-step.component.html index 335dad5..6813275 100644 --- a/frontend/src/app/pages/event-root/create-event/steps/basic-step.component.html +++ b/frontend/src/app/pages/event-root/create-event/steps/basic-step.component.html @@ -1,18 +1,33 @@
-

Event Basic Information

+

Event Basic Information

-
-