style(indicadores): homologar tarjetas y navegación de dominios
Homologa la presentación de figuras y tarjetas en TEA, CaCu y CaMa; recupera las leyendas superiores, permite la expansión independiente de Cómo leer y mueve la navegación de dominios a un selector compacto con resaltado institucional en la topbar. Preserva el comportamiento de Plotly y la interacción dona-barras.
This commit is contained in:
+18
-3
@@ -1,15 +1,29 @@
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { Component, ElementRef, inject, OnDestroy, OnInit, signal, ViewChild } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { Component, computed, ElementRef, inject, OnDestroy, OnInit, signal, ViewChild } from '@angular/core';
|
||||
import { NavigationEnd, Router, RouterLink, RouterOutlet } from '@angular/router';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { filter } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
imports: [RouterOutlet],
|
||||
imports: [RouterOutlet, RouterLink, MatButtonModule, MatMenuModule],
|
||||
selector: 'app-root',
|
||||
styleUrl: './app.scss',
|
||||
templateUrl: './app.html',
|
||||
})
|
||||
export class App implements OnInit, OnDestroy {
|
||||
protected readonly title = 'Plataforma de Indicadores';
|
||||
private readonly router = inject(Router);
|
||||
private readonly currentUrl = signal(this.router.url);
|
||||
protected readonly activeDomain = computed(() => {
|
||||
const match = /^\/indicadores\/(tea|cacu|cama)(?:\/|$)/.exec(this.currentUrl());
|
||||
return match?.[1] as 'tea' | 'cacu' | 'cama' | undefined;
|
||||
});
|
||||
protected readonly domainLabels = { tea: 'TEA', cacu: 'CaCu', cama: 'CaMa' } as const;
|
||||
protected readonly otherDomains = computed(() => (['tea', 'cacu', 'cama'] as const)
|
||||
.filter(domain => domain !== this.activeDomain()));
|
||||
private readonly routeSubscription = this.router.events.pipe(filter(event => event instanceof NavigationEnd))
|
||||
.subscribe(event => this.currentUrl.set(event.urlAfterRedirects));
|
||||
readonly showBackToTop = signal(false);
|
||||
@ViewChild('mainContent') private mainContent?: ElementRef<HTMLElement>;
|
||||
private readonly browserWindow = inject(DOCUMENT).defaultView;
|
||||
@@ -28,6 +42,7 @@ export class App implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.routeSubscription.unsubscribe();
|
||||
this.browserWindow?.removeEventListener('scroll', this.updateScroll);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user