-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 7975c06.
- Loading branch information
Showing
14 changed files
with
501 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { useEffect } from 'react' | ||
import { useSearchParams } from 'react-router-dom' | ||
|
||
import { CallReceived } from '@mui/icons-material' | ||
import { Box, CircularProgress, IconButton } from '@mui/material' | ||
import { useTheme } from '@mui/material/styles' | ||
|
||
import { useConfig } from './config' | ||
import { useActiveId, useModel, usePageLoad, usePanes } from './state' | ||
import { updateColors } from './updateColors' | ||
import ViewTab from './ViewTab' | ||
/** | ||
* Directly render a pane based on its id | ||
*/ | ||
function DirectPane() { | ||
const [panes, panesDispatch] = usePanes() | ||
const params = useSearchParams()[0] | ||
const id = params.get('id') as string | ||
const theme = useTheme() | ||
const [activeId] = useActiveId() | ||
const [model] = useModel() | ||
const { tabHeight, views } = useConfig() | ||
const [globalProgress, loaded] = usePageLoad() | ||
useEffect(() => { | ||
updateColors(theme) | ||
}, [theme, loaded]) | ||
|
||
useEffect(() => { | ||
if (loaded && panes[id] && model.getNodeById(id)) window.close() | ||
}, [panes, loaded, model]) | ||
|
||
return loaded ? ( | ||
<div | ||
className='flexlayout__layout' | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
overflow: 'auto', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
width: '100%', | ||
bgcolor: 'background.main', | ||
height: `${tabHeight}px`, | ||
}} | ||
className={id == activeId ? 'flexlayout__tabset-selected' : ''} | ||
> | ||
<div className='flexlayout__tab_button flexlayout__tab_button_top flexlayout__tab_button--selected'> | ||
<div className='flexlayout__tab-content'> | ||
{panes[id]?.activeGene ? panes[id]?.activeGene + ' - ' : ''} | ||
{views.find((v) => v.id == panes[id]?.view)?.name} | ||
</div> | ||
</div> | ||
<div style={{ flexGrow: 1 }}></div> | ||
<IconButton | ||
onClick={() => { | ||
panesDispatch({ type: 'close-popout', id }) | ||
}} | ||
> | ||
<CallReceived /> | ||
</IconButton> | ||
</Box> | ||
<Box flexGrow={1}> | ||
<ViewTab id={id} /> | ||
</Box> | ||
</div> | ||
) : ( | ||
<div | ||
style={{ | ||
width: '100%', | ||
height: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<CircularProgress /> | ||
</div> | ||
) | ||
} | ||
export default DirectPane |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.