components/content/content.component.ts
Main application content with Angular material tabs including:
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| selector | app-content |
| imports |
MatTabGroup
MatTab
PlotsComponent
LogicTreeComponent
DataComponent
NshmpScrollToTopComponent
MatTabContent
|
| templateUrl | ./content.component.html |
| styleUrl | ./content.component.scss |
Properties |
| hasData |
Default value : computed(() => this.service.serviceResponse() !== null)
|
|
Defined in components/content/content.component.ts:36
|
|
Whether a service has been called and there is data |
| service |
Default value : inject(AppService)
|
|
Defined in components/content/content.component.ts:33
|
import {ChangeDetectionStrategy, Component, computed, inject} from '@angular/core';
import {MatTab, MatTabContent, MatTabGroup} from '@angular/material/tabs';
import {NshmpScrollToTopComponent} from '@ghsc/nshmp-lib-ng/nshmp';
import {AppService} from '../../services/app.service';
import {DataComponent} from '../data/data.component';
import {LogicTreeComponent} from '../logic-tree/logic-tree.component';
import {PlotsComponent} from '../plots/plots.component';
/**
* Main application content with Angular material tabs including:
* - Plots tab: Plots the MFD
* - Logic tree tab: Plot the MFD logic tree using tree plot
* - Data tab: table of MFD data
*/
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
host: {id: 'source-mfd-content'},
imports: [
MatTabGroup,
MatTab,
PlotsComponent,
LogicTreeComponent,
DataComponent,
NshmpScrollToTopComponent,
MatTabContent,
],
selector: 'app-content',
styleUrl: './content.component.scss',
templateUrl: './content.component.html',
})
export class ContentComponent {
service = inject(AppService);
/** Whether a service has been called and there is data */
hasData = computed(() => this.service.serviceResponse() !== null);
}
<mat-tab-group class="height-full">
<!-- Plots tab -->
<mat-tab labelClass="plots-tab" label="Plots">
<ng-template matTabContent>
<nshmp-scroll-to-top>
<app-plots />
</nshmp-scroll-to-top>
</ng-template>
</mat-tab>
<!-- Logic tree tab -->
<mat-tab labelClass="logic-tree-tab" label="Logic Tree" [disabled]="hasData() === false">
<ng-template matTabContent>
<div class="grid-container-widescreen">
<app-logic-tree />
</div>
</ng-template>
</mat-tab>
<!-- Data tab -->
<mat-tab labelClass="data-tab" label="MFD Data" [disabled]="hasData() === false">
<div class="grid-container-widescreen">
<app-data />
</div>
</mat-tab>
</mat-tab-group>