Skip to content

Commit afbf8e1

Browse files
authored
changed to cirular progress (#148)
* changed to cirular progress * codeRabbit suggestions
1 parent d3462d7 commit afbf8e1

File tree

5 files changed

+12
-45
lines changed

5 files changed

+12
-45
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@
355355
"kbar": "0.1.0-beta.40",
356356
"lodash": "4.17.21",
357357
"logfmt": "^1.3.2",
358-
"lottie-react": "^2.4.0",
359358
"lru-cache": "10.0.0",
360359
"lru-memoize": "^1.1.0",
361360
"marked": "5.1.1",

public/app/features/dashboard/components/DashboardLoading/FnLoader.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import { Box, Typography, type BoxProps } from '@mui/material';
2-
import Lottie, { type LottieComponentProps } from 'lottie-react';
1+
import { Box, CircularProgress, CircularProgressProps, Typography, type BoxProps } from '@mui/material';
32
import React, { type ReactNode, type FC, type HTMLAttributes } from 'react';
43

54
import logoUrl from './fn-logo.svg';
6-
import logoLoader from './fn-lottie-loader.json';
75

86
export type FnLoaderProps = {
97
outerContainerProps?: Omit<BoxProps, 'children'>;
108
innerContainerProps?: Omit<BoxProps, 'children'>;
11-
lottieProps?: LottieComponentProps;
9+
circularProgressProps?: CircularProgressProps;
1210
imageProps?: HTMLAttributes<HTMLImageElement>;
1311
text?: ReactNode;
1412
};
1513

1614
export const FnLoader: FC<FnLoaderProps> = ({
1715
outerContainerProps,
1816
innerContainerProps,
19-
lottieProps,
17+
circularProgressProps,
2018
imageProps,
2119
text,
2220
}) => (
@@ -30,11 +28,12 @@ export const FnLoader: FC<FnLoaderProps> = ({
3028
>
3129
<img src={logoUrl} alt={'FluxNinja logo'} style={{ transform: 'scale(4)' }} {...imageProps} />
3230
<Box marginTop="100px" {...innerContainerProps}>
33-
<Lottie
34-
animationData={logoLoader}
31+
<CircularProgress
32+
role="alert"
33+
aria-busy="true"
3534
aria-label="Loading..."
36-
style={{ maxWidth: '150px', margin: '0 auto' }}
37-
{...lottieProps}
35+
disableShrink
36+
{...circularProgressProps}
3837
/>
3938
</Box>
4039
{typeof text === 'string' ? <Typography>{text}</Typography> : text || null}

public/app/features/dashboard/components/DashboardLoading/fn-lottie-loader.json

-1
This file was deleted.

public/app/fn-app/fn-app-provider.tsx

+4-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { config, navigationLogger } from '@grafana/runtime';
66
import { ErrorBoundaryAlert, GlobalStyles } from '@grafana/ui';
77
import { loadAndInitAngularIfEnabled } from 'app/angular/loadAndInitAngularIfEnabled';
88
import { ThemeProvider } from 'app/core/utils/ConfigProvider';
9+
import { FnLoader } from 'app/features/dashboard/components/DashboardLoading/FnLoader';
910
import { store } from 'app/store/store';
1011

1112
import { GrafanaContext } from '../core/context/GrafanaContext';
@@ -16,32 +17,21 @@ import { FNDashboardProps } from './types';
1617
type FnAppProviderProps = Pick<FNDashboardProps, 'fnError'>;
1718

1819
export const FnAppProvider: FC<PropsWithChildren<FnAppProviderProps>> = (props) => {
19-
const { children, fnError = null } = props;
20+
const { children } = props;
2021

2122
const [ready, setReady] = useState(false);
2223
navigationLogger('AppWrapper', false, 'rendering');
2324
useEffect(() => {
2425
loadAndInitAngularIfEnabled()
2526
.then(() => {
2627
setReady(true);
27-
// $('.preloader').remove();
2828
})
2929
.catch((err) => console.error(err));
3030
return () => {};
3131
}, []);
3232

33-
if (!ready) {
34-
/**
35-
* TODO: I think loader would be better
36-
*/
37-
return <>{fnError}</>;
38-
}
39-
40-
if (!store) {
41-
/**
42-
* TODO: I think loader would be better
43-
*/
44-
return <>{fnError}</>;
33+
if (!store || !ready) {
34+
return <FnLoader />;
4535
}
4636

4737
return (

yarn.lock

-20
Original file line numberDiff line numberDiff line change
@@ -19954,7 +19954,6 @@ __metadata:
1995419954
lint-staged: 13.2.3
1995519955
lodash: 4.17.21
1995619956
logfmt: ^1.3.2
19957-
lottie-react: ^2.4.0
1995819957
lru-cache: 10.0.0
1995919958
lru-memoize: ^1.1.0
1996019959
marked: 5.1.1
@@ -23542,25 +23541,6 @@ __metadata:
2354223541
languageName: node
2354323542
linkType: hard
2354423543

23545-
"lottie-react@npm:^2.4.0":
23546-
version: 2.4.0
23547-
resolution: "lottie-react@npm:2.4.0"
23548-
dependencies:
23549-
lottie-web: ^5.10.2
23550-
peerDependencies:
23551-
react: ^16.8.0 || ^17.0.0 || ^18.0.0
23552-
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
23553-
checksum: e9ea4a89be90a29bde4a83956f76a80d1f8031882f18ea38ef5271d2aafd8e68348ae6297f185ed85b149ca4896fe33aee7faf9780b88a1b289b8e146f477448
23554-
languageName: node
23555-
linkType: hard
23556-
23557-
"lottie-web@npm:^5.10.2":
23558-
version: 5.12.2
23559-
resolution: "lottie-web@npm:5.12.2"
23560-
checksum: af5bc3bc405fd760de8b17a36158d5a8c3e8c586c711d0c63681ddf056b65bc6b54ea36b1fcad782fb02dbe12e696a40e0ba72daf41b8f10ab5b5d1113793636
23561-
languageName: node
23562-
linkType: hard
23563-
2356423544
"lower-case@npm:^2.0.2":
2356523545
version: 2.0.2
2356623546
resolution: "lower-case@npm:2.0.2"

0 commit comments

Comments
 (0)