app.component.ts
Application to call dynamic hazard services and plot results.
                OnInit
                AfterViewInit
    
| selector | app-app | 
            
| imports | 
                            NshmpTemplateComponent
                                NshmpTemplateControlPanelComponent
                            NshmpTemplateContentContainerComponent
                                NshmpTemplateMainContentComponent
                                NshmpTemplateAboutComponent
                            NshmpHazardProvisionalModelComponent
                            NshmpTemplateSettingsComponent
                                ControlPanelComponent
                                ContentComponent
                                PlotSettingsPanelComponent
                                AboutComponent
                            AsyncPipe
                 | 
            
| templateUrl | ./app.component.html | 
            
| styleUrl | ./app.component.scss | 
            
                        Properties | 
                
                        
  | 
                
                        Methods | 
                
                        
  | 
                
| Private addSteps | 
                        
                    addSteps()
                 | 
            
| 
                             Defined in app.component.ts:79 
                         | 
                    
| 
                         
                            Returns :          
                void
                         | 
            
| ngAfterViewInit | 
ngAfterViewInit()
                 | 
            
| 
                             Defined in app.component.ts:74 
                         | 
                    
| 
                         
                            Returns :          
                void
                         | 
            
| ngOnInit | 
ngOnInit()
                 | 
            
| 
                             Defined in app.component.ts:62 
                         | 
                    
| 
                         
                            Returns :          
                void
                         | 
            
| Private destroyRef | 
                        Default value : inject(DestroyRef)
                     | 
                
| 
                                 Defined in app.component.ts:55 
                         | 
                    
| navService | 
                        Default value : inject(NavigationService)
                     | 
                
| 
                                 Defined in app.component.ts:50 
                         | 
                    
| nshmpService | 
                        Default value : inject(NshmpService)
                     | 
                
| 
                                 Defined in app.component.ts:51 
                         | 
                    
| Private nshmpTemplateService | 
                        Default value : inject(NshmpTemplateService)
                     | 
                
| 
                                 Defined in app.component.ts:53 
                         | 
                    
| service | 
                        Default value : inject(AppService)
                     | 
                
| 
                                 Defined in app.component.ts:49 
                         | 
                    
| Private shepherdService | 
                        Default value : inject(ShepherdService)
                     | 
                
| 
                                 Defined in app.component.ts:52 
                         | 
                    
| title | 
                        Default value : apps().hazard.dynamic.display
                     | 
                
| 
                                 Defined in app.component.ts:58 
                         | 
                    
| 
                     Application title  | 
            
| Private tutorialKey | 
                        Type :         string
                     | 
                
                        Default value : 'hazard-dynamic-show-tutorial'
                     | 
                
| 
                                 Defined in app.component.ts:60 
                         | 
                    
| Private tutorialService | 
                        Default value : inject(TutorialService)
                     | 
                
| 
                                 Defined in app.component.ts:54 
                         | 
                    
import {AsyncPipe} from '@angular/common';
import {AfterViewInit, Component, DestroyRef, inject, OnInit} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {NshmpHazardProvisionalModelComponent} from '@ghsc/nshmp-lib-ng/hazard';
import {NshmpService} from '@ghsc/nshmp-lib-ng/nshmp';
import {
  NshmpTemplateAboutComponent,
  NshmpTemplateComponent,
  NshmpTemplateContentContainerComponent,
  NshmpTemplateControlPanelComponent,
  NshmpTemplateMainContentComponent,
  NshmpTemplateService,
  NshmpTemplateSettingsComponent,
} from '@ghsc/nshmp-template';
import {ShepherdService} from 'angular-shepherd';
import {NavigationService} from 'projects/nshmp-apps/src/shared/services/navigation.service';
import {TutorialService} from 'projects/nshmp-apps/src/shared/services/tutorial.service';
import {apps} from 'projects/nshmp-apps/src/shared/utils/applications.utils';
import {AboutComponent} from './components/about/about.component';
import {ContentComponent} from './components/content/content.component';
import {ControlPanelComponent} from './components/control-panel/control-panel.component';
import {PlotSettingsPanelComponent} from './components/plot-settings-panel/plot-settings-panel.component';
import {AppService} from './services/app.service';
/**
 * Application to call dynamic hazard services and plot results.
 */
@Component({
  imports: [
    NshmpTemplateComponent,
    NshmpTemplateControlPanelComponent,
    NshmpTemplateContentContainerComponent,
    NshmpTemplateMainContentComponent,
    NshmpTemplateAboutComponent,
    NshmpHazardProvisionalModelComponent,
    NshmpTemplateSettingsComponent,
    ControlPanelComponent,
    ContentComponent,
    PlotSettingsPanelComponent,
    AboutComponent,
    AsyncPipe,
  ],
  selector: 'app-app',
  styleUrl: './app.component.scss',
  templateUrl: './app.component.html',
})
export class AppComponent implements OnInit, AfterViewInit {
  service = inject(AppService);
  navService = inject(NavigationService);
  nshmpService = inject(NshmpService);
  private shepherdService = inject(ShepherdService);
  private nshmpTemplateService = inject(NshmpTemplateService);
  private tutorialService = inject(TutorialService);
  private destroyRef = inject(DestroyRef);
  /** Application title */
  title = apps().hazard.dynamic.display;
  private tutorialKey = 'hazard-dynamic-show-tutorial';
  ngOnInit(): void {
    this.nshmpService.applicationTitle = this.title;
    this.service.init();
    this.nshmpTemplateService
      .startTutorial()
      .pipe(takeUntilDestroyed(this.destroyRef))
      .subscribe(() => {
        this.shepherdService.start();
      });
  }
  ngAfterViewInit(): void {
    this.addSteps();
    this.tutorialService.start(this.tutorialKey);
  }
  private addSteps(): void {
    this.shepherdService.addSteps([
      // Intro
      this.tutorialService.introStep(
        this.title,
        `
          <p>
            The dynamic hazard curve application computes on-demand probabilisitic
            seismic hazard curves from a USGS national seismic hazard model (NSHM).
          </p>
        `,
      ),
      // Control panel
      this.tutorialService.controlPanelStep(),
      // Plot settings
      this.tutorialService.plotSettingsStep(),
      // Settings
      this.tutorialService.applicationSettingsStep(),
      // Nav menu
      this.tutorialService.navigationStep(),
      // Model
      this.tutorialService.nshmStep(),
      // Latitude
      this.tutorialService.latitudeStep(),
      // Longitude
      this.tutorialService.longitudeStep(),
      // Select site
      this.tutorialService.selectSiteStep(),
      // Site class
      this.tutorialService.siteClassStep(),
      // Return period
      this.tutorialService.returnPeriodStep(),
      // Source type
      {
        attachTo: {
          element: `.source-type-select ${this.tutorialService.matTextField}`,
          on: 'auto',
        },
        text: `
          <p>
            Select which earthquake source type to plot
          </p>
          <p>
            List updates when service is called
          </p>
        `,
        title: 'Source Type',
      },
      // IMT
      {
        ...this.tutorialService.imtStep(),
        text: 'Choose the Intensity Measure Type (IMT) to plot all sources for',
      },
      // Truncate curves
      this.tutorialService.truncateCurves(),
      // Max direction
      this.tutorialService.maxDirectionStep(),
      // Plot
      this.tutorialService.plotStep(),
      // Service calls
      this.tutorialService.serviceCallsStep(),
      // Reset
      this.tutorialService.resetControlPanelStep(),
      // Plot tab
      {
        attachTo: {
          element: '.plots-tab',
          on: 'auto',
        },
        text: 'Shows the plots',
        title: 'Plots Tab',
      },
      // Curve data tab
      {
        attachTo: {
          element: '.hazard-tab',
          on: 'auto',
        },
        text: 'Show the hazard curve data in tabular form',
        title: 'Hazard Curve Data Tab',
      },
      // Magnitudes data tab
      {
        attachTo: {
          element: '.magnitudes-tab',
          on: 'auto',
        },
        text: 'Show the magnitude curve data in tabular form',
        title: 'Magnitude Data Tab',
      },
      // Sources data tab
      {
        attachTo: {
          element: '.sources-tab',
          on: 'auto',
        },
        text: 'Show the source data in tabular form',
        title: 'Source Data Tab',
      },
      // Spectra tab
      {
        attachTo: {
          element: '.spectra-tab',
          on: 'auto',
        },
        text: 'Show the response spectrum data in tabular form',
        title: 'Response Spectrum Data',
      },
      // Complete
      this.tutorialService.completeStep(this.title),
    ]);
  }
}
    <nshmp-template [navigationList]="navService.navigationList()" [title]="title">
  <nshmp-template-content-container>
    <nshmp-template-control-panel>
      <app-control-panel />
    </nshmp-template-control-panel>
    <nshmp-template-main-content>
      <!-- Provisional model warning -->
      <nshmp-hazard-provisional-model [name]="service.usage()?.response?.model?.name" />
      <app-content />
    </nshmp-template-main-content>
    <nshmp-template-settings>
      <app-plot-settings-panel />
    </nshmp-template-settings>
  </nshmp-template-content-container>
  <!-- About page -->
  <nshmp-template-about
    [applicationName]="nshmpService.applicationName$ | async"
    [applicationVersion]="(nshmpService.versionInfo$ | async)?.version ?? ''"
  >
    <app-about />
  </nshmp-template-about>
</nshmp-template>