add logic

This commit is contained in:
2026-10-07 17:32:25 +03:00
parent cdcdd22526
commit f86777e2cd
69 changed files with 1519 additions and 637 deletions
+34 -2
View File
@@ -1,7 +1,9 @@
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
import { Icon } from '../../shared/icon/icon';
type StepState = 'done' | 'active' | 'wait';
@Component({
selector: 'app-photo-check',
imports: [Icon],
@@ -12,5 +14,35 @@ import { Icon } from '../../shared/icon/icon';
export class PhotoCheck {
readonly photo = input.required<string>();
readonly title = input.required<string>();
readonly step = input(1);
readonly step = input(0);
protected readonly items = computed(() => {
const step = this.step();
return [
{
title: 'Фото отправлено',
text: step >= 1 ? 'Снимок получен сервисом' : 'Готовим снимок',
state: stepState(step, 0),
},
{
title: 'Сравниваем с эталонами',
text: `Ищем совпадение с ${this.title()}`,
state: stepState(step, 1),
},
{
title: 'Добавляем в коллекцию',
text: 'Объект появится в вашей коллекции',
state: stepState(step, 2),
},
];
});
}
function stepState(step: number, index: number): StepState {
if (step > index) {
return 'done';
}
return step === index ? 'active' : 'wait';
}