add pages
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { GorodarActions } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collect-success',
|
||||
imports: [Icon, RouterLink, MatButton],
|
||||
templateUrl: './collect-success.html',
|
||||
styleUrl: './collect-success.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CollectSuccess {
|
||||
private readonly store = inject(Store);
|
||||
|
||||
readonly title = input.required<string>();
|
||||
readonly cityName = input.required<string>();
|
||||
readonly opened = input.required<number>();
|
||||
readonly total = input.required<number>();
|
||||
readonly matchPercent = input(91);
|
||||
|
||||
protected readonly from = computed(() =>
|
||||
Math.max(0, Math.round(((this.opened() - 1) / this.total()) * 100)),
|
||||
);
|
||||
protected readonly to = computed(() => Math.round((this.opened() / this.total()) * 100));
|
||||
|
||||
protected readonly rays = Array.from({ length: 24 }, (_, index) => {
|
||||
const angle = (index / 24) * Math.PI * 2;
|
||||
const inner = 96;
|
||||
const outer = index % 2 === 0 ? 168 : 138;
|
||||
|
||||
return {
|
||||
x1: 170 + Math.cos(angle) * inner,
|
||||
y1: 170 + Math.sin(angle) * inner,
|
||||
x2: 170 + Math.cos(angle) * outer,
|
||||
y2: 170 + Math.sin(angle) * outer,
|
||||
strong: index % 2 === 0,
|
||||
};
|
||||
});
|
||||
|
||||
protected leave(): void {
|
||||
this.store.dispatch(GorodarActions.claimReset());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user