remove unused
cleanup styles
simplify post code
commentz
This commit is contained in:
cv
2021-10-27 22:54:50 +02:00
parent 0a5fa12c21
commit 1afdd67760
6 changed files with 20 additions and 13 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
import { useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useSocket } from 'app/context/socketContext'; import { useSocket } from 'app/context/socketContext';
import style from './Info.module.css'; import style from './Info.module.css';
import InfoTitle from './InfoTitle'; import InfoTitle from './InfoTitle';
import InfoLogger from './InfoLogger'; import InfoLogger from './InfoLogger';
import InfoNif from './InfoNif'; import InfoNif from './InfoNif';
import { useState } from 'react';
export default function Info() { export default function Info() {
const socket = useSocket(); const socket = useSocket();
+1 -2
View File
@@ -11,8 +11,7 @@ export default function InfoNif() {
placeholderData: ontimePlaceholderInfo, placeholderData: ontimePlaceholderInfo,
}); });
const [collapsed, setCollapsed] = useState(false); const [collapsed, setCollapsed] = useState(false);
const baseURL = 'http://__IP__:4001';
const baseURL = `http://__IP__:${4001}`;
const handleLink = (url) => { const handleLink = (url) => {
if (window.process?.type === 'renderer') { if (window.process?.type === 'renderer') {
@@ -13,7 +13,7 @@ import { EVENT_TABLE } from 'app/api/apiConstants';
import style from './Modals.module.css'; import style from './Modals.module.css';
export default function SettingsModal() { export default function SettingsModal() {
const { data, status, isError } = useFetch(EVENT_TABLE, fetchEvent); const { data, status } = useFetch(EVENT_TABLE, fetchEvent);
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
title: '', title: '',
url: '', url: '',
@@ -36,13 +36,11 @@ export default function SettingsModal() {
}); });
}, [data]); }, [data]);
console.log(`formData.endMessage`, formData.endMessage);
const submitHandler = async (event) => { const submitHandler = async (event) => {
event.preventDefault(); event.preventDefault();
setSubmitting(true); setSubmitting(true);
await postEvent(formData).then(setSubmitting(false)); await postEvent(formData);
setChanged(false); setChanged(false);
setSubmitting(false); setSubmitting(false);
@@ -71,7 +69,6 @@ export default function SettingsModal() {
value={formData.title} value={formData.title}
onChange={(event) => { onChange={(event) => {
setChanged(true); setChanged(true);
setFormData({ ...formData, title: event.target.value }); setFormData({ ...formData, title: event.target.value });
}} }}
isDisabled={submitting} isDisabled={submitting}
+1 -1
View File
@@ -50,5 +50,5 @@ export default function ModalManager(props) {
ModalManager.propTypes = { ModalManager.propTypes = {
isOpen: PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onClose: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired,
}; };
+5 -2
View File
@@ -6,6 +6,10 @@
margin-top: 0.5em; margin-top: 0.5em;
} }
.modalBody > button {
margin-top: 1em;
}
.notes { .notes {
font-weight: 400; font-weight: 400;
color: #2b6cb0; color: #2b6cb0;
@@ -26,8 +30,7 @@ span.notes {
.modalInline { .modalInline {
display: flex; display: flex;
justify-content: space-between; gap: 2em;
gap: 1em;
} }
.highNotes { .highNotes {
+10 -1
View File
@@ -145,7 +145,13 @@ const server = http.createServer(app);
export const startServer = async (overrideConfig = null) => { export const startServer = async (overrideConfig = null) => {
// Setup default port // Setup default port
const port = overrideConfig?.port || serverPort; // const port = overrideConfig?.port || serverPort;
/* Note: Port is hardcoded
* need to find a good solution for sharing
* the dynamic info with the frontend
*/
const port = 4001;
// Start server // Start server
const returnMessage = `HTTP Server is listening on port ${port}`; const returnMessage = `HTTP Server is listening on port ${port}`;
@@ -165,9 +171,12 @@ export const shutdown = async () => {
// shutdown express server // shutdown express server
server.close(); server.close();
// shutdown OSC Server // shutdown OSC Server
shutdownOSCServer(); shutdownOSCServer();
// shutdown OSC Client // shutdown OSC Client
oscClient.close();
// shutdown timer // shutdown timer
global.timer.shutdown(); global.timer.shutdown();