mirror of
https://github.com/ApfelTeeSaft/LiveSplitOne.git
synced 2026-09-02 03:43:24 +00:00
Use Destructuring
This commit is contained in:
+18
-18
@@ -99,24 +99,24 @@ export class LiveSplit extends React.Component<{}, State> {
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { route, content } = ((): { route: Route, content: JSX.Element } => {
|
||||
const [route, content] = ((): [Route, JSX.Element] => {
|
||||
if (this.state.runEditor) {
|
||||
return {
|
||||
route: "run-editor",
|
||||
content: <RunEditorComponent editor={this.state.runEditor} />,
|
||||
};
|
||||
return [
|
||||
"run-editor",
|
||||
<RunEditorComponent editor={this.state.runEditor} />,
|
||||
];
|
||||
} else if (this.state.layoutEditor) {
|
||||
return {
|
||||
route: "layout-editor",
|
||||
content: <LayoutEditorComponent
|
||||
return [
|
||||
"layout-editor",
|
||||
<LayoutEditorComponent
|
||||
editor={this.state.layoutEditor}
|
||||
timer={this.state.timer}
|
||||
/>,
|
||||
};
|
||||
];
|
||||
} else {
|
||||
return {
|
||||
route: "main",
|
||||
content: <div
|
||||
return [
|
||||
"main",
|
||||
<div
|
||||
style={{
|
||||
margin: "10px",
|
||||
marginBottom: "5px",
|
||||
@@ -153,7 +153,7 @@ export class LiveSplit extends React.Component<{}, State> {
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
};
|
||||
];
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -228,12 +228,12 @@ export class LiveSplit extends React.Component<{}, State> {
|
||||
}
|
||||
|
||||
public exportSplits() {
|
||||
const { lss, name } = this.state.timer.readWith((t) => {
|
||||
const [lss, name] = this.state.timer.readWith((t) => {
|
||||
const run = t.getRun();
|
||||
return {
|
||||
lss: run.saveAsLss(),
|
||||
name: run.extendedFileName(true),
|
||||
};
|
||||
return [
|
||||
run.saveAsLss(),
|
||||
run.extendedFileName(true),
|
||||
];
|
||||
});
|
||||
exportFile(name + ".lss", lss);
|
||||
}
|
||||
|
||||
@@ -179,11 +179,11 @@ export class SideBarContent extends React.Component<Props, State> {
|
||||
|
||||
private update() {
|
||||
if (this.props.route === "main" && this.props.sidebarOpen) {
|
||||
const { comparison, timingMethod } = this.props.timer.readWith((t) => {
|
||||
return {
|
||||
comparison: t.currentComparison(),
|
||||
timingMethod: t.currentTimingMethod(),
|
||||
};
|
||||
const [comparison, timingMethod] = this.props.timer.readWith((t): [string, number] => {
|
||||
return [
|
||||
t.currentComparison(),
|
||||
t.currentTimingMethod(),
|
||||
];
|
||||
});
|
||||
|
||||
if (comparison !== this.state.comparison || timingMethod !== this.state.timingMethod) {
|
||||
|
||||
Reference in New Issue
Block a user