diff --git a/src/app/features/indicadores/indicador-catalog-card.ts b/src/app/features/indicadores/indicador-catalog-card.ts index 8907d40..2fb7572 100644 --- a/src/app/features/indicadores/indicador-catalog-card.ts +++ b/src/app/features/indicadores/indicador-catalog-card.ts @@ -34,11 +34,13 @@ import { IndicadorConteosPareados } from './indicador-conteos-pareados';

{{ indicador.titulo }}

- + @if (fijable) { + + }
@if (isEu7) {
@@ -154,6 +156,8 @@ export class IndicadorCatalogCard implements OnChanges, OnDestroy { @Input({ required: true }) applied!: GlobalApplied; @Input() independentPeriods = false; @Input() pinned = false; + // Pinning reorders a long grid; with a few cards there is nothing to bring forward. + @Input() fijable = true; @Input() visualProfile: FigureVisualProfile = READABLE_VISUAL_PROFILE; readonly pinChanged = output(); @ViewChild('visibilityRegion') visibilityRegion?: ElementRef; diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html index 4051f2e..e1b09c0 100644 --- a/src/app/features/indicadores/indicadores-page.html +++ b/src/app/features/indicadores/indicadores-page.html @@ -112,7 +112,7 @@
@for (item of searchResults().items; track cardIdentity(item)) { + [pinned]="isPinned(item)" [fijable]="searchVisible()" (pinChanged)="togglePinned(item)" /> }
} diff --git a/src/app/features/indicadores/indicadores-page.spec.ts b/src/app/features/indicadores/indicadores-page.spec.ts index 60a2c4d..8dc7a47 100644 --- a/src/app/features/indicadores/indicadores-page.spec.ts +++ b/src/app/features/indicadores/indicadores-page.spec.ts @@ -132,7 +132,8 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => { expect(header.querySelector('h2')?.textContent).toBe(title); expect(header.querySelector('.card-identity button')).toBeNull(); expect(header.querySelector('button')).toBeNull(); - expect(fixture.nativeElement.querySelector('.pin-toggle').getAttribute('aria-label')).toContain(title); + // Two cards: no pin button (it shows from MIN_BUSQUEDA indicators, see indicadores-pinning.spec.ts). + expect(fixture.nativeElement.querySelector('.pin-toggle')).toBeNull(); http.expectNone(() => true); }); it('UX-06B mantiene una sola navegación entre dominios, sin duplicar botones', () => { diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts index 2427232..a5919e5 100644 --- a/src/app/features/indicadores/indicadores-page.ts +++ b/src/app/features/indicadores/indicadores-page.ts @@ -331,6 +331,8 @@ export class IndicadoresPage { readonly searchResults = computed(() => { const selected = new Set(this.selectedIndicators()); const items = this.catalogOrder().filter(item => selected.has(item.id)); + // Below MIN_BUSQUEDA there are no pin buttons, so saved pins don't reorder the cards either. + if (!this.searchVisible()) return { items }; return { items: [...items.filter(item => this.isPinned(item)), ...items.filter(item => !this.isPinned(item))] }; }); readonly catalogLoading = signal(true);