Skip to content

Commit

Permalink
feat(Archive Run): Only show number of runs after all runs are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan committed Sep 18, 2023
1 parent 83d4924 commit 71c635a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
fxFlex.sm="0 0 calc(50%-8px)"
i18n-placeholderText
placeholderText="Search"
[disable]="!loaded"
[disable]="!recentRunsLoaded"
[value]="searchValue"
(update)="searchChanged($event)"
></app-search-bar>
Expand All @@ -26,7 +26,7 @@
</mat-form-field>
</div>
<div *ngIf="filteredRuns.length > 0" class="notice">
<p [ngStyle]="{ visibility: loaded ? 'visible' : 'hidden' }">
<p [ngStyle]="{ visibility: allRunsLoaded ? 'visible' : 'hidden' }">
<ng-container *ngIf="searchValue || filterValue" i18n
>Units found: {{ filteredRuns.length }}</ng-container
>
Expand Down Expand Up @@ -59,7 +59,7 @@
</ng-container>
</p>
</div>
<ng-container *ngIf="loaded">
<ng-container *ngIf="recentRunsLoaded">
<ng-container *ngIf="filteredRuns.length === 0">
<div class="notice no-runs-message" *ngIf="!showArchived">
<p i18n>Hey there! Looks like you don't have any active classroom units.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import { SelectRunsOption } from '../select-runs-controls/select-runs-option';
export class TeacherRunListComponent implements OnInit {
private MAX_RECENT_RUNS = 10;

protected allRunsLoaded: boolean = false;
protected filteredRuns: TeacherRun[] = [];
protected filterValue: string = '';
protected loaded: boolean = false;
protected numSelectedRuns: number = 0;
protected recentRunsLoaded: boolean = false;
protected runChangedEventEmitter: EventEmitter<void> = new EventEmitter<void>();
protected runs: TeacherRun[] = [];
protected searchValue: string = '';
Expand Down Expand Up @@ -57,6 +58,7 @@ export class TeacherRunListComponent implements OnInit {
this.setRuns(runs);
this.processRuns();
this.highlightNewRunIfNecessary();
this.allRunsLoaded = true;
});
}

Expand All @@ -78,7 +80,7 @@ export class TeacherRunListComponent implements OnInit {
return teacherRun;
});
this.filteredRuns = this.runs;
this.loaded = true;
this.recentRunsLoaded = true;
}

private subscribeToRuns(): void {
Expand Down

0 comments on commit 71c635a

Please sign in to comment.