-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[PM-26687] send skeleton #17333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-26687] send skeleton #17333
Changes from all commits
b3d5c0a
604c041
f4dfbd0
9a6ce54
c0d1044
dc84440
96b4399
26e34fe
90c3ad0
313fd45
fb400c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,18 @@ | ||
| import { CommonModule } from "@angular/common"; | ||
| import { Component, OnDestroy } from "@angular/core"; | ||
| import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; | ||
| import { combineLatest, switchMap } from "rxjs"; | ||
| import { combineLatest, distinctUntilChanged, map, shareReplay, switchMap } from "rxjs"; | ||
|
|
||
| import { JslibModule } from "@bitwarden/angular/jslib.module"; | ||
| import { NoResults, NoSendsIcon } from "@bitwarden/assets/svg"; | ||
| import { VaultLoadingSkeletonComponent } from "@bitwarden/browser/vault/popup/components/vault-loading-skeleton/vault-loading-skeleton.component"; | ||
| import { BrowserPremiumUpgradePromptService } from "@bitwarden/browser/vault/popup/services/browser-premium-upgrade-prompt.service"; | ||
| import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; | ||
| import { PolicyType } from "@bitwarden/common/admin-console/enums"; | ||
| import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; | ||
| import { getUserId } from "@bitwarden/common/auth/services/account.service"; | ||
| import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; | ||
| import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; | ||
| import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; | ||
| import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service"; | ||
| import { | ||
|
|
@@ -31,6 +34,7 @@ import { CurrentAccountComponent } from "../../../auth/popup/account-switching/c | |
| import { PopOutComponent } from "../../../platform/popup/components/pop-out.component"; | ||
| import { PopupHeaderComponent } from "../../../platform/popup/layout/popup-header.component"; | ||
| import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.component"; | ||
| import { VaultFadeInOutSkeletonComponent } from "../../../vault/popup/components/vault-fade-in-out-skeleton/vault-fade-in-out-skeleton.component"; | ||
|
|
||
| // FIXME: update to use a const object instead of a typescript enum | ||
| // eslint-disable-next-line @bitwarden/platform/no-enums | ||
|
|
@@ -64,6 +68,8 @@ export enum SendState { | |
| SendListFiltersComponent, | ||
| SendSearchComponent, | ||
| TypographyModule, | ||
| VaultFadeInOutSkeletonComponent, | ||
| VaultLoadingSkeletonComponent, | ||
| ], | ||
| }) | ||
| export class SendV2Component implements OnDestroy { | ||
|
|
@@ -72,7 +78,26 @@ export class SendV2Component implements OnDestroy { | |
|
|
||
| protected listState: SendState | null = null; | ||
| protected sends$ = this.sendItemsService.filteredAndSortedSends$; | ||
| protected sendsLoading$ = this.sendItemsService.loading$; | ||
| private skeletonFeatureFlag$ = this.configService.getFeatureFlag$( | ||
| FeatureFlag.VaultLoadingSkeletons, | ||
| ); | ||
| protected sendsLoading$ = this.sendItemsService.loading$.pipe( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐ญ Consider extracting to a dedicated loading service The vault implementation uses Consider creating a
This would improve consistency across the codebase and make the component logic cleaner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The observable doesn't include Recommended addition: protected sendsLoading$ = this.sendItemsService.loading$.pipe(
startWith(true), // Add this
distinctUntilChanged(),
tap((loading) => {
const key = loading ? "loadingSendPage" : "sendPageLoaded";
void this.liveAnnouncer.announce(this.i18nService.translate(key), "polite");
}),
shareReplay({ bufferSize: 1, refCount: true }),
);Reference: vault-popup-loading.service.ts:25 uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐จ Consider extracting to dedicated loading service The vault implementation uses Consider creating a
This would improve consistency with the vault implementation and make the component logic cleaner. However, this is an optional enhancement. |
||
| distinctUntilChanged(), | ||
| shareReplay({ bufferSize: 1, refCount: true }), | ||
| ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. โ Missing test coverage for loading state transitions The codecov report indicates 2 lines of missing coverage in this component. These loading pipeline operations (distinctUntilChanged, tap with liveAnnouncer) should have tests verifying:
Consider adding a test file similar to
itsadrago marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** Spinner Loading State */ | ||
| protected showSpinnerLoaders$ = combineLatest([ | ||
| this.sendsLoading$, | ||
| this.skeletonFeatureFlag$, | ||
| ]).pipe(map(([loading, skeletonsEnabled]) => loading && !skeletonsEnabled)); | ||
|
|
||
| /** Skeleton Loading State */ | ||
| protected showSkeletonsLoaders$ = combineLatest([ | ||
| this.sendsLoading$, | ||
| this.skeletonFeatureFlag$, | ||
| ]).pipe(map(([loading, skeletonsEnabled]) => loading && skeletonsEnabled)); | ||
|
|
||
| protected title: string = "allSends"; | ||
| protected noItemIcon = NoSendsIcon; | ||
| protected noResultsIcon = NoResults; | ||
|
|
@@ -84,6 +109,7 @@ export class SendV2Component implements OnDestroy { | |
| protected sendListFiltersService: SendListFiltersService, | ||
| private policyService: PolicyService, | ||
| private accountService: AccountService, | ||
| private configService: ConfigService, | ||
| ) { | ||
| combineLatest([ | ||
| this.sendItemsService.emptyList$, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.