diff --git a/apps/taiga-lumbermill/src/dashboards/crypto/components/minter/minter-deploy/minter-deploy.component.ts b/apps/taiga-lumbermill/src/dashboards/crypto/components/minter/minter-deploy/minter-deploy.component.ts index 98a7a9337..eb1edf028 100644 --- a/apps/taiga-lumbermill/src/dashboards/crypto/components/minter/minter-deploy/minter-deploy.component.ts +++ b/apps/taiga-lumbermill/src/dashboards/crypto/components/minter/minter-deploy/minter-deploy.component.ts @@ -7,7 +7,6 @@ import { Output, } from '@angular/core'; import { - FormArray, FormControl, FormGroup, FormsModule, @@ -15,7 +14,7 @@ import { Validators, } from '@angular/forms'; import {TuiAutoFocus, tuiMarkControlAsTouchedAndValidate} from '@taiga-ui/cdk'; -import {TuiAlertService, TuiButton, TuiDialog, TuiError, TuiHint} from '@taiga-ui/core'; +import {TuiButton, TuiDialog, TuiError, TuiHint} from '@taiga-ui/core'; import { TUI_VALIDATION_ERRORS, TuiAvatar, @@ -28,13 +27,6 @@ import {of} from 'rxjs'; import type {TokenMinter} from '../minter.component'; -interface MinterData { - readonly title: string; - readonly defaultValue: string; - readonly type: string; - readonly description: string; -} - @Component({ standalone: true, selector: 'lmb-minter-deploy', @@ -81,45 +73,9 @@ export class MinterDeployComponent { description: new FormControl(''), }); - protected readonly minterData: MinterData[] = [ - { - title: 'Jetton Name', - defaultValue: '', - type: 'text', - description: 'Your project name with spaces', - }, - { - title: 'Jetton Symbol', - defaultValue: '', - type: 'text', - description: - 'Currency symbol appearing in balance (usually 3-5 uppercase chars)', - }, - { - title: 'Number of tokens', - defaultValue: '0', - type: 'number', - description: - 'Number of initial tokens to mint and send to your waller address', - }, - { - title: 'Description', - defaultValue: '', - type: 'text', - description: 'Optional sentence explaining about yor project', - }, - ]; - protected readonly push = inject(TuiPushService); - protected readonly alert = inject(TuiAlertService); - protected minterForm = new FormArray( - this.minterData.map((item) => new FormControl(item.defaultValue)), - ); protected openIcon = false; - protected warningIcon = false; - protected success = false; - protected urlIcon = ''; @Output() public readonly tokenChange = new EventEmitter(); @@ -130,46 +86,20 @@ export class MinterDeployComponent { protected onSubmit(): void { tuiMarkControlAsTouchedAndValidate(this.form); - } - - protected deploy(): void { - let required = true; - - for (let i = 0; i < this.minterForm.length; i++) { - if (this.minterData[i].defaultValue === this.minterForm.controls[i].value) { - required = false; - } - } - if (!required) { - this.alert - .open('Тot all required fields are filled in', { - label: 'Try again', - status: 'warning', + if (this.form.valid) { + this.push + .open('Minted your token', { + heading: 'Success', + icon: 'check', }) .subscribe(); - - return; + this.tokenChange.emit({ + urlIcon: this.form.controls.urlIcon.value ?? '', + token: this.form.controls.name.value ?? '', + symbol: this.form.controls.symbol.value ?? '', + amount: Number(this.form.controls.amount.value) ?? 0, + }); } - - if (this.urlIcon === '') { - this.warningIcon = true; - - return; - } - - this.push - .open('Minted your token', { - heading: 'Success', - icon: 'check', - }) - .subscribe(); - this.success = true; - this.tokenChange.emit({ - urlIcon: this.urlIcon, - token: this.minterForm.controls[0].value ?? '', - symbol: this.minterForm.controls[1].value ?? '', - amount: Number(this.minterForm.controls[2].value) ?? 0, - }); } }