1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-27 21:53:25 +00:00

refactor to use a uiState enum for UI states

This commit is contained in:
rr-bw
2024-09-11 16:47:43 -07:00
parent 96f31ecf61
commit f9dc91228b
2 changed files with 15 additions and 12 deletions

View File

@@ -42,11 +42,7 @@
[bitSubmit]="submit"
[formGroup]="formGroup"
>
<!-----------------------------
Web UI State 1: Email Entry
------------------------------>
<!-- TODO-rr-bw: consider refactoring this *ngIf check to something like LoginState.EmailEntry and LoginState.MasterPasswordEntry -->
<ng-container *ngIf="!validatedEmail">
<ng-container *ngIf="uiState === LoginUiState.EMAIL_ENTRY">
<!-- Email Address input -->
<div class="tw-mb-3">
<bit-form-field>
@@ -105,16 +101,13 @@
</p>
</ng-container>
<!---------------------------------------
Web UI State 2: Master Password Entry
---------------------------------------->
<!--
Why not use <ng-container *ngIf="validatedEmail"> to display this section?
Because we want access to the masterPasswordInput reference in the class file.
- Using a hidden div allows us to access the reference without rendering the div initially.
- Using *ngIf would not allow us to access the reference without rendering the ng-container initially.
-->
<div [ngClass]="{ 'tw-hidden': !validatedEmail }">
<div [ngClass]="{ 'tw-hidden': uiState !== LoginUiState.MASTER_PASSWORD_ENTRY }">
<div class="tw-mb-6 tw-h-28">
<!-- Master Password input -->
<bit-form-field class="!tw-mb-1">