mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[PM-5430] Separate Active Account from other accounts (#7374)
* make spacing consistent between log out and lock all buttons * update color of avatar when no active account * separate active account from other available accounts * remove unnecessary ng-container
This commit is contained in:
parent
ec417cf2aa
commit
565846f837
@ -2835,6 +2835,9 @@
|
|||||||
"activeAccount": {
|
"activeAccount": {
|
||||||
"message": "Active account"
|
"message": "Active account"
|
||||||
},
|
},
|
||||||
|
"availableAccounts": {
|
||||||
|
"message": "Available accounts"
|
||||||
|
},
|
||||||
"accountLimitReached": {
|
"accountLimitReached": {
|
||||||
"message": "Account limit reached. Log out of an account to add another."
|
"message": "Account limit reached. Log out of an account to add another."
|
||||||
},
|
},
|
||||||
|
@ -15,9 +15,20 @@
|
|||||||
<div class="tw-p-2">
|
<div class="tw-p-2">
|
||||||
<div *ngIf="availableAccounts$ | async as availableAccounts">
|
<div *ngIf="availableAccounts$ | async as availableAccounts">
|
||||||
<ul class="tw-grid tw-list-none tw-gap-2" role="listbox">
|
<ul class="tw-grid tw-list-none tw-gap-2" role="listbox">
|
||||||
<li *ngFor="let availableAccount of availableAccounts" role="option">
|
<ng-container
|
||||||
|
*ngFor="let availableAccount of availableAccounts; first as isFirst"
|
||||||
|
role="option"
|
||||||
|
>
|
||||||
|
<li *ngIf="availableAccount.isActive" class="tw-mb-4">
|
||||||
<auth-account [account]="availableAccount" (loading)="loading = $event"></auth-account>
|
<auth-account [account]="availableAccount" (loading)="loading = $event"></auth-account>
|
||||||
</li>
|
</li>
|
||||||
|
<div *ngIf="isFirst" class="tw-uppercase tw-text-muted">
|
||||||
|
{{ "availableAccounts" | i18n }}
|
||||||
|
</div>
|
||||||
|
<li *ngIf="!availableAccount.isActive">
|
||||||
|
<auth-account [account]="availableAccount" (loading)="loading = $event"></auth-account>
|
||||||
|
</li>
|
||||||
|
</ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
<!--
|
<!--
|
||||||
If the user has not reached the account limit, the last 'availableAccount' will have an 'id' of
|
If the user has not reached the account limit, the last 'availableAccount' will have an 'id' of
|
||||||
@ -58,7 +69,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="account-switcher-row tw-mt-2 tw-flex tw-w-full tw-items-center tw-gap-3 tw-rounded-md tw-p-3"
|
class="account-switcher-row tw-flex tw-w-full tw-items-center tw-gap-3 tw-rounded-md tw-p-3"
|
||||||
(click)="lockAll()"
|
(click)="lockAll()"
|
||||||
>
|
>
|
||||||
<i class="bwi bwi-lock tw-text-2xl" aria-hidden="true"></i>
|
<i class="bwi bwi-lock tw-text-2xl" aria-hidden="true"></i>
|
||||||
|
@ -42,7 +42,7 @@ export class AccountComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get status() {
|
get status() {
|
||||||
if (this.account.isActive && this.account.status !== AuthenticationStatus.Locked) {
|
if (this.account.isActive) {
|
||||||
return { text: this.i18nService.t("active"), icon: "bwi-check-circle" };
|
return { text: this.i18nService.t("active"), icon: "bwi-check-circle" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<span class="tw-sr-only">{{ "switchAccounts" | i18n }}</span>
|
<span class="tw-sr-only">{{ "switchAccounts" | i18n }}</span>
|
||||||
<bit-avatar
|
<bit-avatar
|
||||||
[text]="'…'"
|
[text]="'…'"
|
||||||
[color]="'#175DDC'"
|
[color]="'#6795E8'"
|
||||||
size="small"
|
size="small"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
class="[&>img]:tw-block"
|
class="[&>img]:tw-block"
|
||||||
|
@ -77,11 +77,21 @@ export class AccountSwitcherService {
|
|||||||
options.push({
|
options.push({
|
||||||
name: "Add account",
|
name: "Add account",
|
||||||
id: this.SPECIAL_ADD_ACCOUNT_ID,
|
id: this.SPECIAL_ADD_ACCOUNT_ID,
|
||||||
isActive: activeAccount?.id == null,
|
isActive: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options.sort((a, b) => {
|
||||||
|
// Active account is always first
|
||||||
|
if (a.isActive) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Add Account" button is always last
|
||||||
|
if (a.id === this.SPECIAL_ADD_ACCOUNT_ID) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user