Make webserver more compact

This commit is contained in:
Daniel Öster 2025-06-16 23:34:06 +03:00
parent 2e317d9d1c
commit ec2d871475
3 changed files with 10 additions and 7 deletions

View file

@ -84,6 +84,7 @@ String advanced_battery_processor(const String& var) {
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; " "button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
"cursor: pointer; border-radius: 10px; }"; "cursor: pointer; border-radius: 10px; }";
content += "button:hover { background-color: #3A4A52; }"; content += "button:hover { background-color: #3A4A52; }";
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
content += "</style>"; content += "</style>";
content += "<button onclick='goToMainPage()'>Back to main page</button>"; content += "<button onclick='goToMainPage()'>Back to main page</button>";

View file

@ -14,6 +14,7 @@ String settings_processor(const String& var) {
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; " "button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
"cursor: pointer; border-radius: 10px; }"; "cursor: pointer; border-radius: 10px; }";
content += "button:hover { background-color: #3A4A52; }"; content += "button:hover { background-color: #3A4A52; }";
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
content += "</style>"; content += "</style>";
content += "<button onclick='goToMainPage()'>Back to main page</button>"; content += "<button onclick='goToMainPage()'>Back to main page</button>";

View file

@ -883,20 +883,21 @@ String get_firmware_info_processor(const String& var) {
String processor(const String& var) { String processor(const String& var) {
if (var == "X") { if (var == "X") {
String content = ""; String content = "";
content += "<h2>" + String(ssidAP) + "</h2>"; // ssidAP name is used as header name
//Page format
content += "<style>"; content += "<style>";
content += "body { background-color: black; color: white; }"; content += "body { background-color: black; color: white; }";
content += content +=
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; " "button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
"cursor: pointer; border-radius: 10px; }"; "cursor: pointer; border-radius: 10px; }";
content += "button:hover { background-color: #3A4A52; }"; content += "button:hover { background-color: #3A4A52; }";
content += "h2 { font-size: 1.2em; margin: 0.3em 0 0.5em 0; }";
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
content += "</style>"; content += "</style>";
// Start a new block with a specific background color // Compact header
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>"; content += "<h2>" + String(ssidAP) + "</h2>";
// Show version number // Start content block
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
content += "<h4>Software: " + String(version_number); content += "<h4>Software: " + String(version_number);
// Show hardware used: // Show hardware used:
#ifdef HW_LILYGO #ifdef HW_LILYGO
@ -1442,14 +1443,14 @@ String processor(const String& var) {
content += "<button onclick='logout()'>Logout</button>"; content += "<button onclick='logout()'>Logout</button>";
if (!datalayer.system.settings.equipment_stop_active) if (!datalayer.system.settings.equipment_stop_active)
content += content +=
"<br/><br/><button style=\"background:red;color:white;cursor:pointer;\"" "<br/><button style=\"background:red;color:white;cursor:pointer;\""
" onclick=\"" " onclick=\""
"if(confirm('This action will attempt to open contactors on the battery. Are you " "if(confirm('This action will attempt to open contactors on the battery. Are you "
"sure?')) { estop(true); }\"" "sure?')) { estop(true); }\""
">Open Contactors</button><br/>"; ">Open Contactors</button><br/>";
else else
content += content +=
"<br/><br/><button style=\"background:green;color:white;cursor:pointer;\"" "<br/><button style=\"background:green;color:white;cursor:pointer;\""
"20px;font-size:16px;font-weight:bold;cursor:pointer;border-radius:5px; margin:10px;" "20px;font-size:16px;font-weight:bold;cursor:pointer;border-radius:5px; margin:10px;"
" onclick=\"" " onclick=\""
"if(confirm('This action will attempt to close contactors and enable power transfer. Are you sure?')) { " "if(confirm('This action will attempt to close contactors and enable power transfer. Are you sure?')) { "