Merge pull request #394 from Strencher/development

More details for the ErrorBoundary, update gulpfile.js
This commit is contained in:
Zack 2020-07-23 00:22:37 -04:00 committed by GitHub
commit 60e0b9a1b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 8 deletions

4
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/style.css vendored

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,6 @@ gulp.task("watch-css", function() {
function minifyCSS() {
return gulp.src("./src/styles/index.css")
.pipe(csso({restructure: false}))
.pipe(rename("style.min.css"))
.pipe(rename("style.css"))
.pipe(gulp.dest("./dist"));
}

View File

@ -1,3 +1,11 @@
/* Error Boundary stuff */
.react-error {
color: red;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
cursor: pointer;
}
.bd-settings-group.collapsible .bd-settings-title {
display: flex;
justify-content: space-between;

View File

@ -1,17 +1,17 @@
import {React, Logger} from "modules";
import {remote} from "electron";
export default class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = {hasError: false};
}
componentDidCatch() {
componentDidCatch(error, errorInfo) {
this.setState({hasError: true});
}
render() {
if (this.state.hasError) return <div className="react-error">Component Error</div>;
if (this.state.hasError) return <div onClick={() => remote.getCurrentWindow().openDevTools()} className="react-error">There was an unexpected Error. Click to open console for more details.</div>;
return this.props.children;
}
}

View File

@ -97,7 +97,7 @@ export default class AddonCard extends React.Component {
catch (err) { Logger.stacktrace("Addon Settings", "Unable to get settings panel for " + name + ".", err); }
const props = {id: `${name}-settings`, className: "addon-settings", ref: this.panelRef};
if (typeof(settingsPanel) == "string") {
if (typeof(this.settingsPanel) == "string") {
Logger.warn("Addon Settings", "Using a DOMString is officially deprecated.");
props.dangerouslySetInnerHTML = this.settingsPanel;
}