From 25d3aca9adac3441da14d53f489b2609fefac21f Mon Sep 17 00:00:00 2001 From: Sascha Date: Thu, 18 Mar 2021 14:11:41 +0100 Subject: Add test menu for edit history --- webui/src/pages/bug/EditHistoryMenu.tsx | 80 +++++++++++++++++++++++++++++++++ webui/src/pages/bug/Message.tsx | 13 ++++-- 2 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 webui/src/pages/bug/EditHistoryMenu.tsx (limited to 'webui/src') diff --git a/webui/src/pages/bug/EditHistoryMenu.tsx b/webui/src/pages/bug/EditHistoryMenu.tsx new file mode 100644 index 00000000..10b66f8f --- /dev/null +++ b/webui/src/pages/bug/EditHistoryMenu.tsx @@ -0,0 +1,80 @@ +import React from 'react'; + +import IconButton, { IconButtonProps } from '@material-ui/core/IconButton'; +import Menu from '@material-ui/core/Menu'; +import MenuItem from '@material-ui/core/MenuItem'; +import HistoryIcon from '@material-ui/icons/History'; + +const options = [ + 'None', + 'Atria', + 'Callisto', + 'Dione', + 'Ganymede', + 'Hangouts Call', + 'Luna', + 'Oberon', + 'Phobos', + 'Pyxis', + 'Sedna', + 'Titania', + 'Triton', + 'Umbriel', +]; + +const ITEM_HEIGHT = 48; + +type Props = { + iconBtnProps?: IconButtonProps; +}; +function EditHistoryMenu({ iconBtnProps }: Props) { + const [anchorEl, setAnchorEl] = React.useState(null); + const open = Boolean(anchorEl); + + const handleClick = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; + + return ( +
+ + + + + {options.map((option) => ( + + {option} + + ))} + +
+ ); +} + +export default EditHistoryMenu; diff --git a/webui/src/pages/bug/Message.tsx b/webui/src/pages/bug/Message.tsx index 26bbb1aa..d36b1044 100644 --- a/webui/src/pages/bug/Message.tsx +++ b/webui/src/pages/bug/Message.tsx @@ -13,6 +13,7 @@ import IfLoggedIn from 'src/components/IfLoggedIn/IfLoggedIn'; import { BugFragment } from './Bug.generated'; import EditCommentForm from './EditCommentForm'; +import EditHistoryMenu from './EditHistoryMenu'; import { AddCommentFragment } from './MessageCommentFragment.generated'; import { CreateFragment } from './MessageCreateFragment.generated'; @@ -57,7 +58,8 @@ const useStyles = makeStyles((theme) => ({ ...theme.typography.body2, padding: '0.5rem', }, - editButton: { + headerActions2: {}, + headerActions: { color: theme.palette.info.contrastText, padding: '0rem', marginLeft: theme.spacing(1), @@ -91,13 +93,17 @@ function Message({ bug, op }: Props) { commented - {comment.edited &&
Edited
} + {comment.edited && ( + + )} {() => ( editComment(comment.id)} > @@ -129,7 +135,6 @@ function Message({ bug, op }: Props) { -- cgit