Skip to content

Commit 9d791c6

Browse files
authored
Merge pull request #257 from dgageot/simpler-progress
Simplify the progress bar
2 parents eb2e418 + 542fec1 commit 9d791c6

File tree

1 file changed

+19
-68
lines changed

1 file changed

+19
-68
lines changed

src/extension/ui/src/components/LoadingState.tsx

Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import {
22
Box,
3-
CircularProgress,
43
Fade,
54
LinearProgress,
65
Paper,
76
Stack,
8-
Typography,
7+
Typography
98
} from '@mui/material';
109
import { useEffect, useState } from 'react';
1110

@@ -17,8 +16,7 @@ const LoadingState: React.FC<LoadingStateProps> = ({ appProps }) => {
1716
const { configLoading, secretsLoading, catalogLoading, registryLoading } =
1817
appProps;
1918
const [progress, setProgress] = useState(0);
20-
const isLoading =
21-
configLoading || secretsLoading || catalogLoading || registryLoading;
19+
const isLoading = configLoading || secretsLoading || catalogLoading || registryLoading;
2220

2321
useEffect(() => {
2422
const progress = [
@@ -54,78 +52,31 @@ const LoadingState: React.FC<LoadingStateProps> = ({ appProps }) => {
5452
left: 0,
5553
right: 0,
5654
bottom: 0,
57-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
5855
display: 'flex',
5956
alignItems: 'center',
6057
justifyContent: 'center',
6158
zIndex: 1200,
6259
}}
6360
>
64-
<Paper
65-
elevation={4}
66-
sx={{
67-
maxWidth: '500px',
68-
width: '90%',
69-
p: 3,
70-
borderRadius: 2,
71-
backgroundColor: 'background.paper',
72-
overflow: 'hidden',
73-
}}
74-
>
75-
<Stack spacing={2} alignItems="center" width="100%">
76-
<Typography variant="h6" fontWeight="medium" textAlign="center">
77-
{getLoadingText()}
78-
</Typography>
61+
<Stack spacing={2} alignItems="center" width="100%">
62+
<Typography variant="h6" fontWeight="medium" textAlign="center">
63+
{getLoadingText()}
64+
</Typography>
7965

80-
<Box
81-
position="relative"
82-
display="flex"
83-
alignItems="center"
84-
justifyContent="center"
85-
my={1}
86-
>
87-
<CircularProgress
88-
variant="determinate"
89-
value={100}
90-
size={80}
91-
thickness={4}
92-
sx={{ color: 'rgba(0, 0, 0, 0.1)' }}
93-
/>
94-
<CircularProgress
95-
variant="determinate"
96-
value={progress}
97-
size={80}
98-
thickness={4}
99-
sx={{
100-
color: 'primary.main',
101-
position: 'absolute',
102-
left: 0,
103-
}}
104-
/>
105-
<Typography
106-
variant="h6"
107-
component="div"
108-
sx={{ position: 'absolute' }}
109-
>
110-
{progress}%
111-
</Typography>
112-
</Box>
113-
114-
<LinearProgress
115-
sx={{
116-
width: '100%',
117-
height: 8,
66+
<LinearProgress
67+
sx={{
68+
width: '60%',
69+
height: 8,
70+
borderRadius: 4,
71+
'& .MuiLinearProgress-bar': {
11872
borderRadius: 4,
119-
'& .MuiLinearProgress-bar': {
120-
borderRadius: 4,
121-
transition: 'transform 0.4s ease',
122-
},
123-
}}
124-
variant="determinate"
125-
value={progress}
126-
/>
127-
</Stack>
128-
</Paper>
73+
transition: 'transform 0.4s ease',
74+
},
75+
}}
76+
variant="determinate"
77+
value={progress}
78+
/>
79+
</Stack>
12980
</Box>
13081
</Fade>
13182
);

0 commit comments

Comments
 (0)