chore(ui): clear settings and stats any bucket

Replace low-risk any usages in settings flows, paginator state handling, and chart helper code with concrete local types.

Leave the remaining no-explicit-any backlog isolated to reader-specific files for the next passes.

Validation: just ui lint
This commit is contained in:
James Cox
2026-04-22 17:26:50 -04:00
committed by Zach Yale
parent f7a5d939ae
commit 3700e356b4
9 changed files with 43 additions and 15 deletions
@@ -14,6 +14,10 @@ interface ReadingStatusStats {
percentage: number;
}
interface DatasetMetaPoint {
hidden?: boolean;
}
const STATUS_COLOR_MAP: Record<string, string> = {
[ReadStatus.UNREAD]: '#6c757d',
[ReadStatus.READING]: '#17a2b8',
@@ -206,9 +210,10 @@ export class ReadStatusChartComponent {
const dataValues = dataset.data as number[];
return data.labels.map((label: unknown, index: number) => {
const metaPoint = chart.getDatasetMeta(0)?.data?.[index] as DatasetMetaPoint | undefined;
const isVisible = typeof chart.getDataVisibility === 'function'
? chart.getDataVisibility(index)
: !((chart.getDatasetMeta && (chart.getDatasetMeta(0)?.data?.[index] as any)?.hidden) || false);
: !(metaPoint?.hidden || false);
return {
text: `${String(label)} (${dataValues[index]})`,
@@ -6,6 +6,8 @@ import {ChartConfiguration, ChartData} from 'chart.js';
import {BookService} from '../../../../../book/service/book.service';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
type ReadingDebtChartData = ChartData<'bar' | 'line', number[], string>;
@Component({
selector: 'app-reading-debt-chart',
standalone: true,
@@ -29,7 +31,7 @@ export class ReadingDebtChartComponent {
public currentBacklog = 0;
public trend = '';
public chartData: ChartData<'bar', number[], string> = {labels: [], datasets: []};
public chartData: ReadingDebtChartData = {labels: [], datasets: []};
public chartOptions: ChartConfiguration<'bar'>['options'] = {
responsive: true,
@@ -157,7 +159,7 @@ export class ReadingDebtChartComponent {
tension: 0.3,
yAxisID: 'y1',
order: 1
} as any
} as ReadingDebtChartData['datasets'][number]
]
};
this.hasData = true;
@@ -20,6 +20,10 @@ interface YearMonthData {
count: number;
}
interface YScaleWithMax {
max?: number;
}
const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
type HeatmapChartData = ChartData<'matrix', MatrixDataPoint[], string>;
@@ -158,7 +162,7 @@ export class ReadingHeatmapChartComponent {
});
if (this.chartOptions?.scales?.['y']) {
(this.chartOptions.scales['y'] as any).max = years.length - 1;
(this.chartOptions.scales['y'] as YScaleWithMax).max = years.length - 1;
}
this.chartDataSubject.next({