From d4abe9ad414988cc9bc5046ec8e674b9aba6e03c Mon Sep 17 00:00:00 2001 From: MishaZhem Date: Thu, 29 Aug 2024 14:42:34 +0300 Subject: [PATCH] chore: update animal page --- .../dashboards/dashboards.component.html | 1 - .../components/animal/animal.component.html | 62 +++++++++---------- .../components/animal/animal.component.less | 13 +++- .../components/animal/animal.component.ts | 21 ++++++- 4 files changed, 58 insertions(+), 39 deletions(-) diff --git a/apps/taiga-lumbermill/src/dashboards/dashboards/dashboards.component.html b/apps/taiga-lumbermill/src/dashboards/dashboards/dashboards.component.html index 705d630ee..62db0fdec 100644 --- a/apps/taiga-lumbermill/src/dashboards/dashboards/dashboards.component.html +++ b/apps/taiga-lumbermill/src/dashboards/dashboards/dashboards.component.html @@ -13,7 +13,6 @@ {{ title }} dashboard diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.html b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.html index 6db515d6c..7099bb7ab 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.html +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.html @@ -1,5 +1,4 @@ @let animal = animals[id]; -@let value = value$ | async;
[style.gap]="'0.5rem'" > Health: + @let HealthvValue = values$[0]() | async; - {{ value === max ? 'good' : animal.health }} + {{ HealthvValue === max ? 'good' : animal.health }}
@@ -31,27 +31,6 @@

- -
-
-
-

- About animal -

-
-
-

From: {{ animal.from }}

-

Description: {{ animal.about }}

-
-
-
@for (act of actions; track $index) { + @let value = values$[$index]() | async;
- @if (states[$index]) { + @if (states[$index]()) {
+
+
+
+

+ About animal +

+
+
+

From: {{ animal.from }}

+

Description: {{ animal.about }}

+
+
+
+
diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.less b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.less index 1f5569d63..bdfb03d40 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.less +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.less @@ -5,7 +5,6 @@ .info { display: flex; align-items: center; - justify-content: center; gap: 2rem; text-align: center; @@ -27,8 +26,11 @@ flex-wrap: wrap; } -.card { +.card[tuiCardLarge][data-space] { flex-grow: 1; + padding-top: 1.2rem; + padding-bottom: 1.2rem; + height: min-content; } .about { @@ -49,7 +51,6 @@ .list { display: flex; flex-direction: column; - gap: 0.4rem; } .disable { @@ -61,3 +62,9 @@ font-weight: 600; text-align: left; } + +.action { + display: flex; + gap: 1rem; + height: max-content; +} diff --git a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.ts b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.ts index deea45239..3e98a0e7e 100644 --- a/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.ts +++ b/apps/taiga-lumbermill/src/dashboards/space-zoo/components/animal/animal.component.ts @@ -1,5 +1,11 @@ import {CommonModule} from '@angular/common'; -import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + inject, + signal, +} from '@angular/core'; import {toSignal} from '@angular/core/rxjs-interop'; import {ActivatedRoute} from '@angular/router'; import {TuiAppearance, TuiSurface, TuiTitle} from '@taiga-ui/core'; @@ -39,7 +45,18 @@ export class AnimalComponent { takeWhile((value) => value <= this.max), ); - protected states = animals[this.id].action.map((_) => false); + protected states = actions.map((_) => signal(false)); + protected values$ = actions.map((_, ind) => + computed(() => + this.states[ind]() + ? timer(140, 80).pipe( + map((i) => i + 30), + startWith(30), + takeWhile((value) => value <= this.max), + ) + : null, + ), + ); protected inArray(value: string): boolean { return this.animals[this.id].action.includes(value);