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.
90 lines
7.1 KiB
HTML
90 lines
7.1 KiB
HTML
<div fxLayout="row">
|
|
<div fxFlex="100">
|
|
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
|
|
<div fxFlex="95" fxLayoutAlign="start start">
|
|
<span class="page-title">Connect to a new peer</span>
|
|
</div>
|
|
<button tabindex="8" fxFlex="5" fxLayoutAlign="center center" class="btn-close-x p-0" mat-button (click)="onClose()">X</button>
|
|
</mat-card-header>
|
|
<mat-card-content class="padding-gap-x-large">
|
|
<div fxLayout="column">
|
|
<mat-vertical-stepper #stepper [linear]="true" (selectionChange)="stepSelectionChanged($event)">
|
|
<mat-step [stepControl]="peerFormGroup" [editable]="flgEditable">
|
|
<form fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between" class="my-1" [formGroup]="peerFormGroup">
|
|
<ng-template matStepLabel>{{peerFormLabel}}</ng-template>
|
|
<mat-form-field fxLayout="column" fxFlex="100">
|
|
<mat-label>Lightning Address (pubkey OR pubkey@ip:port)</mat-label>
|
|
<input autoFocus matInput formControlName="peerAddress" tabindex="1" required>
|
|
<mat-error *ngIf="peerFormGroup.controls.peerAddress.errors?.required">Address is required.</mat-error>
|
|
</mat-form-field>
|
|
<div *ngIf="peerConnectionError !== ''" fxFlex="100" class="alert alert-danger mt-1">
|
|
<fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle" />
|
|
<span>{{peerConnectionError}}</span>
|
|
</div>
|
|
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
|
|
<button mat-button color="primary" tabindex="3" type="button" (click)="onConnectPeer()">{{peerConnectionError !== '' ? 'Retry' : 'Add Peer'}}</button>
|
|
</div>
|
|
</form>
|
|
</mat-step>
|
|
<mat-step [stepControl]="channelFormGroup" [editable]="flgEditable">
|
|
<form fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="start" fxLayoutAlign.gt-sm="space-between" class="mb-1" [formGroup]="channelFormGroup" (ngSubmit)="onOpenChannel()">
|
|
<ng-template matStepLabel disabled="true">{{channelFormLabel}}</ng-template>
|
|
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch">
|
|
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row" fxFlex="100" fxLayoutAlign.gt-sm="space-between center">
|
|
<mat-form-field fxLayout="column" fxFlex="53" fxLayoutAlign="start end">
|
|
<mat-label>Amount</mat-label>
|
|
<input matInput autoFocus formControlName="fundingAmount" type="number" tabindex="1" required [step]="1000">
|
|
<mat-hint>Remaining: {{totalBalance - ((channelFormGroup.controls.fundingAmount.value) ? channelFormGroup.controls.fundingAmount.value : 0) | number}}</mat-hint>
|
|
<span matSuffix> Sats </span>
|
|
<mat-error *ngIf="channelFormGroup.controls.fundingAmount.errors?.required">Amount is required.</mat-error>
|
|
<mat-error *ngIf="channelFormGroup.controls.fundingAmount.errors?.min">Amount must be a positive number.</mat-error>
|
|
<mat-error *ngIf="channelFormGroup.controls.fundingAmount.errors?.max">Amount must be less than or equal to {{totalBalance}}.</mat-error>
|
|
</mat-form-field>
|
|
<div fxFlex="45" fxLayoutAlign="start center">
|
|
<mat-slide-toggle tabindex="2" color="primary" formControlName="isPrivate" name="isPrivate">Private Channel</mat-slide-toggle>
|
|
</div>
|
|
</div>
|
|
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign.gt-sm="space-between center">
|
|
<div fxFlex="53" fxLayoutAlign="space-between end">
|
|
<mat-form-field fxLayout="column" fxLayoutAlign="start center" [fxFlex]="channelFormGroup.controls.selFeeRate.value === 'customperkb' && !channelFormGroup.controls.flgMinConf.value ? '48' : '100'">
|
|
<mat-label>Fee Rate</mat-label>
|
|
<mat-select tabindex="4" formControlName="selFeeRate">
|
|
<mat-option *ngFor="let feeRateType of feeRateTypes" [value]="feeRateType.feeRateId">
|
|
{{feeRateType.feeRateType}}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
<mat-form-field *ngIf="channelFormGroup.controls.selFeeRate.value === 'customperkb' && !channelFormGroup.controls.flgMinConf.value" fxLayout="column" fxFlex="48" fxLayoutAlign="end center">
|
|
<mat-label>Fee Rate (Sats/vByte)</mat-label>
|
|
<input matInput formControlName="customFeeRate" type="number" name="custFeeRate" tabindex="4" [step]="0.1" [min]="0">
|
|
<mat-error *ngIf="channelFormGroup.controls.selFeeRate.value === 'customperkb' && !channelFormGroup.controls.flgMinConf.value && !channelFormGroup.controls.customFeeRate.value">Fee Rate is required.</mat-error>
|
|
</mat-form-field>
|
|
</div>
|
|
<div fxFlex="45" fxLayout="row" fxLayoutAlign="start center">
|
|
<mat-checkbox fxFlex="7" tabindex="5" color="primary" formControlName="flgMinConf" fxLayoutAlign="stretch start" [ngClass]="{'mr-6': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mr-2': screenSize === screenSizeEnum.MD || screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}" />
|
|
<mat-form-field fxLayout="column" fxFlex="93">
|
|
<mat-label>Min Confirmation Blocks</mat-label>
|
|
<input matInput formControlName="minConfValue" type="number" name="blocks" tabindex="8" [step]="1" [min]="0" [required]="channelFormGroup.controls.flgMinConf.value">
|
|
<mat-error *ngIf="channelFormGroup.controls.flgMinConf.value && !channelFormGroup.controls.minConfValue.value">Min Confirmation Blocks is required.</mat-error>
|
|
</mat-form-field>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="channelConnectionError !== ''" fxFlex="100" class="alert alert-danger mt-1">
|
|
<fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle" />
|
|
<span>{{channelConnectionError}}</span>
|
|
</div>
|
|
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
|
|
<button mat-button color="primary" tabindex="8" type="submit">{{channelConnectionError !== '' ? 'Retry' : 'Open Channel'}}</button>
|
|
</div>
|
|
</form>
|
|
</mat-step>
|
|
</mat-vertical-stepper>
|
|
<div fxLayout="row" fxFlex="100" fxLayoutAlign="end center">
|
|
<button mat-button color="primary" tabindex="12" type="button" default [mat-dialog-close]="false">{{newlyAddedPeer?.id ? 'Do It Later' : 'Close'}}</button>
|
|
</div>
|
|
</div>
|
|
</mat-card-content>
|
|
</div>
|
|
</div>
|