#pragma once // Shared helpers for rendering a BIP39 seed phrase as a numbered word grid and for // splitting a whitespace-separated phrase into words. Used by the full-node seed-phrase // backup dialog and the "migrate to a seed wallet" flow so both present the phrase the // same way the lite welcome wizard does. #include #include #include #include "imgui.h" namespace dragonx { namespace ui { // Split a whitespace-separated seed phrase into its individual words. inline std::vector SplitSeedWords(const std::string& phrase) { std::vector words; std::string cur; for (char c : phrase) { if (c == ' ' || c == '\t' || c == '\n' || c == '\r') { if (!cur.empty()) { words.push_back(cur); cur.clear(); } } else { cur.push_back(c); } } if (!cur.empty()) words.push_back(cur); return words; } // Render the words as a numbered 4-column grid (matches the lite welcome wizard layout). inline void RenderSeedWordGrid(const std::vector& words, float colSpacingPx = 130.0f) { for (size_t i = 0; i < words.size(); ++i) { char cell[96]; std::snprintf(cell, sizeof(cell), "%2zu. %s", i + 1, words[i].c_str()); ImGui::TextUnformatted(cell); if ((i % 4) != 3 && i + 1 < words.size()) ImGui::SameLine(((i % 4) + 1) * colSpacingPx); } } } // namespace ui } // namespace dragonx