refactor(ui): semantic status text uses material tokens instead of hardcoded colors
Finishes the feedback-conventions hygiene thread: ~30 hardcoded ImVec4 green / red / amber literals used for success / error / warning text now use material::Success/Error/WarningVec4(), so semantic status colors follow the active skin and stay legible in every theme (several hardcoded greens/reds read poorly on the light/pastel skins). Covers validate-address, transaction-details, key-export, export-all-keys, about, the Settings confirmations/lock state, and the encryption/decryption dialogs. Brand/logo colors and muted white/grey (disabled) text are left as-is; dynamic-alpha animated indicators are untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -77,7 +77,7 @@ void RenderAboutDialog(App* app, bool* p_open)
|
||||
#ifdef DRAGONX_DEBUG
|
||||
ImGui::Text("%s", TR("about_build_type"));
|
||||
ImGui::SameLine(valX);
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.0f, 1.0f), "%s", TR("about_debug"));
|
||||
ImGui::TextColored(material::WarningVec4(), "%s", TR("about_debug"));
|
||||
#else
|
||||
ImGui::Text("%s", TR("about_build_type"));
|
||||
ImGui::SameLine(valX);
|
||||
@@ -92,7 +92,7 @@ void RenderAboutDialog(App* app, bool* p_open)
|
||||
|
||||
ImGui::Text("%s", TR("about_daemon"));
|
||||
ImGui::SameLine(valX);
|
||||
ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), "%s", TR("connected"));
|
||||
ImGui::TextColored(material::SuccessVec4(), "%s", TR("connected"));
|
||||
|
||||
const auto& state = app->getWalletState();
|
||||
ImGui::Text("%s", TR("about_chain"));
|
||||
|
||||
@@ -117,7 +117,7 @@ void ExportAllKeysDialog::render(App* app)
|
||||
} else if (!s_status.empty()) {
|
||||
ImGui::Spacing();
|
||||
ImGui::PushTextWrapPos(0.0f);
|
||||
ImGui::TextColored(ImVec4(0.8f, 0.3f, 0.3f, 1.0f), "%s", s_status.c_str());
|
||||
ImGui::TextColored(material::ErrorVec4(), "%s", s_status.c_str());
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ void KeyExportDialog::render(App* app)
|
||||
if (s_fetching) {
|
||||
ImGui::TextColored(material::WarningVec4(), "%s%s", TR("key_export_fetching_base"), material::LoadingDots());
|
||||
} else if (!s_error.empty()) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), TR("error_format"), s_error.c_str());
|
||||
ImGui::TextColored(material::ErrorVec4(), TR("error_format"), s_error.c_str());
|
||||
// Not a dead-end: clearing the error falls back through to the Reveal button next frame.
|
||||
ImGui::Spacing();
|
||||
if (material::TactileButton(TR("retry"), ImVec2(revealBtn.width, 0), S.resolveFont(revealBtn.font))) {
|
||||
@@ -132,7 +132,7 @@ void KeyExportDialog::render(App* app)
|
||||
} else if (s_key.empty() && s_address.length() < 26) {
|
||||
// Guard against an empty/blatantly-malformed address before dispatching a doomed reveal.
|
||||
// (Also avoids reading s_address[0] on an empty string in the Reveal branch below.)
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "%s", TR("invalid_address"));
|
||||
ImGui::TextColored(material::ErrorVec4(), "%s", TR("invalid_address"));
|
||||
} else if (s_key.empty() && app->getWalletState().isLocked()) {
|
||||
// Reveal would just fail with a locked-wallet RPC error — say so and offer to unlock.
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, material::Warning());
|
||||
|
||||
@@ -58,16 +58,16 @@ void TransactionDetailsDialog::render(App* app)
|
||||
ImVec4 type_color;
|
||||
std::string type_display;
|
||||
if (tx.type == "receive") {
|
||||
type_color = ImVec4(0.3f, 0.8f, 0.3f, 1.0f);
|
||||
type_color = material::SuccessVec4();
|
||||
type_display = TR("tx_received");
|
||||
} else if (tx.type == "send") {
|
||||
type_color = ImVec4(0.8f, 0.3f, 0.3f, 1.0f);
|
||||
type_color = material::ErrorVec4();
|
||||
type_display = TR("tx_sent");
|
||||
} else if (tx.type == "generate" || tx.type == "mined") {
|
||||
type_color = ImVec4(0.3f, 0.6f, 0.9f, 1.0f);
|
||||
type_display = TR("tx_mined");
|
||||
} else if (tx.type == "immature") {
|
||||
type_color = ImVec4(0.8f, 0.8f, 0.3f, 1.0f);
|
||||
type_color = material::WarningVec4();
|
||||
type_display = TR("tx_immature");
|
||||
} else {
|
||||
type_color = ImVec4(0.7f, 0.7f, 0.7f, 1.0f);
|
||||
@@ -79,11 +79,11 @@ void TransactionDetailsDialog::render(App* app)
|
||||
|
||||
// Confirmations badge
|
||||
if (tx.confirmations == 0) {
|
||||
ImGui::TextColored(ImVec4(0.8f, 0.6f, 0.0f, 1.0f), "%s", TR("pending"));
|
||||
ImGui::TextColored(material::WarningVec4(), "%s", TR("pending"));
|
||||
} else if (tx.confirmations < 10) {
|
||||
ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.3f, 1.0f), TR("tx_confirmations"), tx.confirmations);
|
||||
ImGui::TextColored(material::WarningVec4(), TR("tx_confirmations"), tx.confirmations);
|
||||
} else {
|
||||
ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), TR("tx_confirmations"), tx.confirmations);
|
||||
ImGui::TextColored(material::SuccessVec4(), TR("tx_confirmations"), tx.confirmations);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
@@ -94,9 +94,9 @@ void TransactionDetailsDialog::render(App* app)
|
||||
ImGui::Text("%s", TR("amount_label"));
|
||||
ImGui::SameLine(lbl.position);
|
||||
if (tx.amount >= 0) {
|
||||
ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), "+%.8f DRGX", tx.amount);
|
||||
ImGui::TextColored(material::SuccessVec4(), "+%.8f DRGX", tx.amount);
|
||||
} else {
|
||||
ImGui::TextColored(ImVec4(0.8f, 0.3f, 0.3f, 1.0f), "%.8f DRGX", tx.amount);
|
||||
ImGui::TextColored(material::ErrorVec4(), "%.8f DRGX", tx.amount);
|
||||
}
|
||||
|
||||
// USD equivalent if price available
|
||||
|
||||
@@ -183,7 +183,7 @@ void ValidateAddressDialog::render(App* app)
|
||||
|
||||
if (s_validating) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%s", TR("validating"));
|
||||
ImGui::TextColored(material::WarningVec4(), "%s", TR("validating"));
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
@@ -194,15 +194,15 @@ void ValidateAddressDialog::render(App* app)
|
||||
ImGui::Spacing();
|
||||
|
||||
if (!s_error_message.empty()) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), TR("error_format"), s_error_message.c_str());
|
||||
ImGui::TextColored(material::ErrorVec4(), TR("error_format"), s_error_message.c_str());
|
||||
} else {
|
||||
// Valid/Invalid indicator
|
||||
ImGui::Text("%s", TR("validate_status"));
|
||||
ImGui::SameLine(lbl.position);
|
||||
if (s_is_valid) {
|
||||
ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), "%s", TR("validate_valid"));
|
||||
ImGui::TextColored(material::SuccessVec4(), "%s", TR("validate_valid"));
|
||||
} else {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "%s", TR("validate_invalid"));
|
||||
ImGui::TextColored(material::ErrorVec4(), "%s", TR("validate_invalid"));
|
||||
}
|
||||
|
||||
if (s_is_valid) {
|
||||
@@ -219,7 +219,7 @@ void ValidateAddressDialog::render(App* app)
|
||||
ImGui::TextDisabled("%s", TR(app->isLiteBuild() ? "validate_ownership_unknown_lite"
|
||||
: "validate_ownership_unknown_offline"));
|
||||
} else if (s_is_mine) {
|
||||
ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), "%s", TR("validate_is_mine"));
|
||||
ImGui::TextColored(material::SuccessVec4(), "%s", TR("validate_is_mine"));
|
||||
} else {
|
||||
ImGui::TextDisabled("%s", TR("validate_not_mine"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user