improvements
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
.idea/
|
||||
|
||||
config.json
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
|
||||
@@ -19,8 +19,6 @@ const BusControlTabs = () => {
|
||||
content: <BusControl busControlConfig={busControl} mainConfig={config}/>
|
||||
};
|
||||
});
|
||||
// setTabComponents(components);
|
||||
|
||||
// set the active tab to the first tab
|
||||
if (components.length > 0) {
|
||||
setActiveTab(components[0].id);
|
||||
@@ -55,7 +53,7 @@ const BusControlTabs = () => {
|
||||
{tabComponents.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
className={`px-4 py-2 ${
|
||||
className={`px-4 py-2 text-sm ${
|
||||
activeTab === tab.id
|
||||
? "border-b-2 border-blue-500 text-blue-500"
|
||||
: "text-gray-500"
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: "Jam-Session Web",
|
||||
description: "A web interface for jamming the session",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
+4
-2
@@ -40,7 +40,8 @@ const Page = () => {
|
||||
useEffect(() => {
|
||||
fetchConfig().then((config: Config) => {
|
||||
setAppConfig(config);
|
||||
initConnection(`ws://${window.location.hostname}:${config.webserver.port}`);
|
||||
const webserverIP = config.webserver.ip || window.location.hostname;
|
||||
initConnection(`ws://${webserverIP}:${config.webserver.port}`);
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -55,7 +56,8 @@ const Page = () => {
|
||||
setWebSocketConnected(isConnected);
|
||||
if (!isConnected) {
|
||||
console.log("Reconnecting to WebSocket");
|
||||
initConnection(`ws://${window.location.hostname}:${appConfig.webserver.port}`);
|
||||
const webserverIP = appConfig.webserver.ip || window.location.hostname;
|
||||
initConnection(`ws://${webserverIP}:${appConfig.webserver.port}`);
|
||||
} else {
|
||||
// check if mixer is connected
|
||||
withTimeout(fetchValue("/info"), 1500)
|
||||
|
||||
@@ -5,7 +5,11 @@ export const fetchConfig = async <T>(): Promise<T | null> => {
|
||||
console.error(`Failed to fetch config:`, response.statusText);
|
||||
return null;
|
||||
}
|
||||
return await response.json();
|
||||
const config = await response.json();
|
||||
// apply defaults
|
||||
config.polling_interval = config.polling_interval || 1000;
|
||||
|
||||
return config
|
||||
} catch (error) {
|
||||
console.error(`Error fetching config from:`, error);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user