-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates workbench and adds redux dependency (#46)
- Updates the signin page to require username input. The user can't get into the site without a username. - Uses redux state management to keep track of logged in username and highlight the active menu option. This username is used to construct the workbench links. - Updates codeclimate.yml to increase duplication threshold. --------- Co-authored-by: Asger <[email protected]> Co-authored-by: Burnfarm <[email protected]> Co-authored-by: Omar <[email protected]>
- Loading branch information
1 parent
4aac6f7
commit af17f91
Showing
31 changed files
with
643 additions
and
384 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
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
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
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import * as React from 'react'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import styled from '@emotion/styled'; | ||
import { KeyLinkPair } from 'util/envUtil'; | ||
import { Typography } from '@mui/material'; | ||
import LinkIcons from './LinkIconsLib'; | ||
|
||
const IconLabel = styled('div')({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
fontSize: '14px', | ||
}); | ||
|
||
const ButtonRow = styled('div')({ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
flexWrap: 'wrap', | ||
gap: '50px', | ||
}); | ||
|
||
interface IconButtonData { | ||
link: string; | ||
icon: React.ReactElement; | ||
name: string; | ||
} | ||
const getIconButtons = (buttons: KeyLinkPair[]): IconButtonData[] => | ||
buttons.map((button) => { | ||
const iconData = LinkIcons[button.key.toUpperCase()] || LinkIcons.NO_ICON; | ||
return { | ||
link: button.link, | ||
icon: iconData.icon, | ||
name: iconData.name || button.key, | ||
}; | ||
}); | ||
|
||
interface LinkButtonProps { | ||
buttons: KeyLinkPair[]; | ||
size?: number; | ||
} | ||
|
||
/** | ||
* @description Renders a row of buttons with icons and labels. The buttons open a new tab with the link. | ||
* @param buttons: KeyLinkPair[] (required) - an array of objects with a key and link | ||
* @param size: number (optional) - the size of the icons | ||
* @returns React.ReactElement - a row of buttons with icons and labels | ||
* @example | ||
* const linkValues = getWorkbenchLinkValues(); | ||
* <LinkButtons buttons={linkValues} size={6} /> | ||
*/ const LinkButtons = ({ buttons, size }: LinkButtonProps) => { | ||
const iconButtons = getIconButtons(buttons); | ||
return ( | ||
<ButtonRow> | ||
{iconButtons.map((button, index) => ( | ||
<Tooltip key={index} title={button.link}> | ||
<IconLabel> | ||
<IconButton | ||
onClick={() => { | ||
window.open(button.link, '_blank'); | ||
}} | ||
role="link" | ||
title={`${button.name}-btn`} | ||
> | ||
{React.cloneElement(button.icon, { | ||
style: { fontSize: `${size?.toString() ?? 4}rem` }, | ||
})} | ||
</IconButton> | ||
<Typography variant="h6">{button.name}</Typography> | ||
</IconLabel> | ||
</Tooltip> | ||
))} | ||
</ButtonRow> | ||
); | ||
}; | ||
|
||
export default LinkButtons; | ||
export { default as LinkIcons } from './LinkIconsLib'; |
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,41 @@ | ||
import * as React from 'react'; | ||
import TerminalOutlinedIcon from '@mui/icons-material/TerminalOutlined'; | ||
import DesktopWindowsOutlinedIcon from '@mui/icons-material/DesktopWindowsOutlined'; | ||
import CodeOutlinedIcon from '@mui/icons-material/CodeOutlined'; | ||
import ScienceOutlinedIcon from '@mui/icons-material/ScienceOutlined'; | ||
import NoteAltOutlinedIcon from '@mui/icons-material/NoteAltOutlined'; | ||
import OpenInNewIcon from '@mui/icons-material/OpenInNew'; | ||
|
||
type LinkIconsType = { | ||
[key: string]: { icon: React.ReactElement; name: string | undefined }; | ||
}; | ||
|
||
const LinkIcons: LinkIconsType = { | ||
TERMINAL: { | ||
icon: <TerminalOutlinedIcon />, | ||
name: 'Terminal', | ||
}, | ||
VNCDESKTOP: { | ||
icon: <DesktopWindowsOutlinedIcon />, | ||
name: 'Desktop', | ||
}, | ||
VSCODE: { | ||
icon: <CodeOutlinedIcon />, | ||
name: 'VSCode', | ||
}, | ||
JUPYTERLAB: { | ||
icon: <ScienceOutlinedIcon />, | ||
name: 'JupyterLab', | ||
}, | ||
JUPYTERNOTEBOOK: { | ||
icon: <NoteAltOutlinedIcon />, | ||
name: 'Jupyter Notebook', | ||
}, | ||
NO_ICON: { | ||
icon: <OpenInNewIcon />, | ||
name: undefined, | ||
}, | ||
}; | ||
|
||
export default LinkIcons; | ||
export { LinkIcons }; |
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.