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:
+2
-2
@@ -2,7 +2,7 @@ import {Component, effect, inject, OnDestroy} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {BaseChartDirective} from 'ng2-charts';
|
||||
import {BehaviorSubject, Observable} from 'rxjs';
|
||||
import {Chart, ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {Chart, ChartConfiguration, ChartData, TooltipModel} from 'chart.js';
|
||||
import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
@@ -485,7 +485,7 @@ export class AuthorUniverseChartComponent implements OnDestroy {
|
||||
return insights;
|
||||
}
|
||||
|
||||
private handleExternalTooltip(context: { chart: Chart; tooltip: any }): void {
|
||||
private handleExternalTooltip(context: { chart: Chart; tooltip: TooltipModel<'bubble'> }): void {
|
||||
const {chart, tooltip} = context;
|
||||
let tooltipEl = document.getElementById('author-chart-tooltip');
|
||||
|
||||
|
||||
+6
-1
@@ -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]})`,
|
||||
|
||||
+4
-2
@@ -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;
|
||||
|
||||
+5
-1
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user