diff --git a/src/pages/stats.tsx b/src/pages/stats.tsx index 886af8eb0d..64bf268b8f 100644 --- a/src/pages/stats.tsx +++ b/src/pages/stats.tsx @@ -2,7 +2,9 @@ import React, { useState, useEffect } from 'react'; import HomepageFeature from '../components/HomepageFeature'; import BetaflightLayout from '../components/Layout'; import { ResponsiveLine } from '@nivo/line'; -import { theme } from './nivoTheme.js'; +import { themeLight } from '../theme/nivoThemeLight.js'; +import { themeDark } from '../theme/nivoThemeDark.js'; +import { useColorMode } from '@docusaurus/theme-common'; interface Volume { date: string @@ -31,28 +33,23 @@ async function getStats() { const stats = await fetch(`https://build.betaflight.com/api/stats`).then((res) => res.json()); const data = stats.volumes.map((volume: Volume) => ({ x: new Date(volume.date).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }), - y: volume.cached, + y: volume.cached + volume.built, })); - data.reverse(); const targets = stats.volumes[0].targets.map((target: Target) => ({ id: target.name, - data: stats.volumes - .map((volume: Volume) => ({ - x: new Date(volume.date).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }), - y: volume.targets.find((t: Target) => t.name === target.name)?.volume, - })) - .reverse(), + data: stats.volumes.map((volume: Volume) => ({ + x: new Date(volume.date).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }), + y: volume.targets.find((t: Target) => t.name === target.name)?.volume, + })), })); const releases = stats.volumes[0].releases.map((release: Release) => ({ id: release.name, - data: stats.volumes - .map((volume: Volume) => ({ - x: new Date(volume.date).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }), - y: volume.releases.find((r: Release) => r.name === release.name)?.volume, - })) - .reverse(), + data: stats.volumes.map((volume: Volume) => ({ + x: new Date(volume.date).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }), + y: volume.releases.find((r: Release) => r.name === release.name)?.volume, + })), })); targets.length = 5; @@ -65,13 +62,9 @@ async function getStats() { }; } -type Props = { - children?: React.ReactNode -} - const Tooltip = ({ point, children }) => { return ( -