From 88815b353724f71449943ac047a278c11b506e3e Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 4 Feb 2023 12:23:51 -0600 Subject: [PATCH] fix(api): show indeterminate spinner until progress has been determined --- gui/src/components/LoadingCard.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gui/src/components/LoadingCard.tsx b/gui/src/components/LoadingCard.tsx index f05dcd0d..26186cf2 100644 --- a/gui/src/components/LoadingCard.tsx +++ b/gui/src/components/LoadingCard.tsx @@ -1,5 +1,6 @@ import { doesExist, mustExist } from '@apextoaster/js-utils'; import { Box, Button, Card, CardContent, CircularProgress, Typography } from '@mui/material'; +import { Stack } from '@mui/system'; import * as React from 'react'; import { useContext, useEffect } from 'react'; import { useMutation, useQuery } from 'react-query'; @@ -51,6 +52,14 @@ export function LoadingCard(props: LoadingCardProps) { return doesExist(ready.data) && ready.data.ready; } + function renderProgress() { + if (ready.status === 'success') { + return ; + } else { + return ; + } + } + useEffect(() => { if (cancel.status === 'success') { clearLoading(); @@ -75,9 +84,15 @@ export function LoadingCard(props: LoadingCardProps) { justifyContent: 'center', minHeight: params.height.default, }}> - - {getProgress()} of {props.loading.params.steps} - + + {renderProgress()} + {getProgress()} of {props.loading.params.steps} + + ;