Fix TypeScript compilation errors: add missing state variables and fix type issues
Browse files
backend/model_counts.db
ADDED
|
Binary file (20.5 kB). View file
|
|
|
frontend/src/App.tsx
CHANGED
|
@@ -51,6 +51,8 @@ function App() {
|
|
| 51 |
const [searchQuery, setSearchQuery] = useState('');
|
| 52 |
const [colorBy, setColorBy] = useState('library_name');
|
| 53 |
const [sizeBy, setSizeBy] = useState('downloads');
|
|
|
|
|
|
|
| 54 |
|
| 55 |
const activeFilterCount = (minDownloads > 0 ? 1 : 0) +
|
| 56 |
(minLikes > 0 ? 1 : 0) +
|
|
|
|
| 51 |
const [searchQuery, setSearchQuery] = useState('');
|
| 52 |
const [colorBy, setColorBy] = useState('library_name');
|
| 53 |
const [sizeBy, setSizeBy] = useState('downloads');
|
| 54 |
+
const [colorScheme, setColorScheme] = useState<'viridis' | 'plasma' | 'inferno' | 'magma' | 'cividis'>('viridis');
|
| 55 |
+
const [showLegend, setShowLegend] = useState(true);
|
| 56 |
|
| 57 |
const activeFilterCount = (minDownloads > 0 ? 1 : 0) +
|
| 58 |
(minLikes > 0 ? 1 : 0) +
|
frontend/src/components/ModelCountTracker.tsx
CHANGED
|
@@ -125,7 +125,7 @@ export default function ModelCountTracker() {
|
|
| 125 |
</div>
|
| 126 |
</div>
|
| 127 |
|
| 128 |
-
{growthStats &&
|
| 129 |
<div className="growth-stats">
|
| 130 |
<h4>Growth (Last {growthStats.period_days} Days)</h4>
|
| 131 |
<div className="stats-grid">
|
|
|
|
| 125 |
</div>
|
| 126 |
</div>
|
| 127 |
|
| 128 |
+
{growthStats && (
|
| 129 |
<div className="growth-stats">
|
| 130 |
<h4>Growth (Last {growthStats.period_days} Days)</h4>
|
| 131 |
<div className="stats-grid">
|
frontend/src/components/PaperPlots.tsx
CHANGED
|
@@ -214,6 +214,8 @@ export default function PaperPlots({ data, width = 800, height = 600 }: PaperPlo
|
|
| 214 |
const x = xScale(label);
|
| 215 |
const bandWidth = xScale.bandwidth();
|
| 216 |
|
|
|
|
|
|
|
| 217 |
// Calculate quartiles
|
| 218 |
const sorted = dataset.sort((a, b) => a - b);
|
| 219 |
const q1 = d3.quantile(sorted, 0.25) || 0;
|
|
@@ -594,8 +596,11 @@ export default function PaperPlots({ data, width = 800, height = 600 }: PaperPlo
|
|
| 594 |
count: d.total_models
|
| 595 |
})).sort((a: any, b: any) => a.date - b.date);
|
| 596 |
|
|
|
|
|
|
|
|
|
|
| 597 |
const xScale = d3.scaleTime()
|
| 598 |
-
.domain(
|
| 599 |
.range([0, innerWidth]);
|
| 600 |
|
| 601 |
const yScale = d3.scaleLinear()
|
|
@@ -619,11 +624,11 @@ export default function PaperPlots({ data, width = 800, height = 600 }: PaperPlo
|
|
| 619 |
.data(counts)
|
| 620 |
.enter()
|
| 621 |
.append('circle')
|
| 622 |
-
.attr('cx', d => xScale(d.date))
|
| 623 |
-
.attr('cy', d => yScale(d.count))
|
| 624 |
.attr('r', 3)
|
| 625 |
.attr('fill', '#4a90e2')
|
| 626 |
-
.on('mouseover', function(event, d) {
|
| 627 |
d3.select(this).attr('r', 5);
|
| 628 |
const tooltip = d3.select('body').append('div')
|
| 629 |
.attr('class', 'plot-tooltip')
|
|
|
|
| 214 |
const x = xScale(label);
|
| 215 |
const bandWidth = xScale.bandwidth();
|
| 216 |
|
| 217 |
+
if (x === undefined) return;
|
| 218 |
+
|
| 219 |
// Calculate quartiles
|
| 220 |
const sorted = dataset.sort((a, b) => a - b);
|
| 221 |
const q1 = d3.quantile(sorted, 0.25) || 0;
|
|
|
|
| 596 |
count: d.total_models
|
| 597 |
})).sort((a: any, b: any) => a.date - b.date);
|
| 598 |
|
| 599 |
+
const extent = d3.extent(counts, (d: any) => d.date);
|
| 600 |
+
if (!extent[0] || !extent[1]) return;
|
| 601 |
+
|
| 602 |
const xScale = d3.scaleTime()
|
| 603 |
+
.domain(extent as [Date, Date])
|
| 604 |
.range([0, innerWidth]);
|
| 605 |
|
| 606 |
const yScale = d3.scaleLinear()
|
|
|
|
| 624 |
.data(counts)
|
| 625 |
.enter()
|
| 626 |
.append('circle')
|
| 627 |
+
.attr('cx', (d: any) => xScale(d.date))
|
| 628 |
+
.attr('cy', (d: any) => yScale(d.count))
|
| 629 |
.attr('r', 3)
|
| 630 |
.attr('fill', '#4a90e2')
|
| 631 |
+
.on('mouseover', function(event, d: any) {
|
| 632 |
d3.select(this).attr('r', 5);
|
| 633 |
const tooltip = d3.select('body').append('div')
|
| 634 |
.attr('class', 'plot-tooltip')
|