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

Tooltip on banner design archive button #634

Merged
merged 1 commit into from
Oct 7, 2024
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 @@ -8,6 +8,7 @@ import {
DialogContent,
DialogContentText,
DialogActions,
Tooltip,
} from '@mui/material';
import { makeStyles } from '@mui/styles';
import EditIcon from '@mui/icons-material/Edit';
Expand Down Expand Up @@ -104,39 +105,44 @@ const StickyTopBar: React.FC<Props> = ({
const [isOpen, open, close] = useOpenable();

return (
<>
<Button
variant="outlined"
startIcon={<ArchiveIcon style={{ color: grey[700] }} />}
size="medium"
onClick={open}
>
{/* eslint-disable-next-line react/prop-types */}
<Typography className={classes.buttonText}>Archive banner design</Typography>
</Button>
<Dialog
open={isOpen}
onClose={close}
aria-labelledby="archive-dialog-title"
aria-describedby="archive-dialog-description"
>
<DialogTitle id="archive-dialog-title">Are you sure?</DialogTitle>
<DialogContent>
<DialogContentText id="archive-dialog-description">
Archiving this design will remove it from the banner design tool - you can only
restore with an engineer&apos;s help.
</DialogContentText>
</DialogContent>
<DialogActions>
<Button color="primary" onClick={close}>
Cancel
</Button>
<Button color="primary" onClick={() => onArchive(name)}>
Archive design
</Button>
</DialogActions>
</Dialog>
</>
<Tooltip
title={design.status !== 'Draft' ? 'Design must be in draft status before archiving' : ''}
>
<span>
<Button
variant="outlined"
startIcon={<ArchiveIcon style={{ color: grey[700] }} />}
size="medium"
onClick={open}
disabled={design.status !== 'Draft'}
>
{/* eslint-disable-next-line react/prop-types */}
<Typography className={classes.buttonText}>Archive banner design</Typography>
</Button>
<Dialog
open={isOpen}
onClose={close}
aria-labelledby="archive-dialog-title"
aria-describedby="archive-dialog-description"
>
<DialogTitle id="archive-dialog-title">Are you sure?</DialogTitle>
<DialogContent>
<DialogContentText id="archive-dialog-description">
Archiving this design will remove it from the banner design tool - you can only
restore with an engineer&apos;s help.
</DialogContentText>
</DialogContent>
<DialogActions>
<Button color="primary" onClick={close}>
Cancel
</Button>
<Button color="primary" onClick={() => onArchive(name)}>
Archive design
</Button>
</DialogActions>
</Dialog>
</span>
</Tooltip>
);
};

Expand Down Expand Up @@ -184,7 +190,7 @@ const StickyTopBar: React.FC<Props> = ({
)}
{userHasLock && (
<>
{design.status === 'Draft' && <ArchiveButton />}
<ArchiveButton />
<Button
variant="outlined"
size="medium"
Expand Down
Loading