Improves reports page with dynamic tab stats

Reorganizes stats rows to be dynamically shown/hidden based on active tab

Adds data attributes to enable tab-specific stats display
Enhances tab switching logic to toggle stats rows visibility
This commit is contained in:
Janus C. H. Knudsen 2026-01-22 00:19:19 +01:00
parent 0144e1ae17
commit 097fe7f912
2 changed files with 45 additions and 39 deletions

View file

@ -318,6 +318,7 @@ export class ReportsController {
private switchToTab(targetTab: string): void {
const tabs = document.querySelectorAll<HTMLElement>('swp-tab[data-tab]');
const contents = document.querySelectorAll<HTMLElement>('swp-tab-content[data-tab]');
const statsRows = document.querySelectorAll<HTMLElement>('swp-stats-row[data-for-tab]');
tabs.forEach(t => {
t.classList.toggle('active', t.dataset.tab === targetTab);
@ -326,6 +327,11 @@ export class ReportsController {
contents.forEach(content => {
content.classList.toggle('active', content.dataset.tab === targetTab);
});
// Toggle stats rows based on active tab
statsRows.forEach(stats => {
stats.classList.toggle('active', stats.dataset.forTab === targetTab);
});
}
/**