mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
@@ -1,5 +1,7 @@
|
|||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||||
import MenuIcon from '@mui/icons-material/Menu';
|
import MenuIcon from '@mui/icons-material/Menu';
|
||||||
import { AppBar, IconButton, Toolbar, Typography } from '@mui/material';
|
import { AppBar, IconButton, Toolbar, Typography } from '@mui/material';
|
||||||
|
|
||||||
@@ -10,7 +12,17 @@ interface LayoutAppBarProps {
|
|||||||
onToggleDrawer: () => void;
|
onToggleDrawer: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => (
|
const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => {
|
||||||
|
const pathnames = useLocation()
|
||||||
|
.pathname.split('/')
|
||||||
|
.filter((x) => x);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
let show_back = false;
|
||||||
|
if (pathnames.length > 1) {
|
||||||
|
show_back = pathnames[0] !== 'system' || pathnames[1] === 'espsystemstatus';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
position="fixed"
|
position="fixed"
|
||||||
sx={{
|
sx={{
|
||||||
@@ -29,11 +41,23 @@ const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => (
|
|||||||
>
|
>
|
||||||
<MenuIcon />
|
<MenuIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
|
{show_back && (
|
||||||
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
edge="start"
|
||||||
|
onClick={() => navigate(pathnames[0])}
|
||||||
|
>
|
||||||
|
<ArrowBackIcon />
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
|
||||||
<Typography variant="h6" noWrap component="div">
|
<Typography variant="h6" noWrap component="div">
|
||||||
{title}
|
{title}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default LayoutAppBar;
|
export default LayoutAppBar;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const levelLabel = (level: LogLevel) => {
|
|||||||
const SystemLog: FC = () => {
|
const SystemLog: FC = () => {
|
||||||
const { LL } = useI18nContext();
|
const { LL } = useI18nContext();
|
||||||
|
|
||||||
useLayoutTitle(LL.LOG_OF(''));
|
useLayoutTitle(LL.SYSTEM(0));
|
||||||
|
|
||||||
const {
|
const {
|
||||||
loadData,
|
loadData,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import RestartMonitor from './RestartMonitor';
|
|||||||
const SystemStatus: FC = () => {
|
const SystemStatus: FC = () => {
|
||||||
const { LL } = useI18nContext();
|
const { LL } = useI18nContext();
|
||||||
|
|
||||||
useLayoutTitle(LL.STATUS_OF(''));
|
useLayoutTitle(LL.SYSTEM(0));
|
||||||
|
|
||||||
const { me } = useContext(AuthenticatedContext);
|
const { me } = useContext(AuthenticatedContext);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const SystemActivity: FC = () => {
|
|||||||
|
|
||||||
const { LL } = useI18nContext();
|
const { LL } = useI18nContext();
|
||||||
|
|
||||||
useLayoutTitle(LL.ACTIVITY());
|
useLayoutTitle(LL.SYSTEM(0));
|
||||||
|
|
||||||
const stats_theme = tableTheme({
|
const stats_theme = tableTheme({
|
||||||
Table: `
|
Table: `
|
||||||
|
|||||||
Reference in New Issue
Block a user