Skip to content

Commit e37547b

Browse files
Merge pull request #80 from ImACoderImACoderImACoder/miniMode
mini mode almost ready
2 parents 6047eae + 99b28ca commit e37547b

40 files changed

Lines changed: 4356 additions & 440 deletions

.claude/settings.local.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
"Bash(ls:*)",
1616
"Bash(node:*)",
1717
"Bash(find:*)",
18-
"Bash(powershell:*)"
18+
"Bash(powershell:*)",
19+
"Bash(timeout 5 npm run dev)",
20+
"Bash(npx eslint:*)",
21+
"Bash(TASKKILL /F /IM node.exe)",
22+
"Bash(git checkout:*)"
1923
],
2024
"deny": []
2125
}

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ No test commands are currently configured in package.json. Tests would use the @
7777
- Everything you do must work for mobile
7878

7979
## Code Best Practices
80-
- Always import the conversion function for changing between c and f instead of creating your own
80+
- Always import the conversion function for changing between c and f instead of creating your own
81+
- Always take the isF flag and the correct temperature conversion into account when dealing with temperature

public/fan-solid.svg

Lines changed: 1 addition & 0 deletions
Loading

src/App.jsx

Lines changed: 106 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { useEffect } from "react";
2-
import { BrowserRouter, Routes, Route } from "react-router-dom";
2+
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
33
import BleConnectButtonContainer from "./features/deviceBLEconnection/BleContainer";
44
import VolcanoLoaderLoader from "./features/shared/OutletRenderer/VolcanoLoaderLoader";
55
import Volcano from "./features/deviceInteraction/DeviceInteraction";
6-
import { DeviceInformationWithToggleControls } from "./features/deviceInformation/DeviceInformation";
76
import ContactMe from "./features/contactMe/ContactMe";
87
import { clearCache } from "./services/BleCharacteristicCache";
98
import "bootstrap/dist/css/bootstrap.min.css";
109
import Settings from "./features/settings/Settings";
11-
import styled from "styled-components";
10+
import styled, { createGlobalStyle } from "styled-components";
1211
import { ThemeProvider } from "styled-components";
1312
import { useSelector } from "react-redux";
1413
import GetTheme from "./themes/ThemeProvider";
@@ -19,6 +18,9 @@ import { TouchBackend } from "react-dnd-touch-backend";
1918
import Snowfall from "./features/shared/Snowfall";
2019
import { isMobile } from "./constants/constants";
2120
import DragPreview from "./features/workflowEditor/DND/DragPreview";
21+
import MinimalistLayout from "./features/shared/MinimalistLayout";
22+
import { convertToFahrenheitFromCelsius } from "./services/utils";
23+
import { DEGREE_SYMBOL, MIN_CELSIUS_TEMP, MAX_CELSIUS_TEMP } from "./constants/temperature";
2224
const Div = styled.div`
2325
color: ${(props) => props.theme.primaryFontColor};
2426
background-color: ${(props) => props.theme.backgroundColor};
@@ -27,6 +29,63 @@ const Div = styled.div`
2729
display: flex;
2830
`;
2931

32+
const GlobalStyle = createGlobalStyle`
33+
/* Custom scrollbar styling for Webkit browsers */
34+
*::-webkit-scrollbar {
35+
width: 10px;
36+
height: 10px;
37+
}
38+
39+
*::-webkit-scrollbar-track {
40+
background: ${props => props.theme.backgroundColor};
41+
border-radius: 5px;
42+
}
43+
44+
*::-webkit-scrollbar-thumb {
45+
background: ${props => props.theme.buttonColorMain || props.theme.borderColor};
46+
border-radius: 5px;
47+
border: 1px solid ${props => props.theme.borderColor};
48+
}
49+
50+
*::-webkit-scrollbar-thumb:hover {
51+
background: ${props => props.theme.buttonActive?.backgroundColor || props.theme.primaryFontColor};
52+
}
53+
54+
*::-webkit-scrollbar-corner {
55+
background: ${props => props.theme.backgroundColor};
56+
}
57+
58+
/* Firefox scrollbar styling */
59+
* {
60+
scrollbar-width: thin;
61+
scrollbar-color: ${props => props.theme.buttonColorMain || props.theme.borderColor} ${props => props.theme.backgroundColor};
62+
}
63+
`;
64+
65+
function AppRoutes({ isMinimalistMode }) {
66+
const location = useLocation();
67+
68+
// Show minimalist mode only when connected (not on home page)
69+
const shouldShowMinimalistMode = isMinimalistMode && location.pathname !== "/";
70+
71+
if (shouldShowMinimalistMode) {
72+
return <MinimalistLayout />;
73+
}
74+
75+
return (
76+
<Routes>
77+
<Route path="/" element={<BleConnectButtonContainer />} />
78+
<Route path="Volcano" element={<VolcanoLoaderLoader />}>
79+
<Route path="App" element={<Volcano />} />
80+
<Route path="Settings" element={<Settings />} />
81+
<Route path="WorkflowEditor" element={<WorkflowEditor />} />
82+
<Route path="ContactMe" element={<ContactMe />} />
83+
</Route>
84+
<Route path="*" element={<BleConnectButtonContainer />} />
85+
</Routes>
86+
);
87+
}
88+
3089
function App() {
3190
useEffect(() => {
3291
window.onunhandledrejection = (event) => {
@@ -38,34 +97,64 @@ function App() {
3897
const themeId = useSelector(
3998
(state) => state.settings.config?.currentTheme || GetTheme().themeId
4099
);
100+
const isMinimalistMode = useSelector((state) => state.settings.config?.isMinimalistMode || false);
101+
102+
// Temperature state for page title
103+
const currentTemperature = useSelector((state) => state.deviceInteraction.currentTemperature);
104+
const targetTemperature = useSelector((state) => state.deviceInteraction.targetTemperature);
105+
const isF = useSelector((state) => state.settings.isF);
106+
const isHeatOn = useSelector((state) => state.deviceInteraction.isHeatOn);
41107

42108
useEffect(() => {
43109
document.body.style = `background: ${GetTheme(themeId).backgroundColor};`;
44110
}, [themeId]);
45111

112+
// Update page title with current and target temperature (works for both regular and minimalist mode)
113+
useEffect(() => {
114+
const currentTemp = currentTemperature || currentTemperature === 0
115+
? isF
116+
? convertToFahrenheitFromCelsius(currentTemperature)
117+
: currentTemperature
118+
: currentTemperature;
119+
120+
const targetTemp = targetTemperature || targetTemperature === 0
121+
? isF
122+
? convertToFahrenheitFromCelsius(targetTemperature)
123+
: targetTemperature
124+
: targetTemperature;
125+
126+
const showCurrentTemp = (!isNaN(parseInt(currentTemperature)) &&
127+
currentTemperature > MIN_CELSIUS_TEMP &&
128+
currentTemperature <= MAX_CELSIUS_TEMP) || isHeatOn;
129+
130+
const displayCurrentTemperature = currentTemp && !isNaN(parseInt(currentTemp))
131+
? Math.round(currentTemp)
132+
: null;
133+
134+
const displayTargetTemperature = targetTemp && !isNaN(parseInt(targetTemp))
135+
? Math.round(targetTemp)
136+
: null;
137+
138+
if (displayCurrentTemperature && displayTargetTemperature && showCurrentTemp) {
139+
document.title = `${displayCurrentTemperature}/${displayTargetTemperature}${DEGREE_SYMBOL}${isF ? "F" : "C"} - Onyx`;
140+
} else if (displayCurrentTemperature && showCurrentTemp) {
141+
document.title = `${displayCurrentTemperature}${DEGREE_SYMBOL}${isF ? "F" : "C"} - Onyx`;
142+
} else {
143+
document.title = "Onyx";
144+
}
145+
}, [currentTemperature, targetTemperature, isF, isHeatOn]);
146+
46147
return (
47148
<>
48149
<DndProvider
49150
backend={window.ontouchstart || isMobile ? TouchBackend : HTML5Backend}
50151
>
51152
<ThemeProvider theme={GetTheme(themeId)}>
153+
<GlobalStyle />
52154
<DragPreview />
53155
<Div>
54156
<BrowserRouter>
55-
<Routes>
56-
<Route path="/" element={<BleConnectButtonContainer />} />
57-
<Route path="Volcano" element={<VolcanoLoaderLoader />}>
58-
<Route path="App" element={<Volcano />} />
59-
<Route
60-
path="DeviceInformation"
61-
element={<DeviceInformationWithToggleControls />}
62-
/>
63-
<Route path="Settings" element={<Settings />} />
64-
<Route path="WorkflowEditor" element={<WorkflowEditor />} />
65-
<Route path="ContactMe" element={<ContactMe />} />
66-
</Route>
67-
<Route path="*" element={<BleConnectButtonContainer />} />
68-
</Routes>
157+
<AppRoutes isMinimalistMode={isMinimalistMode} />
69158
</BrowserRouter>
70159
</Div>
71160
</ThemeProvider>

0 commit comments

Comments
 (0)