Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add loading animation #232

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Alert, Box, Button, Snackbar, Typography } from "@mui/material";
import CircularProgress from "@mui/material/CircularProgress";
import { useEffect, useState } from "react";
import useFetch from "../../components/useFetch";
import ListEntryParents from "./ListEntryParents";
Expand Down Expand Up @@ -64,9 +65,14 @@ const AccumulateAllComponents = ({ id, taxonomyName, branchName }) => {
// Loading...
if (isPending) {
return (
<Typography sx={{ ml: 4 }} variant="h5">
Loading..
</Typography>
<Box
sx={{
textAlign: "center",
my: 5,
}}
>
<CircularProgress />
</Box>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle";
import AddBoxIcon from "@mui/icons-material/AddBox";
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
import CircularProgress from "@mui/material/CircularProgress";
import ISO6391 from "iso-639-1";
import { ENTER_KEYCODE } from "../../constants";
import { greyHexCode } from "../../constants";
Expand Down Expand Up @@ -87,9 +88,14 @@ const ListEntryChildren = ({ url, urlPrefix, setUpdateNodeChildren }) => {
}
if (isPending) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobeeakon I am taking this PR
I can see the 2 loading spins when we want to edit a node.
Do we want a circular progress when we are waiting for children and parents ? Or do we only need a circular progress for the whole page ?
I ask these questions to know if I delete these circular progress components in ListEntryChildren and ListEntryParents. If we want to keep them, we will display both of them or do we only want one for both lists ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Piv94165 let's keep it simple ! Spinners are not the main UX blocker right now ;-)

return (
<Typography sx={{ ml: 4 }} variant="h5">
Loading..
</Typography>
<Box
sx={{
textAlign: "center",
my: 5,
}}
>
<CircularProgress />
</Box>
);
}
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from "react-router-dom";

import { Box, Typography } from "@mui/material";
import CircularProgress from "@mui/material/CircularProgress";

import useFetch from "../../components/useFetch";
import type { ParentsAPIResponse } from "../../backend-types/types";
Expand All @@ -26,9 +27,14 @@ const ListEntryParents = ({ fetchUrl, linkHrefPrefix }: Props) => {

if (isPending) {
return (
<Typography sx={{ ml: 4 }} variant="h5">
Loading...
</Typography>
<Box
sx={{
textAlign: "center",
my: 5,
}}
>
<CircularProgress />
</Box>
);
}

Expand Down
12 changes: 11 additions & 1 deletion taxonomy-editor-frontend/src/pages/go-to-project/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useNavigate } from "react-router-dom";
import { Typography, Box, Grid, Link as MuiLink } from "@mui/material";
import MaterialTable from "@material-table/core";
import EditIcon from "@mui/icons-material/Edit";
import CircularProgress from "@mui/material/CircularProgress";

import useFetch from "../../components/useFetch";
import { API_URL } from "../../constants";
Expand Down Expand Up @@ -70,7 +71,16 @@ const GoToProject = ({ clearNavBarLinks }: Props) => {
}

if (isPending) {
return <Typography variant="h5">Loading..</Typography>;
return (
<Box
sx={{
textAlign: "center",
my: 10,
}}
>
<CircularProgress />
</Box>
);
}

return (
Expand Down
10 changes: 8 additions & 2 deletions taxonomy-editor-frontend/src/pages/root-nodes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import TableRow from "@mui/material/TableRow";
import EditIcon from "@mui/icons-material/Edit";
import AddBoxIcon from "@mui/icons-material/AddBox";
import Dialog from "@mui/material/Dialog";
import CircularProgress from "@mui/material/CircularProgress";

import CreateNodeDialogContent from "../../components/CreateNodeDialogContent";
import useFetch from "../../components/useFetch";
Expand Down Expand Up @@ -80,8 +81,13 @@ const RootNodes = ({

if (isPending || !nodes) {
return (
<Box>
<Typography variant="h5">Loading...</Typography>
<Box
sx={{
textAlign: "center",
my: 10,
}}
>
<CircularProgress />
</Box>
);
}
Expand Down