forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseFleetChartPreferences.ts
More file actions
132 lines (124 loc) · 3.15 KB
/
Copy pathuseFleetChartPreferences.ts
File metadata and controls
132 lines (124 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// src/components/dashboard/useFleetChartPreferences.ts
"use client"
import { useChartPreferencesBase } from "@/hooks/useChartPreferencesBase"
import { STORAGE_KEYS } from "@/lib/storage-keys"
export interface FleetChartDef {
id: string
label: string
description?: string
}
export const FLEET_CHARTS: FleetChartDef[] = [
{
id: "fleet-speed-sparklines",
label: "Live Speeds",
description: "Real-time per-client upload/download sparklines",
},
{
id: "speed-theme-river",
label: "Speed River",
description: "Upload speed flow per tracker over time",
},
{
id: "seeding-count-trends",
label: "Seeding Trends",
description: "Stacked seeding count per tracker over time",
},
{
id: "leeching-trends",
label: "Leeching Trends",
description: "Leeching activity per tracker over time",
},
{
id: "speed-history",
label: "Speed History",
description: "Upload vs download speed over time",
},
{ id: "fleet-stat-cards", label: "Fleet Stats", description: "Aggregate fleet metrics" },
{
id: "fleet-ratio-distribution",
label: "Ratio Distribution",
description: "Fleet-wide ratio histogram",
},
{
id: "fleet-cross-seed-donut",
label: "Cross-Seed Coverage",
description: "Cross-seeded vs unique torrents",
},
{
id: "cross-seed-network",
label: "Cross-Seed Network",
description: "Force-directed graph showing cross-seed relationships between trackers",
},
{
id: "tracker-health-radar",
label: "Tracker Health",
description: "Per-tracker health comparison radar",
},
{
id: "fleet-activity-heatmap",
label: "Activity Heatmap",
description: "When torrents are added (day x hour)",
},
{
id: "fleet-storage-treemap",
label: "Storage Breakdown",
description: "Storage by tracker and category",
},
{
id: "fleet-seed-time-distribution",
label: "Seed Time Distribution",
description: "Seed time histogram",
},
{
id: "fleet-age-bands",
label: "Age Distribution",
description: "Torrent count per age band per tracker",
},
{
id: "fleet-age-timeline",
label: "Library Growth",
description: "Cumulative torrent count over time",
},
{
id: "fleet-category-timeline",
label: "Categories Over Time",
description: "Cumulative torrents per qBT category",
},
{
id: "fleet-size-jitter",
label: "Size Scatter",
description: "Torrent size distribution per tracker",
},
{
id: "fleet-category-breakdown",
label: "Category Mix",
description: "Normalized category breakdown per tracker",
},
]
interface FleetChartPrefs {
hidden: string[]
collapsed: string[]
}
const EMPTY_PREFS: FleetChartPrefs = { hidden: [], collapsed: [] }
export function useFleetChartPreferences() {
const {
hydrated,
isHidden,
isCollapsed,
toggleHidden,
toggleCollapsed,
setVisible,
collapseAll,
allVisibleCollapsed,
} = useChartPreferencesBase<FleetChartPrefs>(STORAGE_KEYS.FLEET_CHART_PREFERENCES, EMPTY_PREFS)
return {
hydrated,
isHidden,
isCollapsed,
toggleHidden,
toggleCollapsed,
setVisible,
collapseAll,
allVisibleCollapsed,
}
}