From b84ee987d33eed32a077b5371605b81be1dc1e6d Mon Sep 17 00:00:00 2001
From: Daniel Jancar <112062588+danieljancar@users.noreply.github.com>
Date: Sun, 11 Aug 2024 12:39:21 +0200
Subject: [PATCH] feat: create results page (#47)
* feat: create results page
* fix: change option description to new max lenght
* feat: add cast vote banner to results if user hasn't voted yet
---
apps/frontend/src/app/app.routes.ts | 2 +-
.../features/voting/cast/cast.component.ts | 2 +-
.../voting/create/create.component.html | 10 +-
.../voting/create/create.component.ts | 2 +-
.../voting/results/results.component.html | 152 +++++++++++++----
.../voting/results/results.component.ts | 153 +++++++++++++++++-
.../voting/thanks/thanks.component.css | 6 -
.../voting/thanks/thanks.component.html | 48 +-----
.../voting/thanks/thanks.component.ts | 9 +-
.../app/features/voting/voting.component.html | 2 +-
.../app/features/voting/voting.component.ts | 18 ---
11 files changed, 292 insertions(+), 112 deletions(-)
diff --git a/apps/frontend/src/app/app.routes.ts b/apps/frontend/src/app/app.routes.ts
index cdb52f6..9923396 100644
--- a/apps/frontend/src/app/app.routes.ts
+++ b/apps/frontend/src/app/app.routes.ts
@@ -44,7 +44,7 @@ export const appRoutes: Route[] = [
canDeactivate: [UnsavedChangesGuard],
},
{
- path: 'results/:id',
+ path: 'r/:id',
component: ResultsComponent,
},
{
diff --git a/apps/frontend/src/app/features/voting/cast/cast.component.ts b/apps/frontend/src/app/features/voting/cast/cast.component.ts
index 4a0aacc..f26f0a7 100644
--- a/apps/frontend/src/app/features/voting/cast/cast.component.ts
+++ b/apps/frontend/src/app/features/voting/cast/cast.component.ts
@@ -107,7 +107,7 @@ export class CastComponent implements OnChanges {
return
}
}
- this.router.navigate(['/voting/results', this.voteId])
+ this.router.navigate(['/voting/r', this.voteId])
}
public errorAction(): void {
diff --git a/apps/frontend/src/app/features/voting/create/create.component.html b/apps/frontend/src/app/features/voting/create/create.component.html
index 760feb7..a1739c5 100644
--- a/apps/frontend/src/app/features/voting/create/create.component.html
+++ b/apps/frontend/src/app/features/voting/create/create.component.html
@@ -150,18 +150,18 @@
@for (option of options.controls; track $index) {
- @if (voteForm.value.options[$index].option.length > 45) {
+ @if (voteForm.value.options[$index].option.length > 30) {
50
+ voteForm.value.options[$index].option.length > 32
}"
class="text-sm leading-6 text-gray-500"
id="{{ $index }}-count"
>
- {{ voteForm.value.options[$index].option.length }}/50
+ {{ voteForm.value.options[$index].option.length }}/32
}
@@ -208,7 +208,7 @@
} @if (voteForm.hasError('maxOptionLength', ['options'])) {
- Each option must be less than 50 characters.
+ Each option must be less than 32 characters.
} @if (options.controls.length < 5) {
diff --git a/apps/frontend/src/app/features/voting/create/create.component.ts b/apps/frontend/src/app/features/voting/create/create.component.ts
index 81f7fff..742e180 100644
--- a/apps/frontend/src/app/features/voting/create/create.component.ts
+++ b/apps/frontend/src/app/features/voting/create/create.component.ts
@@ -80,7 +80,7 @@ export class CreateComponent
Validators.minLength(2),
Validators.maxLength(5),
noDuplicateInOptions(),
- maxOptionLengthValidator(50),
+ maxOptionLengthValidator(32),
],
),
},
diff --git a/apps/frontend/src/app/features/voting/results/results.component.html b/apps/frontend/src/app/features/voting/results/results.component.html
index b550640..426d1a0 100644
--- a/apps/frontend/src/app/features/voting/results/results.component.html
+++ b/apps/frontend/src/app/features/voting/results/results.component.html
@@ -1,33 +1,127 @@
-
-