diff --git a/src/app/degree-planner/degree-planner.component.html b/src/app/degree-planner/degree-planner.component.html index fbb22122b2f93a7eeec6513fa8363015a8aedf59..d4eec22fe0649004921fbe07c07bc85f33dc2f44 100644 --- a/src/app/degree-planner/degree-planner.component.html +++ b/src/app/degree-planner/degree-planner.component.html @@ -9,11 +9,21 @@ <mat-form-field> <mat-select placeholder="Degree Plans" + class="degree-plan-selector" [value]="visibleRoadmapId$ | async" [disableOptionCentering]="true" (selectionChange)="handleDegreePlanChange($event)"> - <mat-option *ngFor="let degreePlan of allDegreePlans$ | async" [value]="degreePlan.roadmapId"> - {{ degreePlan.name }} + + <!-- Render the name of the currently visible degree plan. --> + <mat-select-trigger *ngIf="(visibleDegreePlan$ | async) as degreePlan"> + <mat-icon class="primary-star" *ngIf="degreePlan.primary">star_rate</mat-icon> + <span class="plan-name">{{degreePlan.name}}</span> + </mat-select-trigger> + + <!-- Show all degree plans in the dropdown list and ddd a star next to the user's primary plan. --> + <mat-option *ngFor="let degreePlan of (allDegreePlans$ | async)" [value]="degreePlan.roadmapId"> + <mat-icon class="primary-star" *ngIf="degreePlan.primary">star_rate</mat-icon> + <span class="plan-name">{{degreePlan.name}}</span> </mat-option> </mat-select> </mat-form-field> diff --git a/src/app/degree-planner/degree-planner.component.scss b/src/app/degree-planner/degree-planner.component.scss index 514a7acca1715d85786031c7aa9ec8ad46eb5c0c..8f3e6468c5776ccedb14dca33a32317ca72f7a67 100644 --- a/src/app/degree-planner/degree-planner.component.scss +++ b/src/app/degree-planner/degree-planner.component.scss @@ -15,6 +15,30 @@ mat-sidenav { background-color: #F0F0F0; } +.degree-plan-selector { + height: 27px; + + mat-select-trigger { + height: 24px; + display: inline-block; + position: relative; + top: 1px; + + .plan-name { + position: relative; + top: 1px; + display: inline-block; + vertical-align: top; + height: 24px; + line-height: 24px; + } + } + + .primary-star { + margin-right: 12px; + } +} + @media screen and (max-width: 600px) { #menu-toggle-btn { position: relative; diff --git a/src/app/degree-planner/degree-planner.component.ts b/src/app/degree-planner/degree-planner.component.ts index 444465958f2f3a0b0021977b46f65e99200aa924..511b3f18ce86fc91e1584d2b5a025e5c93a05ccc 100644 --- a/src/app/degree-planner/degree-planner.component.ts +++ b/src/app/degree-planner/degree-planner.component.ts @@ -18,6 +18,7 @@ import { getVisibleRoadmapId, firstActiveTermCode, getAllVisibleTermsByYear, + getVisibleDegreePlan, } from '@app/degree-planner/store/selectors'; // Actions @@ -34,6 +35,7 @@ export class DegreePlannerComponent implements OnInit { public coursesData$: any; public visibleRoadmapId$: Observable<number | undefined>; + public visibleDegreePlan$: Observable<DegreePlan | undefined>; public allDegreePlans$: Observable<DegreePlan[]>; public firstActiveTermCode$: Observable<string | undefined>; public termsByYear$: Observable<Year[]>; @@ -47,6 +49,7 @@ export class DegreePlannerComponent implements OnInit { public ngOnInit() { this.visibleRoadmapId$ = this.store.pipe(select(getVisibleRoadmapId)); + this.visibleDegreePlan$ = this.store.pipe(select(getVisibleDegreePlan)); this.allDegreePlans$ = this.store.pipe(select(getAllDegreePlans)); this.firstActiveTermCode$ = this.store.pipe(select(firstActiveTermCode)); this.termsByYear$ = this.store.pipe(select(getAllVisibleTermsByYear));