Skip to content

Commit

Permalink
feat(gui): put in a proper loading card
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 6, 2023
1 parent de48450 commit 3ec8f7c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions gui/src/components/LoadingCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Card, CardContent, CircularProgress } from '@mui/material';
import * as React from 'react';

export interface LoadingCardProps {
height: number;
width: number;
}

export function LoadingCard(props: LoadingCardProps) {
return <Card sx={{ maxWidth: props.width }}>
<CardContent sx={{ height: props.height }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: props.height }}>
<CircularProgress />
</div>
</CardContent>
</Card>;
}
3 changes: 2 additions & 1 deletion gui/src/components/MutationHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Grid } from '@mui/material';
import { useState } from 'react';
import * as React from 'react';
import { UseMutationResult } from 'react-query';
import { LoadingCard } from './LoadingCard';

export interface MutationHistoryProps<T> {
element: React.ComponentType<{value: T}>;
Expand All @@ -19,7 +20,7 @@ export function MutationHistory<T>(props: MutationHistoryProps<T>) {
const children = [];

if (status === 'loading') {
children.push(<div>Generating...</div>);
children.push(<LoadingCard height={512} width={512} />); // TODO: get dimensions from current request
}

if (status === 'success') {
Expand Down

0 comments on commit 3ec8f7c

Please sign in to comment.