-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change beta alert message to fix electron focus problem
- Loading branch information
Showing
5 changed files
with
103 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//@import "../../colors"; | ||
@import "../commonDialog.scss"; | ||
|
||
.alertDialog { | ||
.dialogContent { | ||
padding: 20px; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
.row { | ||
display: flex; | ||
flex-direction: row; | ||
img { | ||
width: auto; | ||
margin-right: 10px; | ||
margin-top: 3px; | ||
} | ||
} | ||
h1 { | ||
font-family: Roboto; | ||
font-size: 12pt; | ||
height: 1em; | ||
font-weight: bold; | ||
margin: 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from "react"; | ||
import ReactModal from "react-modal"; | ||
import "./AlertDialog.scss"; | ||
import CloseOnEscape from "react-close-on-escape"; | ||
import { locate } from "../../crossPlatformUtilities"; | ||
import { Trans } from "@lingui/react"; | ||
|
||
interface IState { | ||
isOpen: boolean; | ||
config: IConfig; | ||
} | ||
interface IConfig { | ||
message: string; | ||
buttonText?: string; | ||
} | ||
export default class AlertDialog extends React.Component<{}, IState> { | ||
private static singleton: AlertDialog; | ||
|
||
constructor() { | ||
super({}); | ||
this.state = { | ||
isOpen: false, | ||
config: { message: "message is not set yet" } | ||
}; | ||
AlertDialog.singleton = this; | ||
} | ||
private handleCloseModal(doDelete: boolean) { | ||
this.setState({ isOpen: false }); | ||
} | ||
|
||
public static async show(config: IConfig) { | ||
AlertDialog.singleton.setState({ | ||
isOpen: true, | ||
config | ||
}); | ||
} | ||
public render() { | ||
return ( | ||
<CloseOnEscape | ||
onEscape={() => { | ||
this.handleCloseModal(false); | ||
}} | ||
> | ||
<ReactModal | ||
ariaHideApp={false} | ||
className="alertDialog" | ||
isOpen={this.state.isOpen} | ||
shouldCloseOnOverlayClick={true} | ||
onRequestClose={() => this.handleCloseModal(false)} | ||
> | ||
<div className="dialogContent"> | ||
<div className="row"> | ||
<img src={locate("assets/warning.png")} /> | ||
<h1>{this.state.config.message}</h1> | ||
</div> | ||
</div> | ||
<div className={"bottomButtonRow"}> | ||
<div className={"okCancelGroup"}> | ||
<button id="confirm" onClick={() => this.handleCloseModal(true)}> | ||
{this.state.config.buttonText || <Trans>"Cancel"</Trans>} | ||
</button> | ||
</div> | ||
</div> | ||
</ReactModal> | ||
</CloseOnEscape> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.