feat(web): activity indicator while loading

This commit is contained in:
Paul Armstrong
2021-01-31 06:18:35 -06:00
committed by Blake Blackshear
parent cc7929932b
commit 45526a7652
8 changed files with 65 additions and 19 deletions
+4 -3
View File
@@ -1,9 +1,10 @@
import { h } from 'preact';
import ActivityIndicator from './components/ActivityIndicator';
import Box from './components/Box';
import Button from './components/Button';
import Heading from './components/Heading';
import Link from './components/Link';
import { useConfig, useStats } from './api';
import { FetchStatus, useConfig, useStats } from './api';
import { Table, Tbody, Thead, Tr, Th, Td } from './components/Table';
import { useCallback, useEffect, useState } from 'preact/hooks';
@@ -27,8 +28,8 @@ export default function Debug() {
}, [timeoutId]);
const { data: stats, status } = useStats(null, timeoutId);
if (!stats) {
return 'loading…';
if (stats === null && (status === FetchStatus.LOADING || status === FetchStatus.NONE)) {
return <ActivityIndicator />;
}
const { detectors, detection_fps, service, ...cameras } = stats;