From 2eeb7d63a0c396cce6ba90443491bf0ceec1638a Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Mon, 28 Mar 2022 22:54:27 -0400 Subject: [PATCH] SendDialog, cont'd --- web/src/components/App.js | 3 +- web/src/components/SendDialog.js | 286 +++++++++++++++++++++++-------- web/src/img/priority-3.svg | 2 +- 3 files changed, 220 insertions(+), 71 deletions(-) diff --git a/web/src/components/App.js b/web/src/components/App.js index abf2e824..2adeaf79 100644 --- a/web/src/components/App.js +++ b/web/src/components/App.js @@ -26,6 +26,7 @@ import TextField from "@mui/material/TextField"; import SendIcon from "@mui/icons-material/Send"; import api from "../app/Api"; import SendDialog from "./SendDialog"; +import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; // TODO add drag and drop // TODO races when two tabs are open @@ -149,7 +150,7 @@ const Sender = (props) => { }} > setSendDialogOpen(true)}> - + ; -} - -const PrioritySelect = () => { - return ( - - ); -} +import IconButton from "@mui/material/IconButton"; +import InsertEmoticonIcon from '@mui/icons-material/InsertEmoticon'; +import {Close} from "@mui/icons-material"; +import MenuItem from "@mui/material/MenuItem"; const SendDialog = (props) => { const [topicUrl, setTopicUrl] = useState(props.topicUrl); const [message, setMessage] = useState(props.message || ""); const [title, setTitle] = useState(""); const [tags, setTags] = useState(""); - const [click, setClick] = useState(""); + const [priority, setPriority] = useState(3); + const [clickUrl, setClickUrl] = useState(""); + const [attachUrl, setAttachUrl] = useState(""); + const [filename, setFilename] = useState(""); const [email, setEmail] = useState(""); + const [delay, setDelay] = useState(""); + + const [showTopicUrl, setShowTopicUrl] = useState(props.topicUrl === ""); + const [showClickUrl, setShowClickUrl] = useState(false); + const [showAttachUrl, setShowAttachUrl] = useState(false); + const [showAttachFile, setShowAttachFile] = useState(false); + const [showEmail, setShowEmail] = useState(false); + const [showDelay, setShowDelay] = useState(false); + const fullScreen = useMediaQuery(theme.breakpoints.down('sm')); const sendButtonEnabled = (() => { return true; @@ -58,31 +61,26 @@ const SendDialog = (props) => { }) }; return ( - + Publish notification - setTopicUrl(ev.target.value)} - type="text" - variant="standard" - fullWidth - required - /> - setMessage(ev.target.value)} - type="text" - variant="standard" - fullWidth - required - autoFocus - multiline - /> + {showTopicUrl && + { + setTopicUrl(props.topicUrl); + setShowTopicUrl(false); + }}> + setTopicUrl(ev.target.value)} + type="text" + variant="standard" + fullWidth + required + /> + + } { type="text" fullWidth variant="standard" + placeholder="Notification title, e.g. Disk space alert" /> setTags(ev.target.value)} + label="Message" + placeholder="Type the main message body here." + value={message} + onChange={ev => setMessage(ev.target.value)} type="text" - fullWidth variant="standard" + rows={5} + fullWidth + autoFocus + multiline /> - + null}> + setTags(ev.target.value)} + type="text" + variant="standard" + sx={{flexGrow: 1, marginRight: 1}} + /> + + + + + + {showClickUrl && + { + setClickUrl(""); + setShowClickUrl(false); + }}> + setClickUrl(ev.target.value)} + type="url" + fullWidth + variant="standard" + /> + + } + {showEmail && + { + setEmail(""); + setShowEmail(false); + }}> + setEmail(ev.target.value)} + type="email" + variant="standard" + fullWidth + /> + + } + {showAttachUrl && setClick(ev.target.value)} + label="Attachment URL" + value={attachUrl} + onChange={ev => setAttachUrl(ev.target.value)} type="url" - fullWidth variant="standard" - /> - } + {(showAttachFile || showAttachUrl) && setEmail(ev.target.value)} - type="email" - fullWidth + label="Attachment Filename" + value={filename} + onChange={ev => setFilename(ev.target.value)} + type="text" variant="standard" - /> - - - For details on what these fields mean, please check out the - {" "}documentation. + fullWidth + />} + {showDelay && + { + setDelay(""); + setShowDelay(false); + }}> + setDelay(ev.target.value)} + type="text" + variant="standard" + fullWidth + /> + + } + + Other features: + +
+ {!showClickUrl && setShowClickUrl(true)} sx={{marginRight: 1}}/>} + {!showEmail && setShowEmail(true)} sx={{marginRight: 1}}/>} + {!showAttachUrl && setShowAttachUrl(true)} sx={{marginRight: 1}}/>} + {!showAttachFile && setShowAttachFile(true)} sx={{marginRight: 1}}/>} + {!showDelay && setShowDelay(true)} sx={{marginRight: 1}}/>} + {!showTopicUrl && setShowTopicUrl(true)} sx={{marginRight: 1}}/>} +
+ + For examples and a detailed description of all send features, please + refer to the documentation.
@@ -133,4 +232,53 @@ const SendDialog = (props) => { ); }; +const Row = (props) => { + return ( +
+ {props.children} +
+ ); +}; + +const ClosableRow = (props) => { + return ( + + {props.children} + + + ); +}; + +const PrioritySelect = () => { + return ( + + setSendDialogOpen(true)}> + + + + ); +}; + +const DialogIconButton = (props) => { + return ( + + {props.children} + + ); +}; + +const priorities = { + 1: { label: "Minimum priority", file: priority1 }, + 2: { label: "Low priority", file: priority2 }, + 3: { label: "Default priority", file: priority3 }, + 4: { label: "High priority", file: priority4 }, + 5: { label: "Maximum priority", file: priority5 } +}; + export default SendDialog; diff --git a/web/src/img/priority-3.svg b/web/src/img/priority-3.svg index fc65f662..428900f3 100644 --- a/web/src/img/priority-3.svg +++ b/web/src/img/priority-3.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file