[PM-2910] Add Account Switching Page (#6701)
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Make sure centered content centered
* Allow for disabling header theming for login page
visual gitches exist for links and buttons, due to specifications futher down in the header, but those
items shouldn't use the `no-theme` option. For now, it's just for the
login screen
* Add Account Switching Component
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Add Account Switching Component
* Fix Rebase Issues
* Remove Comments
* Move AccountSwitcher Logic Into Service
* Rename File
* Move Router to Component
* Add Tests for AccountSwitcherService
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-10-30 16:34:42 +01:00
|
|
|
import { Component } from "@angular/core";
|
|
|
|
import { Router } from "@angular/router";
|
2023-11-29 15:59:50 +01:00
|
|
|
import { map } from "rxjs";
|
[PM-2910] Add Account Switching Page (#6701)
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Make sure centered content centered
* Allow for disabling header theming for login page
visual gitches exist for links and buttons, due to specifications futher down in the header, but those
items shouldn't use the `no-theme` option. For now, it's just for the
login screen
* Add Account Switching Component
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Add Account Switching Component
* Fix Rebase Issues
* Remove Comments
* Move AccountSwitcher Logic Into Service
* Rename File
* Move Router to Component
* Add Tests for AccountSwitcherService
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-10-30 16:34:42 +01:00
|
|
|
|
|
|
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
2023-11-29 15:59:50 +01:00
|
|
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
[PM-2910] Add Account Switching Page (#6701)
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Make sure centered content centered
* Allow for disabling header theming for login page
visual gitches exist for links and buttons, due to specifications futher down in the header, but those
items shouldn't use the `no-theme` option. For now, it's just for the
login screen
* Add Account Switching Component
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Add Account Switching Component
* Fix Rebase Issues
* Remove Comments
* Move AccountSwitcher Logic Into Service
* Rename File
* Move Router to Component
* Add Tests for AccountSwitcherService
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-10-30 16:34:42 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-current-account",
|
|
|
|
templateUrl: "current-account.component.html",
|
|
|
|
})
|
|
|
|
export class CurrentAccountComponent {
|
|
|
|
constructor(private accountService: AccountService, private router: Router) {}
|
|
|
|
|
|
|
|
get currentAccount$() {
|
|
|
|
return this.accountService.activeAccount$;
|
|
|
|
}
|
|
|
|
|
2023-11-29 15:59:50 +01:00
|
|
|
get currentAccountName$() {
|
|
|
|
return this.currentAccount$.pipe(
|
|
|
|
map((a) => {
|
|
|
|
return Utils.isNullOrWhitespace(a.name) ? a.email : a.name;
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async currentAccountClicked() {
|
|
|
|
await this.router.navigate(["/account-switcher"]);
|
[PM-2910] Add Account Switching Page (#6701)
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Make sure centered content centered
* Allow for disabling header theming for login page
visual gitches exist for links and buttons, due to specifications futher down in the header, but those
items shouldn't use the `no-theme` option. For now, it's just for the
login screen
* Add Account Switching Component
* Collate browser header concerns into component
Header component has a slots field with a left, center, right, and a
right-most location for a current account, which will link to an account
switcher.
* Use feature flag if OK for production eventually
* Add Account Switching Component
* Fix Rebase Issues
* Remove Comments
* Move AccountSwitcher Logic Into Service
* Rename File
* Move Router to Component
* Add Tests for AccountSwitcherService
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-10-30 16:34:42 +01:00
|
|
|
}
|
|
|
|
}
|