feat(transactions): shield detail view, immature-coinbase status, clear-filters (F015/F065/F097)
UX audit, Transactions surface (batch 1): - F015: opening details for an autoshield row now shows the SHIELD view (positive amount, from mining t-addr → z-addr) via a synthesized TransactionInfo, instead of its raw send leg which read as "Sent -amount". - F065: a mined coinbase row at 10-99 confirmations shows "Immature (n/100)" in amber instead of a green "Confirmed" — the funds aren't spendable until 100. - F097: the "no matching" empty state gets a one-click "Clear filters" button (resets the type filter and search). New strings (English). Build + tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,22 @@ static std::string timeAgo(int64_t timestamp) {
|
||||
return dragonx::util::formatTimeAgo(timestamp);
|
||||
}
|
||||
|
||||
// Build a TransactionInfo from the merged display row — used to open the detail dialog for an autoshield
|
||||
// row with the SHIELD view (positive amount, from mining t-addr, to z-addr), instead of its raw send leg,
|
||||
// which showed a shield as "Sent -amount". (F015)
|
||||
static TransactionInfo displayTxToInfo(const DisplayTx& tx) {
|
||||
TransactionInfo t;
|
||||
t.txid = tx.txid;
|
||||
t.type = tx.display_type;
|
||||
t.amount = (tx.display_type == "shield") ? std::abs(tx.amount) : tx.amount;
|
||||
t.timestamp = tx.timestamp;
|
||||
t.confirmations = tx.confirmations;
|
||||
t.address = tx.address;
|
||||
t.from_address = tx.from_address;
|
||||
t.memo = tx.memo;
|
||||
return t;
|
||||
}
|
||||
|
||||
// Draw a small transaction-type icon
|
||||
static void DrawTxIcon(ImDrawList* dl, const std::string& type,
|
||||
float cx, float cy, float /*s*/, ImU32 col)
|
||||
@@ -751,6 +767,13 @@ void RenderTransactionsTab(App* app)
|
||||
}
|
||||
} else if (filtered_indices.empty()) {
|
||||
material::DrawEmptyState(ICON_MD_SEARCH_OFF, TR("no_matching"));
|
||||
// One-click reset — otherwise the user must find the type combo and clear the search by hand. (F097)
|
||||
const float bw = 160.0f * Layout::dpiScale();
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + std::max(0.0f, (ImGui::GetContentRegionAvail().x - bw) * 0.5f));
|
||||
if (material::TactileButton(TR("clear_filters"), ImVec2(bw, 0), schema::UI().resolveFont("button"))) {
|
||||
type_filter = 0;
|
||||
search_filter[0] = '\0';
|
||||
}
|
||||
} else {
|
||||
float rowH = body2->LegacySize + capFont->LegacySize + Layout::spacingLg() + Layout::spacingMd();
|
||||
float innerW = ImGui::GetContentRegionAvail().x;
|
||||
@@ -862,6 +885,11 @@ void RenderTransactionsTab(App* app)
|
||||
statusStr = TR("tx_stale_pending"); statusCol = Warning();
|
||||
} else if (tx.confirmations == 0) {
|
||||
statusStr = TR("pending"); statusCol = Warning();
|
||||
} else if ((tx.display_type == "generate" || tx.display_type == "mined") && tx.confirmations < 100) {
|
||||
// Coinbase isn't spendable until 100 confs — don't show a green "Confirmed" at
|
||||
// 10-99 as if it were settled. (F065)
|
||||
snprintf(buf, sizeof(buf), TR("tx_immature"), tx.confirmations);
|
||||
statusStr = buf; statusCol = Warning();
|
||||
} else if (tx.confirmations < 10) {
|
||||
snprintf(buf, sizeof(buf), TR("conf_count"), tx.confirmations);
|
||||
statusStr = buf; statusCol = Warning();
|
||||
@@ -944,7 +972,8 @@ void RenderTransactionsTab(App* app)
|
||||
}
|
||||
if (ImGui::MenuItem(TR("view_details"))) {
|
||||
if (tx.orig_idx >= 0 && tx.orig_idx < (int)state.transactions.size())
|
||||
TransactionDetailsDialog::show(state.transactions[tx.orig_idx]);
|
||||
if (tx.is_shield) TransactionDetailsDialog::show(displayTxToInfo(tx));
|
||||
else TransactionDetailsDialog::show(state.transactions[tx.orig_idx]);
|
||||
}
|
||||
effects::ImGuiAcrylic::EndAcrylicPopup();
|
||||
}
|
||||
@@ -1018,7 +1047,8 @@ void RenderTransactionsTab(App* app)
|
||||
ImGui::SameLine();
|
||||
if (TactileSmallButton(TrId("full_details", "detail").c_str(), S.resolveFont("button"))) {
|
||||
if (tx.orig_idx >= 0 && tx.orig_idx < (int)state.transactions.size())
|
||||
TransactionDetailsDialog::show(state.transactions[tx.orig_idx]);
|
||||
if (tx.is_shield) TransactionDetailsDialog::show(displayTxToInfo(tx));
|
||||
else TransactionDetailsDialog::show(state.transactions[tx.orig_idx]);
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
@@ -1348,6 +1348,8 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["tx_loading_fetching_transparent"] = "Fetching transparent history";
|
||||
strings_["tx_loading_history_progress"] = "Loading older history (%d%%)";
|
||||
strings_["no_matching"] = "No matching transactions";
|
||||
strings_["clear_filters"] = "Clear filters";
|
||||
strings_["tx_immature"] = "Immature (%d/100)";
|
||||
strings_["transaction_id"] = "TRANSACTION ID";
|
||||
strings_["search_placeholder"] = "Search...";
|
||||
strings_["all_filter"] = "All";
|
||||
|
||||
Reference in New Issue
Block a user