[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 { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
[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 { AccountSwitcherService } from "../services/account-switcher.service";
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
templateUrl: "account-switcher.component.html",
|
|
|
|
})
|
|
|
|
export class AccountSwitcherComponent {
|
2023-11-29 15:59:50 +01:00
|
|
|
constructor(
|
|
|
|
private accountSwitcherService: AccountSwitcherService,
|
|
|
|
private router: Router,
|
2023-11-29 22:15:20 +01:00
|
|
|
private routerService: BrowserRouterService,
|
2023-11-29 15:59:50 +01:00
|
|
|
) {}
|
[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
|
|
|
|
|
|
|
get accountOptions$() {
|
|
|
|
return this.accountSwitcherService.accountOptions$;
|
|
|
|
}
|
|
|
|
|
|
|
|
async selectAccount(id: string) {
|
|
|
|
await this.accountSwitcherService.selectAccount(id);
|
2023-11-29 15:59:50 +01:00
|
|
|
this.router.navigate([this.routerService.getPreviousUrl() ?? "/home"]);
|
[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
|
|
|
}
|
|
|
|
}
|