diff --git a/res/themes/ui.toml b/res/themes/ui.toml index f5b1ef1..7446821 100644 --- a/res/themes/ui.toml +++ b/res/themes/ui.toml @@ -700,6 +700,7 @@ status-pill-bg-alpha = { size = 30 } status-pill-y-offset = { size = 1 } confirmed-threshold = { size = 10 } +# NOTE: [banners.*] and [layout] are parsed as flat sections (kFlatSections in ui_schema.cpp). # Persistent node/RPC error strip at the top of the content column (see App::renderNodeStatusBanner). # Slightly taller than the per-tab sync banner so it comfortably holds the Reconnect/Restart action. [banners.node-status] diff --git a/src/ui/schema/ui_schema.cpp b/src/ui/schema/ui_schema.cpp index 2c2d3e2..76bfb2a 100644 --- a/src/ui/schema/ui_schema.cpp +++ b/src/ui/schema/ui_schema.cpp @@ -21,6 +21,16 @@ namespace dragonx { namespace ui { namespace schema { +namespace { +// 2-level sections (sectionName.elementName -> {style object}) shared by all loaders. +const char* const kFlatSections[] = {"business", "animations", "console", + "backdrop", "shutdown", "notifications", "status-bar", + "qr-code", "content-area", "style", "responsive", + "spacing", "spacing-tokens", "button", "dialog", "input", "fonts", + "inline-dialogs", "sidebar", "panels", "typography", + "effects", "security", "banners", "layout"}; +} // namespace + // ============================================================================ // Singleton // ============================================================================ @@ -81,12 +91,7 @@ bool UISchema::loadFromFile(const std::string& path) { } // Parse flat sections (2-level: sectionName.elementName → {style object}) - for (const auto& flatSection : {"business", "animations", "console", - "backdrop", "shutdown", "notifications", "status-bar", - "qr-code", "content-area", "style", "responsive", - "spacing", "spacing-tokens", "button", "dialog", "input", "fonts", - "inline-dialogs", "sidebar", "panels", "typography", - "effects", "security"}) { + for (const char* flatSection : kFlatSections) { if (auto* sec = root[flatSection].as_table()) { parseFlatSection(static_cast(sec), flatSection); } @@ -170,12 +175,7 @@ bool UISchema::loadFromString(const std::string& tomlStr, const std::string& lab } // Parse flat sections (2-level: sectionName.elementName → {style object}) - for (const auto& flatSection : {"business", "animations", "console", - "backdrop", "shutdown", "notifications", "status-bar", - "qr-code", "content-area", "style", "responsive", - "spacing", "spacing-tokens", "button", "dialog", "input", "fonts", - "inline-dialogs", "sidebar", "panels", "typography", - "effects", "security"}) { + for (const char* flatSection : kFlatSections) { if (auto* sec = root[flatSection].as_table()) { parseFlatSection(static_cast(sec), flatSection); } @@ -250,12 +250,7 @@ bool UISchema::mergeOverlayFromFile(const std::string& path) { } // Merge all flat sections (2-level) - for (const auto& flatSection : {"business", "animations", "console", - "backdrop", "shutdown", "notifications", "status-bar", - "qr-code", "content-area", "style", "responsive", - "spacing", "spacing-tokens", "button", "dialog", "input", "fonts", - "inline-dialogs", "sidebar", "panels", "typography", - "effects", "security"}) { + for (const char* flatSection : kFlatSections) { if (auto* sec = root[flatSection].as_table()) { parseFlatSection(static_cast(sec), flatSection); }