({appName, defaultPriority, fClose, fOnSubmit}: IProps)
| 17 | } |
| 18 | |
| 19 | export const PushMessageDialog = ({appName, defaultPriority, fClose, fOnSubmit}: IProps) => { |
| 20 | const [title, setTitle] = useState(''); |
| 21 | const [message, setMessage] = useState(''); |
| 22 | const [priority, setPriority] = useState(defaultPriority); |
| 23 | |
| 24 | const submitEnabled = message.trim().length !== 0; |
| 25 | const submitAndClose = async () => { |
| 26 | await fOnSubmit(message, title, priority); |
| 27 | fClose(); |
| 28 | }; |
| 29 | |
| 30 | return ( |
| 31 | <Dialog |
| 32 | open={true} |
| 33 | onClose={fClose} |
| 34 | aria-labelledby="push-message-title" |
| 35 | id="push-message-dialog"> |
| 36 | <DialogTitle id="push-message-title">Push message</DialogTitle> |
| 37 | <DialogContent> |
| 38 | <DialogContentText> |
| 39 | Send a push message via {appName}. Leave the title empty to use the application |
| 40 | name. |
| 41 | </DialogContentText> |
| 42 | <TextField |
| 43 | margin="dense" |
| 44 | className="title" |
| 45 | label="Title" |
| 46 | type="text" |
| 47 | value={title} |
| 48 | onChange={(e) => setTitle(e.target.value)} |
| 49 | fullWidth |
| 50 | /> |
| 51 | <TextField |
| 52 | autoFocus |
| 53 | margin="dense" |
| 54 | className="message" |
| 55 | label="Message *" |
| 56 | type="text" |
| 57 | value={message} |
| 58 | onChange={(e) => setMessage(e.target.value)} |
| 59 | fullWidth |
| 60 | multiline |
| 61 | minRows={4} |
| 62 | /> |
| 63 | <NumberField |
| 64 | margin="dense" |
| 65 | className="priority" |
| 66 | label="Priority" |
| 67 | value={priority} |
| 68 | onChange={(value) => setPriority(value)} |
| 69 | fullWidth |
| 70 | /> |
| 71 | </DialogContent> |
| 72 | <DialogActions> |
| 73 | <Button onClick={fClose}>Cancel</Button> |
| 74 | <Tooltip title={submitEnabled ? '' : 'message is required'}> |
| 75 | <div> |
| 76 | <Button |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…