Skip to content

Commit

Permalink
feature: new component for sub account UI
Browse files Browse the repository at this point in the history
  • Loading branch information
jackson-dean committed Sep 21, 2023
1 parent 50978bd commit 2525f27
Show file tree
Hide file tree
Showing 5 changed files with 498 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { ErrorCallbackComponent } from './error-callback/error-callback.componen
import { FreeDeSoDisclaimerComponent } from './free-deso-message/free-deso-disclaimer/free-deso-disclaimer.component';
import { FreeDesoMessageComponent } from './free-deso-message/free-deso-message.component';
import { GetDesoComponent } from './get-deso/get-deso.component';
import { GroupedAccountSelectComponent } from './grouped-account-select/grouped-account-select.component';
import { HomeComponent } from './home/home.component';
import { IconsModule } from './icons/icons.module';
import { IdentityService } from './identity.service';
Expand Down Expand Up @@ -98,6 +99,7 @@ import { TransactionSpendingLimitComponent } from './transaction-spending-limit/
TransactionSpendingLimitAssociationComponent,
TransactionSpendingLimitAccessGroupComponent,
TransactionSpendingLimitAccessGroupMemberComponent,
GroupedAccountSelectComponent,
],
imports: [
BrowserModule,
Expand Down
157 changes: 157 additions & 0 deletions src/app/grouped-account-select/grouped-account-select.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<div
class="spinner-border"
style="width: 8rem; height: 8rem"
*ngIf="loadingAccounts; else accountsSection"
></div>
<ng-template #accountsSection>
<div class="section--accounts" *ngIf="hasVisibleAccounts">
<div class="section--accounts__header margin-bottom--medium">
Select an account
</div>

<ng-container
*ngFor="
let group of accountGroups | keyvalue : keyValueSort;
let i = index
"
>
<div *ngIf="group.value.accounts.length" class="margin-bottom--large">
<ul
class="section--accounts__list container--scrollbar margin-bottom--small"
>
<li
*ngFor="let account of group.value.accounts; let j = index"
data-control-name="account-select-item"
>
<div class="display--flex items--center margin-top--small">
<button
class="section--accounts__item margin-right--small"
(click)="selectAccount(account.publicKey)"
role="button"
>
<div class="display--flex items--center">
<img
class="avatar--rounded avatar--large margin-right--small"
[appAvatar]="account.publicKey"
/>
<div>
<div>
<span [title]="getAccountDisplayName(account)">{{
getAccountDisplayName(account)
| truncateAddressOrUsername
}}</span>
<span
*ngIf="account.lastUsed && !this.globalVars.isMobile()"
class="font-size--xsmall text--green-lighter margin-left--small"
>Last used</span
>
</div>
<div
*ngIf="this.globalVars.isMobile()"
class="display--flex"
>
<span class="font-size--xsmall"
>Account: {{ account.accountNumber }}</span
>
<span
*ngIf="account.lastUsed"
class="font-size--xsmall text--green-lighter margin-left--auto"
>Last used</span
>
</div>
</div>
</div>
<div class="display--flex items--center">
<div
*ngIf="!this.globalVars.isMobile()"
class="display--flex flex--column items--end"
>
<span class="font-size--xsmall margin-right--small"
>Account: {{ account.accountNumber }}</span
>
</div>
<img
[src]="
getLoginMethodIcon(
accountService.getLoginMethodWithPublicKeyBase58Check(
group.key
)
)
"
class="section--accounts__icon"
/>
</div>
</button>
<button
*ngIf="!isMetaMaskAccountGroup(group.key)"
class="styleless-button"
(click)="hideAccount(group.key, account)"
>
<i-feather name="power" class="text--blue-base"></i-feather>
</button>
</div>
</li>
</ul>
<div *ngIf="!isMetaMaskAccountGroup(group.key)">
<div class="display--flex">
<button
class="button--small button--primary display--flex items--center margin-right--small"
style="width: auto; white-space: nowrap"
aria-label="Add account"
(click)="addSubAccount(group.key)"
>
<i-feather
name="user-plus"
class="margin-right--xsmall"
style="height: 16px; width: 16px"
/>
Account
</button>
<button
class="button--small button--secondary display--flex items--center"
style="width: auto; white-space: nowrap"
(click)="toggleRecoverSubAccountForm(group.key)"
>
<i-feather
name="power"
class="margin-right--xsmall"
style="height: 16px; width: 16px"
/>
Recover
</button>
</div>
<form
*ngIf="group.value.showRecoverSubAccountInput"
(submit)="recoverSubAccount($event, group.key)"
class="margin-top--small margin-left--small"
>
<label for="account-number" class="display--block font-size--small"
>Enter account number:</label
>
<input
[(ngModel)]="accountNumberToRecover"
name="account-number"
id="account-number"
type="number"
step="1"
/>
<button
type="submit"
class="button--primary button--small margin-left--small"
style="width: auto; white-space: nowrap"
>
Submit
</button>
</form>
</div>
</div>
</ng-container>
</div>
</ng-template>
<div
*ngIf="hasVisibleAccounts"
class="text--divider margin-top--medium margin-bottom--medium"
>
or
</div>
<app-log-in-options></app-log-in-options>
Empty file.
Loading

0 comments on commit 2525f27

Please sign in to comment.