Skip to content

Commit

Permalink
ui: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kanreisa committed Jan 11, 2021
1 parent bbd2282 commit ce72399
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/ui/components/ChannelsConfigurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const Configurator: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }>
setTimeout(() => {
uiStateEvents.emit("notify:restart-required");
}, 500);
setSaved(false);
return;
}
(async () => {
Expand All @@ -127,9 +128,6 @@ const Configurator: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }>
console.error(e);
}
})();
return () => {
setSaved(false);
}
}, [saved]);

const items = [];
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/Restart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Restart: React.FC<{ uiStateEvents: EventEmitter }> = ({ uiStateEvents }) =
return () => {
uiStateEvents.off("notify:restart-required", onRestartRequired);
};
});
}, []);

return (
<>
Expand Down
8 changes: 3 additions & 5 deletions src/ui/components/ServerConfigurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,19 @@ const Configurator: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }>
setTimeout(() => {
uiStateEvents.emit("notify:restart-required");
}, 500);
setSaved(false);
return;
}
(async () => {
try {
const res = await (await fetch(configAPI)).json();
console.log("ServerConfigurator", "GET", configAPI, "->", res);
setEditing({...res});
setCurrent({...res});
setEditing({ ...res });
setCurrent({ ...res });
} catch (e) {
console.error(e);
}
})();
return () => {
setSaved(false);
}
}, [saved]);

const docker = uiState.status.process.env.DOCKER === "YES";
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/StatusView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const StatusView: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }> =
uiStateEvents.off("update:status", onStatusUpdate);
uiStateEvents.off("update:tuners", onTunersUpdate);
};
});
}, []);

const statusItem: StatusItem[] = [];

Expand Down
4 changes: 1 addition & 3 deletions src/ui/components/TunersConfigurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const Configurator: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }>
setTimeout(() => {
uiStateEvents.emit("notify:restart-required");
}, 500);
setSaved(false);
return;
}
(async () => {
Expand All @@ -120,9 +121,6 @@ const Configurator: React.FC<{ uiState: UIState, uiStateEvents: EventEmitter }>
console.error(e);
}
})();
return () => {
setSaved(false);
}
}, [saved]);

const items = [];
Expand Down

0 comments on commit ce72399

Please sign in to comment.