diff --git a/uiserver/src/App.js b/uiserver/src/App.js index d6e0940..3095a89 100644 --- a/uiserver/src/App.js +++ b/uiserver/src/App.js @@ -1,15 +1,11 @@ import React, { Component } from 'react'; import { BrowserRouter, Routes, Route, Link, Navigate } from 'react-router-dom'; -import { AppBar, Toolbar, Typography, Button, Box, IconButton, CssBaseline } from '@mui/material'; +import { AppBar, Toolbar, Typography, Button, Box, CssBaseline } from '@mui/material'; import { ThemeProvider, createTheme } from '@mui/material/styles'; -import SettingsIcon from '@mui/icons-material/Settings'; -import ShowChartIcon from '@mui/icons-material/ShowChart'; import DashboardIcon from '@mui/icons-material/Dashboard'; import RuleIcon from '@mui/icons-material/Rule'; import SettingsInputComponentIcon from '@mui/icons-material/SettingsInputComponent'; -import Settings from './components/Settings'; -import Chart from './components/Chart'; import Login from './components/Login'; import ViewManager from './components/ViewManager'; import ViewDisplay from './components/ViewDisplay'; @@ -36,23 +32,12 @@ export default class App extends Component { constructor(props) { super(props); this.state = { - selectedChannels: [], user: null, // { username, role, token } loading: true }; } componentDidMount() { - // Load selection from local storage - const saved = localStorage.getItem('selectedChannels'); - if (saved) { - try { - this.setState({ selectedChannels: JSON.parse(saved) }); - } catch (e) { - console.error("Failed to parse saved channels"); - } - } - // Check for existing token const token = localStorage.getItem('authToken'); const username = localStorage.getItem('authUser'); @@ -65,11 +50,6 @@ export default class App extends Component { this.setState({ loading: false }); } - handleSelectionChange = (newSelection) => { - this.setState({ selectedChannels: newSelection }); - localStorage.setItem('selectedChannels', JSON.stringify(newSelection)); - }; - handleLogin = (userData) => { this.setState({ user: userData }); localStorage.setItem('authToken', userData.token); @@ -85,7 +65,7 @@ export default class App extends Component { }; render() { - const { selectedChannels, user, loading } = this.state; + const { user } = this.state; // While checking auth, we could show loader, but it's sync here mostly. @@ -101,20 +81,12 @@ export default class App extends Component { - {user && ( - <> - - - )} {user && user.role === 'admin' && ( <> )} - {user && ( - - )} {user ? ( @@ -129,17 +101,6 @@ export default class App extends Component { } /> } /> } /> - - } /> - - } /> } /> } /> diff --git a/uiserver/src/components/ViewManager.js b/uiserver/src/components/ViewManager.js index f47a045..da39240 100644 --- a/uiserver/src/components/ViewManager.js +++ b/uiserver/src/components/ViewManager.js @@ -178,15 +178,7 @@ class ViewManager extends Component { // Emoji for rule based on action channel getRuleEmoji = (rule) => { - const channel = rule.action?.channel || ''; - const emojis = { - 'CircFanLevel': '🌀', - 'CO2Valve': '🫧', - 'BigDehumid': '💧', - 'TentExhaust': '💨', - 'RoomExhaust': '🌬️' - }; - return emojis[channel] || '⚡'; + return '⚡'; }; // Format conditions for display - returns React components with visual grouping @@ -304,14 +296,7 @@ class ViewManager extends Component { // Format action for display formatRuleAction = (action) => { if (!action?.channel) return '?'; - const channelNames = { - 'CircFanLevel': '🌀 Circ Fan', - 'CO2Valve': '🫧 CO2', - 'BigDehumid': '💧 Big Dehumid', - 'TentExhaust': '💨 Tent Exhaust Fan', - 'RoomExhaust': '🌬️ Room Exhaust' - }; - const name = channelNames[action.channel] || action.channel; + const name = action.channel; if (action.value && action.value.type === 'calculated') { return `${name} = (${action.value.sensorA} - ${action.value.sensorB || '0'}) * ${action.value.factor} + ${action.value.offset}`;