import { memo } from 'react'; import { Link, useLocation, useNavigate } from 'react-router'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import MenuIcon from '@mui/icons-material/Menu'; import { AppBar, IconButton, Toolbar, Typography } from '@mui/material'; import type { SxProps, Theme } from '@mui/material/styles'; import { useI18nContext } from 'i18n/i18n-react'; export const DRAWER_WIDTH = 210; interface LayoutAppBarProps { title: string; onToggleDrawer: () => void; } // Extract static styles const appBarStyles: SxProps = { width: { md: `calc(100% - ${DRAWER_WIDTH}px)` }, ml: { md: `${DRAWER_WIDTH}px` }, boxShadow: 'none', backgroundColor: '#2e586a' }; const menuButtonStyles: SxProps = { mr: 2, display: { md: 'none' } }; const backButtonStyles: SxProps = { mr: 1, fontSize: 20, verticalAlign: 'middle' }; const LayoutAppBarComponent = ({ title, onToggleDrawer }: LayoutAppBarProps) => { const { LL } = useI18nContext(); const navigate = useNavigate(); const location = useLocation(); const pathnames = location.pathname.split('/').filter((x) => x); const handleBackClick = () => { void navigate('/' + pathnames[0]); }; return ( {pathnames.length > 1 && ( <> {pathnames[0] === 'status' ? LL.STATUS_OF('') : LL.SETTINGS(0)}   |   )} {title} ); }; const LayoutAppBar = memo(LayoutAppBarComponent); export default LayoutAppBar;