File tree Expand file tree Collapse file tree 4 files changed +49
-59
lines changed
Expand file tree Collapse file tree 4 files changed +49
-59
lines changed Original file line number Diff line number Diff line change 1+ import React , { useState } from "react" ;
2+ import DialogTitle from "@material-ui/core/DialogTitle" ;
3+ import DialogContent from "@material-ui/core/DialogContent" ;
4+ import DialogContentText from "@material-ui/core/DialogContentText" ;
5+ import DialogActions from "@material-ui/core/DialogActions" ;
6+ import Button from "@material-ui/core/Button" ;
7+ import Dialog from "@material-ui/core/Dialog" ;
8+ import { useSelector } from "react-redux" ;
9+
10+ const AlertDialog = ( { title, content} ) => {
11+
12+ const language = useSelector ( state => state . MainReducer . languages [ state . MainReducer . languageIndex ] ) ;
13+ const [ open , setOpen ] = useState ( true ) ;
14+
15+ /**
16+ * Close the AlertDialog instance
17+ */
18+ const handleClose = ( ) => {
19+ setOpen ( false ) ;
20+ } ;
21+
22+ return (
23+ < Dialog
24+ open = { open }
25+ onClose = { handleClose }
26+ aria-labelledby = "alert-dialog-title"
27+ aria-describedby = "alert-dialog-description"
28+ >
29+ < DialogTitle id = "alert-dialog-title" > { title } </ DialogTitle >
30+ < DialogContent >
31+ < DialogContentText id = "alert-dialog-description" >
32+ { content }
33+ </ DialogContentText >
34+ </ DialogContent >
35+ < DialogActions >
36+ < Button onClick = { handleClose } color = "primary" autoFocus >
37+ { language . ok }
38+ </ Button >
39+ </ DialogActions >
40+ </ Dialog >
41+ ) ;
42+ } ;
43+
44+ export default AlertDialog ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ import Button from "@material-ui/core/Button";
1212import Card from "@material-ui/core/Card" ;
1313import { useHistory } from "react-router" ;
1414import blank from "../../components/Theme/blank.png" ;
15- import AlertModal from "../../components/AlertModal" ;
1615import { Updater } from "../../utils/Updater" ;
1716import UpdateDialog from "../../components/UpdateDialog" ;
17+ import AlertDialog from "../../components/AlertDialog" ;
1818
1919const useStyles = makeStyles ( theme => ( {
2020 heroContent : {
@@ -104,7 +104,7 @@ const Home = () => {
104104 </ div >
105105 < main className = { classes . content } >
106106 { update && update . updateAvailable ? ( < UpdateDialog downloadUrl = { update . updateUrl } infoUrl = { update . infoUrl } newVersion = { update . version } /> ) : null }
107- { errorMessage && errorMessage . length > 0 ? ( < AlertModal title = { language . errorTitle } content = { errorMessage } /> ) : null }
107+ { errorMessage && errorMessage . length > 0 ? ( < AlertDialog title = { language . errorTitle } content = { errorMessage } /> ) : null }
108108 < Container maxWidth = { "lg" } className = { classes . container } >
109109 < Grid container spacing = { 2 } >
110110 < Grid item xs = { 12 } md = { 6 } lg = { 6 } >
Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ import MenuItem from "@material-ui/core/MenuItem";
2424import Button from "@material-ui/core/Button" ;
2525import RefreshIcon from "@material-ui/icons/Refresh" ;
2626import { Updater } from "../../utils/Updater" ;
27- import AlertModal from "../../components/AlertModal" ;
2827import BackButton from "../../components/BackButton" ;
2928import UpdateDialog from "../../components/UpdateDialog" ;
29+ import AlertDialog from "../../components/AlertDialog" ;
3030
3131const useStyles = makeStyles ( theme => ( {
3232 content : {
@@ -146,9 +146,9 @@ const Settings = () => {
146146 < UpdateDialog downloadUrl = { update . updateUrl } infoUrl = { update . infoUrl }
147147 newVersion = { update . version } /> ) : null }
148148 { update && ! update . updateAvailable ? (
149- < AlertModal title = { language . noUpdatesTitle } content = { language . noUpdatesMessage } /> ) : null }
149+ < AlertDialog title = { language . noUpdatesTitle } content = { language . noUpdatesMessage } /> ) : null }
150150 { errorMessage && errorMessage . length > 0 ? (
151- < AlertModal title = { language . errorTitle } content = { errorMessage } /> ) : null }
151+ < AlertDialog title = { language . errorTitle } content = { errorMessage } /> ) : null }
152152 < Container maxWidth = "lg" className = { classes . container } >
153153 < Grid container spacing = { 2 } >
154154 < Grid item xs = { 12 } md = { 12 } lg = { 12 } >
You can’t perform that action at this time.
0 commit comments