17 std::ostringstream html;
38 << header.
Pages <<
")</font>";
45static std::string
FooterChunk(std::string_view keyColor, std::string_view keyText,
const std::string& label)
47 std::ostringstream html;
48 html <<
"<font color='" << keyColor <<
"'>" << keyText <<
"</font> "
56 auto label = [&](std::string_view key, std::string_view fallback) {
57 return translations.
GetOr(key, slot, fallback);
61 std::string closeLabel = isSubmenu ? label(
"nav.back",
"Back") : label(
"nav.close",
"Close");
64 std::ostringstream row1;
67 bool hasStepHint = selectedRowSteps || isPaginated;
77 const std::string_view selectKey = selectedRowSteps ?
"nav.confirm" :
"nav.select";
78 const std::string_view selectFallback = selectedRowSteps ?
"Confirm" :
"Select";
81 std::string closeChunk =
FooterChunk(closeColor,
"[R]", closeLabel);
83 std::ostringstream html;
84 html <<
"<font class='fontSize-s'>" << row1.str();
90 html <<
"<br>" << closeChunk;
94 html <<
" · " << closeChunk;
108 if (row.
Value.empty())
123 value =
"[" + value +
"]";
127 value =
"< " + value +
" >";
130 text +=
": " + value;
142 std::ostringstream html;
144 for (
int i = pageStart; i < pageEnd; ++i)
151 std::string title =
RowText(row);
159 else if (!selectable)
186 int itemCount =
static_cast<int>(menu->
Items.size());
192 std::ostringstream html;
198 .Pages = totalPages});
202 MenuRow selected{.Enabled =
false};
205 const std::string empty = translations.
GetOr(
"menu.empty", view.
Slot,
"Nothing here");
210 html <<
RenderItems(view, pageStart, pageEnd, selected);
221 std::ostringstream html;
225 <<
"<font class='fontSize-s' color='" <<
Palette::TextMuted <<
"'>Type your answer in chat</font><br>"
226 <<
"<font class='fontSize-s'>"
static std::string EscapeHtml(std::string_view text)
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
std::string GetOr(std::string_view key, int slot, std::string_view fallback) const
constexpr std::string_view TextDisabled
constexpr std::string_view Highlight
constexpr std::string_view TextDefault
constexpr std::string_view AccentBright
constexpr std::string_view TextMuted
constexpr std::string_view Accent
@ Choice
Carries one of several values, stepped left and right.
@ Toggle
Carries an on/off value.
std::string RenderMenuHtml(const Menu *menu, const CenterHtmlView &view, Translations &translations)
std::string RenderCaptureOverlay(const std::string &menuTitle, std::string_view prompt)
constexpr int PageCount(int items, int perPage)
std::string RenderFooter(bool isSubmenu, bool isPaginated, bool selectedRowSteps, int slot, Translations &translations)
std::string RenderHeader(const CenterHtmlHeader &header)
static std::string RowText(const MenuRow &row)
constexpr int CenterHtmlRowsPerPage
static std::string FooterChunk(std::string_view keyColor, std::string_view keyText, const std::string &label)
static std::string RenderItems(const CenterHtmlView &view, int pageStart, int pageEnd, MenuRow &selected)
std::function< MenuRow(int index)> Describe
std::string_view Breadcrumb