|
| 1 | +import * as React from 'react'; |
| 2 | +import Tabs from '@mui/material/Tabs'; |
| 3 | +import Tab from '@mui/material/Tab'; |
| 4 | +import Typography from '@mui/material/Typography'; |
| 5 | +import Box from '@mui/material/Box'; |
| 6 | +import WorkspaceContainer from "../workspace/WorkspaceContainer"; |
| 7 | +import HistoryContainer from '../../components/containers/HistoryContainer'; |
| 8 | +import AccessTimeIcon from '@mui/icons-material/AccessTime'; |
| 9 | +import WorkIcon from '@mui/icons-material/Work'; |
| 10 | + |
| 11 | +interface TabPanelProps { |
| 12 | + children?: React.ReactNode; |
| 13 | + index: number; |
| 14 | + value: number; |
| 15 | +} |
| 16 | + |
| 17 | +function TabPanel(props: TabPanelProps) { |
| 18 | + const { children, value, index, ...other } = props; |
| 19 | + |
| 20 | + return ( |
| 21 | + <div |
| 22 | + role="tabpanel" |
| 23 | + hidden={value !== index} |
| 24 | + id={`simple-tabpanel-${index}`} |
| 25 | + aria-labelledby={`simple-tab-${index}`} |
| 26 | + {...other} |
| 27 | + > |
| 28 | + {value === index && ( |
| 29 | + <Box sx={{ p: 1 }}> |
| 30 | + <Box>{children}</Box> |
| 31 | + </Box> |
| 32 | + )} |
| 33 | + </div> |
| 34 | + ); |
| 35 | +} |
| 36 | + |
| 37 | +function a11yProps(index: number) { |
| 38 | + return { |
| 39 | + id: `simple-tab-${index}`, |
| 40 | + 'aria-controls': `simple-tabpanel-${index}`, |
| 41 | + }; |
| 42 | +} |
| 43 | + |
| 44 | +export default function HistoryOrWorkspaceContainer(props) { |
| 45 | + const [value, setValue] = React.useState(0); |
| 46 | + |
| 47 | + const handleChange = (event: React.SyntheticEvent, newValue: number) => { |
| 48 | + setValue(newValue); |
| 49 | + }; |
| 50 | + |
| 51 | + return ( |
| 52 | + <Box sx={{ minWidth: '25%', overflow: 'auto', maxHeight: '100%', overflowX: 'auto' }}> |
| 53 | + <Box sx={{ borderBottom: 1, borderColor: 'divider', }}> |
| 54 | + <Tabs value={value} onChange={handleChange} aria-label="basic tabs example"> |
| 55 | + <Tab icon={<WorkIcon fontSize='small'/>} {...a11yProps(0)} sx={{fontSize:'10px', overflowWrap: "break-word", maxWidth: '50%'}}/> |
| 56 | + <Tab icon={<AccessTimeIcon fontSize='small'/>} {...a11yProps(1)} sx={{fontSize:'10px', overflowWrap: "break-word", maxWidth: '50%'}}/> |
| 57 | + </Tabs> |
| 58 | + </Box> |
| 59 | + <TabPanel value={value} index={0}> |
| 60 | + <WorkspaceContainer {...props} /> |
| 61 | + </TabPanel> |
| 62 | + <TabPanel value={value} index={1}> |
| 63 | + <HistoryContainer /> |
| 64 | + </TabPanel> |
| 65 | + </Box> |
| 66 | + ); |
| 67 | +} |
0 commit comments