aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-02 17:07:17 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-02 17:07:17 +0000
commit2a0705f1c26befa75703238462930847b18895e1 (patch)
tree1d6ac245a749fb1f07014ecbb8c0fa0a3c9ab918 /modern/src
parent529e51405db4a086a8eae8e63602f46c3e67fab4 (diff)
downloadetbsa-traccar-web-2a0705f1c26befa75703238462930847b18895e1.tar.gz
etbsa-traccar-web-2a0705f1c26befa75703238462930847b18895e1.tar.bz2
etbsa-traccar-web-2a0705f1c26befa75703238462930847b18895e1.zip
show admin title in mobile appbar
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/settings/OptionsLayout/index.js8
-rw-r--r--modern/src/settings/OptionsLayout/useRoutes.js2
2 files changed, 6 insertions, 4 deletions
diff --git a/modern/src/settings/OptionsLayout/index.js b/modern/src/settings/OptionsLayout/index.js
index 37b6355..61a94cf 100644
--- a/modern/src/settings/OptionsLayout/index.js
+++ b/modern/src/settings/OptionsLayout/index.js
@@ -33,7 +33,7 @@ const useStyles = makeStyles(theme => ({
content: {
flex: 1,
padding: theme.spacing(5, 3, 3, 3),
- [theme.breakpoints.down('md')]:{
+ [theme.breakpoints.down('md')]: {
paddingTop: theme.spacing(10)
}
},
@@ -58,8 +58,10 @@ const OptionsLayout = ({ children }) => {
const routes = useRoutes();
useEffect(() => {
- const activeRoute = routes.find(route => location.pathname.match(route.match));
- setOptionTitle(activeRoute.name);
+ const activeRoute = routes.find(
+ route => route.href && location.pathname.match(route.match || route.href)
+ );
+ setOptionTitle(activeRoute?.name);
}, [location, routes]);
const title = `Options / ${optionTitle}`;
diff --git a/modern/src/settings/OptionsLayout/useRoutes.js b/modern/src/settings/OptionsLayout/useRoutes.js
index 6796a56..901719f 100644
--- a/modern/src/settings/OptionsLayout/useRoutes.js
+++ b/modern/src/settings/OptionsLayout/useRoutes.js
@@ -78,7 +78,7 @@ const mainRoutes = [
export default () => {
const isAdmin = useSelector(getIsAdmin);
const userId = useSelector(getUserId);
- accountRoute.match = accountRoute.href = `/user/${userId}`;
+ accountRoute.href = `/user/${userId}`;
return useMemo(() => [...mainRoutes, ...(isAdmin ? adminRoutes : [])], [
isAdmin