Browse Source

feat: add spinner whilst loading

pull/4426/head
tobikugel 1 month ago
parent
commit
c802879a31
  1. 3
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
  2. 8
      apps/client/src/app/pages/portfolio/analysis/analysis-page.html
  3. 2
      apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts

3
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -58,6 +58,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
public isLoadingDividendTimelineChart: boolean; public isLoadingDividendTimelineChart: boolean;
public isLoadingInvestmentChart: boolean; public isLoadingInvestmentChart: boolean;
public isLoadingInvestmentTimelineChart: boolean; public isLoadingInvestmentTimelineChart: boolean;
public isLoadingAiPrompt: boolean;
public mode: GroupBy = 'month'; public mode: GroupBy = 'month';
public modeOptions: ToggleOption[] = [ public modeOptions: ToggleOption[] = [
{ label: $localize`Monthly`, value: 'month' }, { label: $localize`Monthly`, value: 'month' },
@ -151,6 +152,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
} }
public onCopyPromptToClipboard(mode: AiPromptMode) { public onCopyPromptToClipboard(mode: AiPromptMode) {
this.isLoadingAiPrompt = true;
this.dataService this.dataService
.fetchPrompt(mode) .fetchPrompt(mode)
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -173,6 +175,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
}); });
this.actionsMenuButton.closeMenu(); this.actionsMenuButton.closeMenu();
this.isLoadingAiPrompt = false;
}); });
} }

8
apps/client/src/app/pages/portfolio/analysis/analysis-page.html

@ -23,9 +23,13 @@
<span class="align-items-center d-flex"> <span class="align-items-center d-flex">
@if (user?.subscription?.type === 'Basic') { @if (user?.subscription?.type === 'Basic') {
<gf-premium-indicator class="mr-2" /> <gf-premium-indicator class="mr-2" />
} @else {
@if (isLoadingAiPrompt) {
<mat-spinner class="mr-2" [diameter]="20" />
} @else { } @else {
<ion-icon class="mr-2" name="copy-outline" /> <ion-icon class="mr-2" name="copy-outline" />
} }
}
<ng-container i18n <ng-container i18n
>Copy portfolio data to clipboard for AI >Copy portfolio data to clipboard for AI
prompt</ng-container prompt</ng-container
@ -40,9 +44,13 @@
<span class="align-items-center d-flex"> <span class="align-items-center d-flex">
@if (user?.subscription?.type === 'Basic') { @if (user?.subscription?.type === 'Basic') {
<gf-premium-indicator class="mr-2" /> <gf-premium-indicator class="mr-2" />
} @else {
@if (isLoadingAiPrompt) {
<mat-spinner class="mr-2" [diameter]="20" />
} @else { } @else {
<ion-icon class="mr-2" name="copy-outline" /> <ion-icon class="mr-2" name="copy-outline" />
} }
}
<ng-container i18n <ng-container i18n
>Copy AI prompt to clipboard for analysis</ng-container >Copy AI prompt to clipboard for analysis</ng-container
> >

2
apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts

@ -10,6 +10,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { AnalysisPageRoutingModule } from './analysis-page-routing.module'; import { AnalysisPageRoutingModule } from './analysis-page-routing.module';
@ -29,6 +30,7 @@ import { AnalysisPageComponent } from './analysis-page.component';
MatButtonModule, MatButtonModule,
MatCardModule, MatCardModule,
MatMenuModule, MatMenuModule,
MatProgressSpinnerModule,
NgxSkeletonLoaderModule NgxSkeletonLoaderModule
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]

Loading…
Cancel
Save