10 String iconStr = icon.length() > 0 ? icon +
" " :
"";
11 String html =
"<!DOCTYPE html><html><head><meta charset='UTF-8'>";
12 html +=
"<meta name='viewport' content='width=device-width, initial-scale=1.0'>";
13 html +=
"<title>" + iconStr + title +
"</title>";
15 html +=
"</head><body><div class='container'>";
21 return "</div>" + String(
getToastHTML()) +
"</body></html>";
35 String content =
"<h1>" UI_ICON_ERROR " Ошибка " + String(errorCode) +
"</h1>";
36 content +=
"<div class='msg msg-error'>" UI_ICON_ERROR " " + errorMessage +
"</div>";
37 content +=
"<p><a href='/' style='color: #4CAF50; text-decoration: none;'>← Вернуться на главную</a></p>";
42String
generateSuccessPage(
const String& title,
const String& message,
const String& redirectUrl,
int redirectDelay)
45 content +=
"<div class='msg msg-success'>" UI_ICON_SUCCESS " " + message +
"</div>";
47 if (redirectUrl.length() > 0)
49 content +=
"<p><em>Перенаправление через " + String(redirectDelay) +
" секунд...</em></p>";
50 content +=
"<script>setTimeout(function(){window.location.href='" + redirectUrl +
"';}, " +
51 String(redirectDelay * 1000) +
");</script>";
66String
generateForm(
const String& action,
const String& method,
const String& formContent,
const String& buttonText,
67 const String& buttonIcon)
69 String html =
"<form action='" + action +
"' method='" + method +
"'>";
85 String html =
"<div class='section'>";
86 html +=
"<h2>" + title +
"</h2>";
88 if (helpText.length() > 0)
90 html +=
"<div class='help'>" UI_ICON_INFO " " + helpText +
"</div>";
107String
generateInputField(
const String&
id,
const String& name,
const String& label,
const String& value,
108 const String& type,
bool required,
const String& placeholder)
110 String html =
"<div class='form-group'>";
111 html +=
"<label for='" +
id +
"'>" + label +
":</label>";
112 html +=
"<input type='" + type +
"' id='" +
id +
"' name='" + name +
"' value='" + value +
"'";
113 if (required) html +=
" required";
114 if (placeholder.length() > 0) html +=
" placeholder='" + placeholder +
"'";
129 String html =
"<div class='form-group'>";
130 html +=
"<label for='" +
id +
"'>" + label +
":</label>";
131 html +=
"<input type='checkbox' id='" +
id +
"' name='" + name +
"'";
132 if (checked) html +=
" checked";
148String
generateNumberField(
const String&
id,
const String& name,
const String& label,
int value,
int min,
int max,
151 String html =
"<div class='form-group'>";
152 html +=
"<label for='" +
id +
"'>" + label +
":</label>";
153 html +=
"<input type='number' id='" +
id +
"' name='" + name +
"' value='" + String(value) +
"'";
154 html +=
" min='" + String(min) +
"' max='" + String(max) +
"' step='" + String(step) +
"'>";
166 return "<div class='msg msg-error'>" UI_ICON_ERROR " " + message +
"</div>";
177 String content =
"<h1>" + icon +
" " + title +
"</h1>";
178 content +=
"<div class='msg msg-error'>" UI_ICON_ERROR " Недоступно в режиме точки доступа</div>";
179 content +=
"<p>Эта функция доступна только после подключения к WiFi сети.</p>";
const char * getUnifiedCSS()
String generateButton(ButtonType type, const char *icon, const char *text, const char *action)
const char * getToastHTML()
String generateErrorPage(int errorCode, const String &errorMessage)
Генерация страницы ошибки
String generateApModeUnavailablePage(const String &title, const String &icon)
Генерация страницы "Недоступно в AP режиме".
String generateConfigSection(const String &title, const String &content, const String &helpText)
Генерация секции конфигурации
String generateBasePage(const String &title, const String &content, const String &icon)
Генерация базовой HTML структуры с навигацией
String generateSuccessPage(const String &title, const String &message, const String &redirectUrl, int redirectDelay)
Генерация страницы успеха
String generatePageHeader(const String &title, const String &icon)
Генерация заголовка HTML страницы
String generateNumberField(const String &id, const String &name, const String &label, int value, int min, int max, int step)
Генерация числового поля с валидацией
String generatePageFooter()
Генерация футера HTML страницы
String generateForm(const String &action, const String &method, const String &formContent, const String &buttonText, const String &buttonIcon)
Генерация формы с общими элементами
String generateInputField(const String &id, const String &name, const String &label, const String &value, const String &type, bool required, const String &placeholder)
Генерация поля ввода
String generateCheckboxField(const String &id, const String &name, const String &label, bool checked)
Генерация поля чекбокса
String generateFormError(const String &message)
Генерация сообщения об ошибке в форме