Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darkmode toggle and various other UX/UI improvements #667

Merged
merged 14 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '37 0 * * *'

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
10 changes: 9 additions & 1 deletion Code/data/calib.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
<body>
<div id="site">
<header>
<span>SPA Manual calibration</span>
<form id="darkModeForm">
<label class="switch">
<input type="checkbox" id="darkModeToggle" onchange="toggleDarkMode()">
<span class="slider round"></span>
</label>
</form>
<a href="./"><div id="header"><span>SPA Manual calibration</span><span>Lay-Z-Spa Module</span></div></a>
<a href="javascript:void(0);" class="topnavicon" onclick="topNav()"></a>
</header>

Expand Down Expand Up @@ -81,5 +87,7 @@
}

</script>
<script src="darkmode.js" type="text/javascript"></script>

</body>
</html>
10 changes: 9 additions & 1 deletion Code/data/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
<body>
<div id="site">
<header>
<span>SPA Config</span>
<form id="darkModeForm">
<label class="switch">
<input type="checkbox" id="darkModeToggle" onchange="toggleDarkMode()">
<span class="slider round"></span>
</label>
</form>
<a href="./"><div id="header"><span>SPA Config</span><span>Lay-Z-Spa Module</span></div></a>
<a href="javascript:void(0);" class="topnavicon" onclick="topNav()"></a>
</header>

Expand Down Expand Up @@ -415,5 +421,7 @@ <h2>Command queue</h2>
if(obj.checked) obj.checked = false;
}
</script>
<script src="darkmode.js" type="text/javascript"></script>

</body>
</html>
24 changes: 24 additions & 0 deletions Code/data/darkmode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// will create a dark mode and store status in local storage

// Check if the dark mode status is stored in localStorage
var darkModeToggle = document.getElementById("darkModeToggle");

if (localStorage.getItem("darkModeStatus")) {
// Update the dark mode toggle switch and status text
darkModeToggle.checked = localStorage.getItem("darkModeStatus") === "On";

// Set dark mode immediately based on stored status
toggleDarkMode();
}

function toggleDarkMode() {
if (darkModeToggle.checked) {
// Dark Mode is On
document.documentElement.classList.add("darkmode");
localStorage.setItem("darkModeStatus", "On");
} else {
// Dark Mode is Off
document.documentElement.classList.remove("darkmode");
localStorage.setItem("darkModeStatus", "Off");
}
}
12 changes: 11 additions & 1 deletion Code/data/hwconfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
<body>
<div id="site">
<header>
<span>Hardware Config</span>

<form id="darkModeForm">
<label class="switch">
<input type="checkbox" id="darkModeToggle" onchange="toggleDarkMode()">
<span class="slider round"></span>
</label>
</form>
<a href="./"><div id="header"><span>Hardware Config</span><span>Lay-Z-Spa Module</span></div></a>
<a href="javascript:void(0);" class="topnavicon" onclick="topNav()"></a>
</header>

Expand Down Expand Up @@ -349,5 +356,8 @@ <h2>Hardware:</h2>
}

</script>

<script src="darkmode.js" type="text/javascript"></script>

</body>
</html>
10 changes: 9 additions & 1 deletion Code/data/hwtestinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
<body>
<div id="site">
<header>
<span>Hardware test</span>
<form id="darkModeForm">
<label class="switch">
<input type="checkbox" id="darkModeToggle" onchange="toggleDarkMode()">
<span class="slider round"></span>
</label>
</form>
<a href="./"><div id="header"><span>Hardware test</span><span>Lay-Z-Spa Module</span></div></a>
<a href="javascript:void(0);" class="topnavicon" onclick="topNav()"></a>
</header>

Expand Down Expand Up @@ -44,6 +50,8 @@

</section>
</div>

<script src="darkmode.js" type="text/javascript"></script>

</body>
</html>
38 changes: 26 additions & 12 deletions Code/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@
<link rel="icon" type="image/png" sizes="48x48" href="favicon.png">
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="main.css">
<meta name="theme-color" content="#0066BF">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta name="theme-color" content="#0f4677">
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1">
<script src="function.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script>
</head>


<body>
<div id="site">
<header>
<span id="header">Lay-Z-Spa Module</span>

<form id="darkModeForm">
<label class="switch">
<input type="checkbox" id="darkModeToggle" onchange="toggleDarkMode()">
<span class="slider round"></span>
</label>
</form>
<a href="./"><div id="header"><span>Lay-Z-Spa Module</span><span>by visualapproach</span></div></a>
<a href="javascript:void(0);" class="topnavicon" onclick="topNav()"></a>
</header>

Expand All @@ -34,6 +42,14 @@
<a href="javascript:void(0);" class="bgred" onclick="sendCommand('restartEsp')">Restart ESP</a>
</div>

<section id="sectionDisplay">
<table>
<tr>
<td class="center"><div id="display">[DSP]</div></td>
</tr>
</table>
</section>

<section id="sectionTemperature">
<div class="visualapproach"></div>
<h2>Temperature:</h2>
Expand All @@ -53,14 +69,6 @@ <h2>Temperature:</h2>
</table>
</section>

<section id="sectionDisplay">
<table>
<tr>
<td class="center"><div id="display">[DSP]</div></td>
</tr>
</table>
</section>

<section id="sectionControl">
<h2>Control:</h2>
<table id="tableSlider">
Expand Down Expand Up @@ -256,8 +264,8 @@ <h2>Totals:</h2>

function setWebConfig()
{
document.getElementById('sectionTemperature').style.display = (localStorage.getItem('showSectionTemperature') !== 'false' ? 'block' : 'none');
document.getElementById('sectionDisplay').style.display = (localStorage.getItem('showSectionDisplay') !== 'false' ? 'block' : 'none');
document.getElementById('sectionTemperature').style.display = (localStorage.getItem('showSectionTemperature') !== 'false' ? 'block' : 'none');
document.getElementById('sectionControl').style.display = (localStorage.getItem('showSectionControl') !== 'false' ? 'block' : 'none');
document.getElementById('sectionButtons').style.display = (localStorage.getItem('showSectionButtons') !== 'false' ? 'block' : 'none');
document.getElementById('sectionTimer').style.display = (localStorage.getItem('showSectionTimer') !== 'false' ? 'block' : 'none');
Expand Down Expand Up @@ -297,6 +305,12 @@ <h2>Totals:</h2>
sendCommand('resetTotals');
}
}



</script>

<script src="darkmode.js" type="text/javascript"></script>

</body>
</html>
Loading