Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information icon to show product revision description. #481

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import CardHeader from '@material-ui/core/CardHeader';
import Checkbox from '@material-ui/core/Checkbox';
import InfoIcon from '@material-ui/icons/Info';
import RadioButtonUncheckedIcon from '@material-ui/icons/RadioButtonUnchecked';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
import API from 'AppData/api';
Expand All @@ -77,6 +78,11 @@ const useStyles = makeStyles((theme) => ({
display: 'flex',
flexWrap: 'wrap',
},
infoIcon: {
fontSize: 'medium',
marginLeft: theme.spacing(1),
verticalAlign: 'middle',
},
saveButton: {
marginTop: theme.spacing(3),
},
Expand Down Expand Up @@ -143,6 +149,8 @@ const useStyles = makeStyles((theme) => ({
marginLeft: 6.5,
},
textShape2: {
display: 'flex',
alignItems: 'center',
marginTop: 8,
marginLeft: 115,
height: '18px',
Expand Down Expand Up @@ -1192,6 +1200,61 @@ export default function Environments() {
);
return item6;
}
let infoIconItem;
/**
* Returns modified infoIconItem
* @param {*} revDescription The description of the revision
* @returns {Object} Returns the infoIconItem
*/
function ReturnInfoIconItem({ revDescription}) {
const [anchorEl, setAnchorEl] = useState(null);

const handlePopoverOpen = (event) => {
setAnchorEl(event.currentTarget);
};

const handlePopoverClose = () => {
setAnchorEl(null);
};

const openPopover = Boolean(anchorEl);
infoIconItem = (
<>
<InfoIcon className={classes.infoIcon} color='primary'
onMouseEnter={handlePopoverOpen}
onMouseLeave={handlePopoverClose}
/>
<Popover
id='mouse-over-popover'
className={classes.popover}
classes={{
paper: classes.paper,

}}
open={openPopover}
anchorEl={anchorEl}
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
transformOrigin={{
vertical: 'bottom',
horizontal: 'left',
}}
onClose={handlePopoverClose}
disableRestoreFocus
>
<div>
<Typography variant='body2'>
{revDescription}
</Typography>
</div>
</Popover>
</>

);
return infoIconItem;
}

const items = [];
if (!api.isRevision) {
Expand All @@ -1212,6 +1275,13 @@ export default function Environments() {
{item1}
<Grid className={classes.textShape2}>
{allRevisions[revision].displayName}
{allRevisions[revision].description && <>
<ReturnInfoIconItem
revDescription={allRevisions[revision].description}
/>
{infoIconItem}
</>
}
</Grid>
<Grid>
<Button
Expand Down Expand Up @@ -1255,6 +1325,13 @@ export default function Environments() {
<Grid className={classes.textShape5} />
<Grid className={classes.textShape2}>
{allRevisions[revision].displayName}
{allRevisions[revision].description && <>
<ReturnInfoIconItem
revDescription={allRevisions[revision].description}
/>
{infoIconItem}
</>
}
</Grid>
<Grid className={classes.textPadding}>
<Button
Expand Down