More updates #26 #51 #11

This commit is contained in:
prayag17 committed 2023-04-19 21:58:59 +05:30
1 parent ac565b65fe
commit 0035488770
20 files changed
+389 -148

No files matched your search

+22 -8
View File
@@ -1,5 +1,5 @@
/** @format */
import { useEffect } from "react";
import { useEffect, useState } from "react";
import MuiAppBar from "@mui/material/AppBar";
import TextField from "@mui/material/TextField";
@@ -28,7 +28,7 @@ export const AppBar = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const visible = useSelector((state) => state.appBar.visible);
const [display, setDisplay] = useState(false);
const backButtonVisible = useSelector(
(state) => state.appBar.backButtonVisible,
);
@@ -42,7 +42,7 @@ export const AppBar = () => {
let usr = await getUserApi(window.api).getCurrentUser();
return usr.data;
},
enabled: visible,
enabled: display,
networkMode: "always",
});
@@ -51,14 +51,28 @@ export const AppBar = () => {
threshold: 0,
});
useEffect(() => {
if (
location.pathname.includes("login") ||
location.pathname.includes("setup")
) {
setDisplay(false);
} else {
setDisplay(true);
}
}, [location]);
useEffect(() => {
if (location.pathname == "/home") {
dispatch(hideBackButton());
}
});
}, [location]);
return (
visible && (
if (!display) {
return <></>;
}
if (display) {
return (
<MuiAppBar
sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
@@ -130,6 +144,6 @@ export const AppBar = () => {
</Box>
</Toolbar>
</MuiAppBar>
)
);
);
}
};