feat(market): explain why the portfolio Save button is disabled
Hovering the disabled Save button now shows which requirement is missing
(name / at least one address / a manual price above 0), mirroring the
send-tab disabled-submit tooltip idiom (IsItemHovered(AllowWhenDisabled)).
The hint only appears for a validation gap — not the self-evident "nothing
changed" case.
Adds portfolio_save_need_{name,address,price} to the English source and all
eight translations; rebuilds the CJK subset font for the new JA/KO/ZH glyphs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1042,6 +1042,13 @@ static void RenderPortfolioEditor(App* app)
|
||||
if (material::TactileButton(TR("portfolio_save"), ImVec2(bw, addH))) pfCommitIfNeeded(app);
|
||||
ImGui::EndDisabled();
|
||||
ImGui::EndDisabled();
|
||||
// Explain why Save is disabled — but only for a validation gap, not the "nothing changed"
|
||||
// (!selDirty) case, which is self-evident. Priority mirrors pfWorkingValid's checks.
|
||||
if (!pfWorkingValid() && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
if (pfEditLabel().empty()) material::Tooltip("%s", TR("portfolio_save_need_name"));
|
||||
else if (s_pfEdit.addrs.empty()) material::Tooltip("%s", TR("portfolio_save_need_address"));
|
||||
else material::Tooltip("%s", TR("portfolio_save_need_price"));
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild(); // ##pfDetail
|
||||
|
||||
@@ -1405,6 +1405,9 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["portfolio_cancel"] = "Cancel";
|
||||
strings_["portfolio_revert"] = "Revert";
|
||||
strings_["portfolio_close"] = "Close";
|
||||
strings_["portfolio_save_need_name"] = "Enter a name to save this group.";
|
||||
strings_["portfolio_save_need_address"] = "Add at least one address to save.";
|
||||
strings_["portfolio_save_need_price"] = "Enter a manual price above 0 to save.";
|
||||
strings_["portfolio_untitled"] = "Untitled";
|
||||
strings_["portfolio_detail_empty"] = "Select a group on the left, or add one, to edit it.";
|
||||
strings_["portfolio_add_to"] = "Add to portfolio";
|
||||
|
||||
Reference in New Issue
Block a user