FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
AppRail.tsx
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2025-present FERS Contributors (see AUTHORS.md).
3
4import {
5 Box,
6 List,
7 ListItemButton,
8 ListItemIcon,
9 Tooltip,
10} from '@mui/material';
11import ViewInArIcon from '@mui/icons-material/ViewInAr';
12import WidgetsIcon from '@mui/icons-material/Widgets';
13import PlayArrowIcon from '@mui/icons-material/PlayArrow';
14import BarChartIcon from '@mui/icons-material/BarChart';
15import SettingsIcon from '@mui/icons-material/Settings';
16
17interface AppRailProps {
18 activeView: string;
19 onViewChange: (view: string) => void;
20 onSettingsClick: () => void;
21}
22
23const views = [
24 { id: 'scenario', label: 'Scenario Builder', icon: <ViewInArIcon /> },
25 { id: 'assets', label: 'Asset Library', icon: <WidgetsIcon /> },
26 { id: 'simulation', label: 'Simulation Run', icon: <PlayArrowIcon /> },
27 { id: 'results', label: 'Results Analysis', icon: <BarChartIcon /> },
28];
29
30export default function AppRail({
31 activeView,
32 onViewChange,
33 onSettingsClick,
34}: AppRailProps) {
35 return (
36 <Box
37 sx={{
38 width: 60,
39 height: '100%', // Use percentage instead of vh
40 display: 'flex',
41 flexDirection: 'column',
42 alignItems: 'center',
43 borderRight: 1,
44 borderColor: 'divider',
45 bgcolor: 'background.paper',
46 flexShrink: 0,
47 overflow: 'hidden', // Prevent overflow
48 }}
49 >
50 <List sx={{ flexGrow: 1, overflow: 'auto', width: '100%' }}>
51 {views.map((view) => (
52 <Tooltip title={view.label} placement="right" key={view.id}>
53 <ListItemButton
54 selected={activeView === view.id}
55 onClick={() => onViewChange(view.id)}
56 sx={{
57 my: 1,
58 justifyContent: 'center',
59 borderRadius: 2,
60 '&.Mui-selected': {
61 backgroundColor: 'action.selected',
62 },
63 }}
64 >
65 <ListItemIcon sx={{ minWidth: 0 }}>
66 {view.icon}
67 </ListItemIcon>
68 </ListItemButton>
69 </Tooltip>
70 ))}
71 </List>
72 <Box sx={{ pb: 1 }}>
73 <Tooltip title="Settings" placement="right">
74 <ListItemButton
75 onClick={onSettingsClick}
76 sx={{ my: 1, justifyContent: 'center' }}
77 >
78 <ListItemIcon sx={{ minWidth: 0 }}>
79 <SettingsIcon />
80 </ListItemIcon>
81 </ListItemButton>
82 </Tooltip>
83 </Box>
84 </Box>
85 );
86}