Skip to content

Commit

Permalink
fix loading
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxn committed Nov 4, 2023
1 parent 1fd15f9 commit 1fede1c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/Header/UserMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useQueryClient, useIsFetching } from "@tanstack/react-query";

import Button from "@mui/joy/Button";
import IconButton from "@mui/joy/IconButton";
import CircularProgress from "@mui/joy/CircularProgress";

import CachedIcon from "@mui/icons-material/Cached";
import LogoutIcon from "@mui/icons-material/Logout";
Expand Down Expand Up @@ -67,12 +68,15 @@ export default function UserMenu() {
userIcon = <SupervisedUserCircleIcon />;
}

const anythingLoading = accountIsLoading == true || isFetching == true;

const parsedActor = parseActorId(localPerson.actor_id);

return (
<>
<BasicInfoTooltip title="Reload all data" placement="bottom" variant="soft">
<IconButton
disabled={anythingLoading}
size="sm"
variant="outlined"
color="primary"
Expand All @@ -83,7 +87,16 @@ export default function UserMenu() {
refreshMutate();
}}
>
<CachedIcon />
{!anythingLoading && <CachedIcon />}
{anythingLoading && (
<CircularProgress
size="sm"
color="neutral"
sx={{
"--CircularProgress-size": "16px",
}}
/>
)}
</IconButton>
</BasicInfoTooltip>

Expand Down

0 comments on commit 1fede1c

Please sign in to comment.