Skip to content

Commit

Permalink
Merge pull request #58 from UNIwise/feature/MP-2539-Add-skeleton-loading
Browse files Browse the repository at this point in the history
Feature/mp 2539 add skeleton loading
  • Loading branch information
chopachop authored Jul 31, 2024
2 parents 126210e + 5dfca89 commit aab9c0b
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 117 deletions.
6 changes: 3 additions & 3 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.24.0",
"react-router-dom": "^6.24.0",
"react-toastify": "^10.0.5"
"react-router-dom": "^6.24.0"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.43.1",
Expand All @@ -50,6 +49,7 @@
"prettier": "^3.3.2",
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vitest": "^1.6.0"
"vitest": "^1.6.0",
"sass": "^1.77.8"
}
}
101 changes: 76 additions & 25 deletions dashboard/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dashboard/src/api/client/axios.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import AxiosMockAdapter from 'axios-mock-adapter';
import { ENV } from '../../constants/env';
import registerLoggerInterceptor from '../interceptors/logger';
import axios from "axios";
import AxiosMockAdapter from "axios-mock-adapter";
import { ENV } from "../../constants/env";
import registerLoggerInterceptor from "../interceptors/logger";

// Mock axios instance
const mockInstance = axios.create();
Expand All @@ -15,7 +15,7 @@ export const mock = new AxiosMockAdapter(mockInstance, {
const realInstance = axios.create();

if (ENV.MOCKED) {
console.debug('Using mocked axios client');
console.debug("Using mocked axios client");
}

export default ENV.MOCKED ? mockInstance : realInstance;
3 changes: 1 addition & 2 deletions dashboard/src/api/client/query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import { AxiosError } from "axios";
import { StatusCodes } from "http-status-codes";
import { FC, ReactNode } from "react";
import { toast } from "react-toastify";

type GeneralAPIResponse = {
error?: {
Expand Down Expand Up @@ -51,7 +50,7 @@ const queryClient = new QueryClient({
},
},
queryCache: new QueryCache({
onError: (error) => toast.error(`Something went wrong: ${error.message}`),
onError: (error) => console.error(`Something went wrong: ${error.message}`),
}),
});

Expand Down
5 changes: 1 addition & 4 deletions dashboard/src/api/mocks/useGetProject.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ mock.onGet(/^\/api\/v1\/projects\/\d+$/).reply((req) => {
(project) => project.id === projectId
);

return [
200,
project
];
return [200, project];
});
3 changes: 3 additions & 0 deletions dashboard/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Sheet, Typography } from "@mui/joy";
import { FC } from "react";
import { Link } from "react-router-dom";
import { ColorSchemeToggle } from "./ColorSchemeToggle";

export const Header: FC = () => {
Expand All @@ -26,6 +27,8 @@ export const Header: FC = () => {
}}
>
<Typography
component={Link}
to={"/"}
level="h4"
sx={{
fontWeight: "bold",
Expand Down
22 changes: 22 additions & 0 deletions dashboard/src/components/Placeholder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Box, CircularProgress } from "@mui/joy";
import { FC } from "react";

export const Placeholder: FC = () => {
return (
<Box
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
height: 150,
marginTop: '15%',
}
} >
<CircularProgress size="sm" value={35}>
<CircularProgress size="md" value={60}>
<CircularProgress size="lg" value={70} />
</CircularProgress>
</CircularProgress>
</Box >
);
};
Loading

0 comments on commit aab9c0b

Please sign in to comment.