Warning, /firebird/packages/firebird-ng/display/src/lib/components/firebird-shell/firebird-shell.component.ts is written in an unsupported language. File is not indexed.
0001 import { ChangeDetectionStrategy, Component, ViewChild, inject, model } from '@angular/core';
0002 import { Router } from '@angular/router';
0003 import { MatButtonModule } from '@angular/material/button';
0004 import { MatIconModule } from '@angular/material/icon';
0005 import { MatMenuModule } from '@angular/material/menu';
0006 import { MatTooltipModule } from '@angular/material/tooltip';
0007 import { ShellLayoutComponent } from '@dexvis/shell';
0008 import { ThemeSwitcherComponent } from '../theme-switcher/theme-switcher.component';
0009 import { APP_VERSION } from '@dexvis/firebird-ng/api';
0010 import { FIREBIRD_LOGO_URL } from './firebird-logo';
0011
0012 interface NavItem {
0013 label: string;
0014 route: string;
0015 external?: boolean;
0016 icon?: string;
0017 /** If true, shows up on wide screens directly. Otherwise in the logo menu. */
0018 alwaysVisible?: boolean;
0019 }
0020
0021 /**
0022 * Firebird app chrome: wraps the generic @dexvis/shell layout and contributes
0023 * the Firebird-specific parts (logo menu, navigation, version, theme switcher).
0024 *
0025 * Pages project content using the @dexvis/shell slot names:
0026 * [header], [mobile-header], [mobile-tools], [left-pane], [central-pane],
0027 * [right-pane], [footer-left], [footer-center], [footer-right].
0028 */
0029 @Component({
0030 selector: 'app-firebird-shell',
0031 standalone: true,
0032 templateUrl: './firebird-shell.component.html',
0033 styleUrls: ['./firebird-shell.component.scss'],
0034 changeDetection: ChangeDetectionStrategy.OnPush,
0035 imports: [
0036 ShellLayoutComponent,
0037 MatButtonModule,
0038 MatIconModule,
0039 MatMenuModule,
0040 MatTooltipModule,
0041 ThemeSwitcherComponent,
0042 ],
0043 })
0044 export class FirebirdShellComponent {
0045 /** Two-way bindable pane state, chained into the underlying shell layout. */
0046 readonly leftPaneVisible = model<boolean>(false);
0047 readonly rightPaneVisible = model<boolean>(false);
0048
0049 @ViewChild(ShellLayoutComponent) layout?: ShellLayoutComponent;
0050
0051 readonly logoUrl = FIREBIRD_LOGO_URL;
0052
0053 /** The application's version (withAppVersion); null hides the menu entry. */
0054 readonly appVersion = inject(APP_VERSION, { optional: true });
0055
0056 navItems: NavItem[] = [
0057 { label: 'Help', route: 'https://eic.github.io/firebird/', external: true, icon: 'menu_book', alwaysVisible: true },
0058 { label: 'Display', route: '/display', icon: 'monitor', alwaysVisible: true },
0059 { label: 'Configure', route: '/config', icon: 'tune', alwaysVisible: true },
0060 { label: 'GitHub Repo', route: 'https://github.com/eic/firebird', external: true, icon: 'code' },
0061 { label: 'Submit Ideas', route: 'https://github.com/eic/firebird/issues', external: true, icon: 'feedback' },
0062 ];
0063
0064 get primaryNavItems(): NavItem[] {
0065 return this.navItems.filter(i => i.alwaysVisible);
0066 }
0067
0068 get overflowNavItems(): NavItem[] {
0069 return this.navItems.filter(i => !i.alwaysVisible);
0070 }
0071
0072 constructor(private router: Router) {}
0073
0074 onNavItemClick(item: NavItem): void {
0075 if (item.external) {
0076 window.open(item.route, '_blank');
0077 } else {
0078 this.router.navigate([item.route]);
0079 }
0080 }
0081
0082 toggleLeftPane(): void {
0083 this.leftPaneVisible.update(v => !v);
0084 }
0085
0086 toggleRightPane(): void {
0087 this.rightPaneVisible.update(v => !v);
0088 }
0089 }