ui/StatsPage.tsx aktualisiert

Make the counters update faster to make it look more snappy.
This commit is contained in:
Akiru 2024-01-25 08:53:35 +00:00
parent 85bd9b5861
commit 128c4312d4
1 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@ export function StatsPage() {
const getGlobalStats = useSWR( const getGlobalStats = useSWR(
["/stats", {}] as const, ["/stats", {}] as const,
(args) => fetchApi(...args).then(handleResponse), (args) => fetchApi(...args).then(handleResponse),
{ refreshInterval: 2_000 }, { refreshInterval: 1_00 },
); );
return ( return (
@ -18,13 +18,13 @@ export function StatsPage() {
className="font-bold text-zinc-700 dark:text-zinc-300" className="font-bold text-zinc-700 dark:text-zinc-300"
value={getGlobalStats.data?.pixelStepCount ?? 0} value={getGlobalStats.data?.pixelStepCount ?? 0}
digits={15} digits={15}
transitionDurationMs={3_000} transitionDurationMs={1_00}
/> />
<Counter <Counter
className="text-base" className="text-base"
value={(getGlobalStats.data?.pixelStepsPerMinute ?? 0) / 60} value={(getGlobalStats.data?.pixelStepsPerMinute ?? 0) / 60}
digits={9} digits={9}
transitionDurationMs={2_000} transitionDurationMs={1_00}
postfix="/s" postfix="/s"
/> />
</p> </p>
@ -34,13 +34,13 @@ export function StatsPage() {
className="font-bold text-zinc-700 dark:text-zinc-300" className="font-bold text-zinc-700 dark:text-zinc-300"
value={getGlobalStats.data?.pixelCount ?? 0} value={getGlobalStats.data?.pixelCount ?? 0}
digits={15} digits={15}
transitionDurationMs={3_000} transitionDurationMs={1_00}
/> />
<Counter <Counter
className="text-base" className="text-base"
value={(getGlobalStats.data?.pixelsPerMinute ?? 0) / 60} value={(getGlobalStats.data?.pixelsPerMinute ?? 0) / 60}
digits={9} digits={9}
transitionDurationMs={2_000} transitionDurationMs={1_00}
postfix="/s" postfix="/s"
/> />
</p> </p>
@ -51,14 +51,14 @@ export function StatsPage() {
className="font-bold text-zinc-700 dark:text-zinc-300" className="font-bold text-zinc-700 dark:text-zinc-300"
value={getGlobalStats.data?.stepCount ?? 0} value={getGlobalStats.data?.stepCount ?? 0}
digits={9} digits={9}
transitionDurationMs={3_000} transitionDurationMs={1_00}
/> />
<Counter <Counter
className="text-base" className="text-base"
value={(getGlobalStats.data?.stepsPerMinute ?? 0) / 60} value={(getGlobalStats.data?.stepsPerMinute ?? 0) / 60}
digits={3} digits={3}
fractionDigits={3} fractionDigits={3}
transitionDurationMs={2_000} transitionDurationMs={1_00}
postfix="/s" postfix="/s"
/> />
</p> </p>
@ -68,14 +68,14 @@ export function StatsPage() {
className="font-bold text-zinc-700 dark:text-zinc-300" className="font-bold text-zinc-700 dark:text-zinc-300"
value={getGlobalStats.data?.imageCount ?? 0} value={getGlobalStats.data?.imageCount ?? 0}
digits={9} digits={9}
transitionDurationMs={3_000} transitionDurationMs={1_00}
/> />
<Counter <Counter
className="text-base" className="text-base"
value={(getGlobalStats.data?.imagesPerMinute ?? 0) / 60} value={(getGlobalStats.data?.imagesPerMinute ?? 0) / 60}
digits={3} digits={3}
fractionDigits={3} fractionDigits={3}
transitionDurationMs={2_000} transitionDurationMs={1_00}
postfix="/s" postfix="/s"
/> />
</p> </p>
@ -86,7 +86,7 @@ export function StatsPage() {
className="font-bold text-zinc-700 dark:text-zinc-300" className="font-bold text-zinc-700 dark:text-zinc-300"
value={getGlobalStats.data?.userCount ?? 0} value={getGlobalStats.data?.userCount ?? 0}
digits={6} digits={6}
transitionDurationMs={1_500} transitionDurationMs={1_00}
/> />
</p> </p>
</div> </div>