You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RTL/src/app/shared/components/ln-services/boltz/swap-modal/swap-modal.component.html

111 lines
9.4 KiB
HTML

<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="!flgShowInfo" [@opacityAnimation]>
<div fxFlex="100">
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
<div [fxFlex]="screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM ? '83' : '91'" fxLayoutAlign="start start"><span class="page-title">{{swapDirectionCaption}}</span></div>
<div [fxFlex]="screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM ? '17' : '9'" fxLayoutAlign="space-between end">
<button tabindex="21" class="btn-close-x p-0" (click)="showInfo()" mat-button>?</button>
<button tabindex="22" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
</div>
</mat-card-header>
<mat-card-content class="padding-gap-x-large">
<div fxLayout="column">
<mat-vertical-stepper [linear]="true" #stepper (selectionChange)="stepSelectionChanged($event)">
<mat-step [stepControl]="inputFormGroup" [editable]="flgEditable">
<form [formGroup]="inputFormGroup" fxLayout="column" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between" class="my-1">
<ng-template matStepLabel>{{inputFormLabel}}</ng-template>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<rtl-boltz-service-info [serviceInfo]="serviceInfo" [direction]="direction"></rtl-boltz-service-info>
</div>
<div fxLayout="row wrap" fxFlex="100" fxLayoutAlign="space-between center" class="mt-1">
<mat-form-field fxFlex="48">
<input autoFocus matInput placeholder="Amount" type="number" [step]="1000" tabindex="1" formControlName="amount" required>
<mat-hint>Range: {{serviceInfo?.limits?.minimal | number}}-{{serviceInfo?.limits?.maximal | number}}</mat-hint>
<span matSuffix>Sats</span>
<mat-error *ngIf="inputFormGroup?.controls?.amount?.errors?.required">Amount is required.</mat-error>
<mat-error *ngIf="inputFormGroup?.controls?.amount?.errors?.min">Amount must be greater than or equal to {{serviceInfo?.limits?.minimal | number}}.</mat-error>
<mat-error *ngIf="inputFormGroup?.controls?.amount?.errors?.max">Amount must be less than or equal to {{serviceInfo?.limits?.maximal | number}}.</mat-error>
</mat-form-field>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
<button *ngIf="direction === swapTypeEnum.SWAP_OUT" mat-button color="primary" tabindex="2" type="button" matStepperNext>Next</button>
<button *ngIf="direction === swapTypeEnum.SWAP_IN" mat-button color="primary" tabindex="3" type="button" (click)="onSwap()">Initiate {{swapDirectionCaption}}</button>
</div>
</form>
</mat-step>
<mat-step *ngIf="direction === swapTypeEnum.SWAP_OUT" [stepControl]="addressFormGroup" [editable]="flgEditable">
<form [formGroup]="addressFormGroup" fxLayout="column" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between" class="my-1">
<ng-template matStepLabel>{{addressFormLabel}}</ng-template>
<div fxLayout="row wrap" fxFlex="100" fxLayoutAlign="space-between stretch" class="mt-1">
<mat-radio-group color="primary" name="addressType" (change)="onAddressTypeChange($event)" formControlName="addressType" fxFlex="100" fxLayoutAlign="space-between stretch">
<mat-radio-button fxFlex="48" tabindex="8" value="local">Node Local Address</mat-radio-button>
<mat-radio-button fxFlex="48" tabindex="9" value="external">External Address</mat-radio-button>
</mat-radio-group>
<mat-form-field fxFlex="100" class="mt-1">
<input matInput placeholder="Address" tabindex="10" formControlName="address" [required]="addressFormGroup.controls.addressType.value === 'external'">
<mat-error *ngIf="addressFormGroup.controls.address.errors?.required">Address is required.</mat-error>
</mat-form-field>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
<button mat-button color="primary" tabindex="11" type="button" (click)="onSwap()">Initiate {{swapDirectionCaption}}</button>
</div>
</form>
</mat-step>
<mat-step [stepControl]="statusFormGroup">
<form [formGroup]="statusFormGroup" fxLayout="column" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between" class="my-1">
<ng-template matStepLabel>{{swapDirectionCaption}} Status</ng-template>
<div fxLayout="row wrap" fxFlex="100" fxLayoutAlign="space-between stretch">
<mat-expansion-panel class="flat-expansion-panel" fxFlex="100" [expanded]="!!swapStatus">
<mat-expansion-panel-header>
<mat-panel-title>
<span fxLayoutAlign="start center" fxFlex="100">{{(!swapStatus) ? ('Waiting for ' + swapDirectionCaption + ' request...') : (swapStatus.id) ? (swapDirectionCaption + ' request details') : (swapDirectionCaption + ' error details')}}<mat-icon *ngIf="swapStatus" class="ml-1 icon-small">{{(swapStatus && swapStatus?.id) ? 'check' : 'close'}}</mat-icon></span>
</mat-panel-title>
</mat-expansion-panel-header>
<div *ngIf="!swapStatus; else swapStatusBlock"></div>
</mat-expansion-panel>
<mat-progress-bar fxFlex="100" *ngIf="!swapStatus" color="primary" mode="indeterminate"></mat-progress-bar>
</div>
<h4 *ngIf="swapStatus" fxLayoutAlign="start" class="font-bold-500 mt-2">{{(swapStatus && swapStatus.error) ? (swapDirectionCaption + ' failed.') : (swapStatus && swapStatus.id) ? (swapDirectionCaption + ' request placed successfully. You can check the status of the request on the \'Boltz\' menu.') : (swapDirectionCaption + ' request placed successfully.')}}</h4>
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
<button *ngIf="swapStatus && (swapStatus.error || !swapStatus.id)" mat-button color="primary" tabindex="13" type="button" (click)="onRestart()">Start Again</button>
</div>
</form>
</mat-step>
</mat-vertical-stepper>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="end end">
<button mat-button color="primary" tabindex="14" type="button" [mat-dialog-close]="false" default>Close</button>
</div>
</div>
</mat-card-content>
</div>
</div>
<ng-template #swapStatusBlock>
<rtl-boltz-swap-status fxLayout="column" [swapStatus]="swapStatus" [direction]="direction"></rtl-boltz-swap-status>
</ng-template>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch" *ngIf="flgShowInfo" [@opacityAnimation] class="info-graphics-container">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<mat-card-header fxLayout="row" fxFlex="8" fxLayoutAlign="space-between center" class="modal-info-header">
<div fxFlex="95" fxLayoutAlign="start start"><span class="page-title"></span></div>
<div fxFlex="5" fxLayoutAlign="end center">
<button tabindex="19" class="btn-close-x p-0" (click)="flgShowInfo=false;stepNumber=1;" mat-button>X</button>
</div>
</mat-card-header>
<mat-card-content fxLayout="column" fxFlex="70" fxLayoutAlign="space-between center" class="padding-gap-x-large">
<rtl-boltz-swapout-info-graphics fxFlex="100" *ngIf="direction === swapTypeEnum.SWAP_OUT" [(stepNumber)]="stepNumber" [animationDirection]="animationDirection"></rtl-boltz-swapout-info-graphics>
<rtl-boltz-swapin-info-graphics fxFlex="100" *ngIf="direction === swapTypeEnum.SWAP_IN" [(stepNumber)]="stepNumber" [animationDirection]="animationDirection"></rtl-boltz-swapin-info-graphics>
</mat-card-content>
<div fxLayout="row" fxFlex="10" fxLayoutAlign="center end" class="padding-gap-x-large padding-gap-bottom-large">
<span *ngFor="let i of [1, 2, 3, 4, 5];" (click) = "onStepChanged(i)" fxLayoutAlign="center center" class="dots-stepper-block">
<p class="dot tiny-dot mr-0" [ngClass]="{'dot-primary': stepNumber === i, 'dot-primary-lighter': stepNumber !== i}"></p>
</span>
</div>
<div fxLayout="row" fxFlex="10" fxLayoutAlign="end end" class="padding-gap-x-large padding-gap-bottom-large">
<button *ngIf="stepNumber === 5" mat-button class="mr-1" color="primary" tabindex="15" type="button" (click)="onReadMore()">Read More</button>
<button *ngIf="stepNumber === 5" mat-button class="mr-1" color="primary" tabindex="16" type="button" (click)="onStepChanged(4)">Back</button>
<button *ngIf="stepNumber === 5" mat-button color="primary" tabindex="17" type="button" (click)="flgShowInfo=false;stepNumber=1;">Close</button>
<button *ngIf="stepNumber < 5" mat-button class="mr-1" color="primary" tabindex="18" type="button" (click)="flgShowInfo=false;stepNumber=1;">Close</button>
<button *ngIf="stepNumber > 1 && stepNumber < 5" mat-button class="mr-1" color="primary" tabindex="19" type="button" (click)="onStepChanged(stepNumber - 1)">Back</button>
<button *ngIf="stepNumber < 5" mat-button color="primary" tabindex="20" type="button" (click)="onStepChanged(stepNumber + 1)">Next</button>
</div>
</div>
</div>