ui: skin wallets page with right-aligned list and action buttons
This commit is contained in:
1 parent
37c5362913
commit
698849c112
1 file changed
+23
-10
@@ -960,29 +960,41 @@ namespace Decentralized
|
|||||||
private static void WalletsPage(CustomUIBuilder b)
|
private static void WalletsPage(CustomUIBuilder b)
|
||||||
{
|
{
|
||||||
var d = Session.Data;
|
var d = Session.Data;
|
||||||
b.AddLabel(L.T("wallets.count", d.Wallets.Count, Tuning.WalletMax));
|
b.AddLabel(L.T("wallets.count", d.Wallets.Count, Tuning.WalletMax), "wallets_count_dim");
|
||||||
var cols = new[] { 100f, 110f, 85f, 70f, 375f };
|
var cols = new[] { 100f, 110f, 85f, 70f, 375f };
|
||||||
TableHeader(b, cols, L.T("wallets.col.name"), L.T("wallets.col.addr"), L.T("col.value"), L.T("wallets.col.taint"), "");
|
var aligns = new[] { TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleRight, TextAnchor.MiddleRight, TextAnchor.MiddleLeft };
|
||||||
|
TableHeader(b, 740f, cols, aligns, L.T("wallets.col.name"), L.T("wallets.col.addr"), L.T("col.value"), L.T("wallets.col.taint"), "");
|
||||||
for (int i = 0; i < d.Wallets.Count; i++)
|
for (int i = 0; i < d.Wallets.Count; i++)
|
||||||
{
|
{
|
||||||
var w = d.Wallets[i];
|
var w = d.Wallets[i];
|
||||||
int idx = i;
|
int idx = i;
|
||||||
b.BeginRow(2f);
|
bool isCurrent = idx == d.Current;
|
||||||
Cell(b, cols[0], (idx == d.Current ? "● " : "") + WalletWindow.NameOf(w));
|
b.BeginPanel(740f, 32f, TextAnchor.MiddleLeft, 4f, 0f);
|
||||||
Cell(b, cols[1], w.Address);
|
_rows.Add(new PledgerSkin.RowDef
|
||||||
Cell(b, cols[2], Fmt.Credits(w.Value(Session.Price)));
|
{
|
||||||
Cell(b, cols[3], Fmt.Credits(w.Taint));
|
Root = b.Last.root,
|
||||||
b.BeginPanel(cols[4], 30f, TextAnchor.MiddleLeft, 2f, 0f);
|
Image = b.Last.image,
|
||||||
b.BeginRow(4f);
|
Selected = isCurrent,
|
||||||
|
OnClick = () => { d.Current = idx; Session.Save(); Open(); }
|
||||||
|
});
|
||||||
|
b.BeginRow(0f, TextAnchor.MiddleLeft);
|
||||||
|
Cell(b, cols[0], (isCurrent ? "● " : "") + WalletWindow.NameOf(w), false, TextAnchor.MiddleLeft);
|
||||||
|
Cell(b, cols[1], w.Address, false, TextAnchor.MiddleLeft);
|
||||||
|
Cell(b, cols[2], Fmt.Credits(w.Value(Session.Price)), false, TextAnchor.MiddleRight);
|
||||||
|
Cell(b, cols[3], Fmt.Credits(w.Taint), false, TextAnchor.MiddleRight);
|
||||||
|
b.BeginPanel(cols[4], 28f, TextAnchor.MiddleLeft, 0f, 0f);
|
||||||
|
_clear.Add(b.Last.image);
|
||||||
|
b.BeginRow(4f, TextAnchor.MiddleLeft);
|
||||||
b.AddButton(L.T("wallets.open"), () => WalletWindow.Open(w));
|
b.AddButton(L.T("wallets.open"), () => WalletWindow.Open(w));
|
||||||
b.AddButton(L.T("hw.copy"), () => { Clipboard.Copy(w.Address); _message = L.T("hw.copied.addr", w.Address); Open(); });
|
b.AddButton(L.T("hw.copy"), () => { Clipboard.Copy(w.Address); _message = L.T("hw.copied.addr", w.Address); Open(); });
|
||||||
b.AddButton(L.T("wallets.rename"), () => { _renamePick = w.Address; _renameText = w.Label ?? ""; _message = null; Open(); });
|
b.AddButton(L.T("wallets.rename"), () => { _renamePick = w.Address; _renameText = w.Label ?? ""; _message = null; Open(); });
|
||||||
if (idx != d.Current) b.AddButton(L.T("wallets.use"), () => { d.Current = idx; Session.Save(); Open(); });
|
if (idx != d.Current) b.AddButton(L.T("wallets.use"), () => { d.Current = idx; Session.Save(); Open(); });
|
||||||
else b.AddLabel(L.T("wallets.current"));
|
else b.AddLabel(L.T("wallets.current"), "wallets_cur_dim");
|
||||||
if (idx > 0) b.AddButton(_destroyPick == w.Address ? L.T("wallets.destroy.sure") : L.T("wallets.destroy"), () => DestroyWallet(w));
|
if (idx > 0) b.AddButton(_destroyPick == w.Address ? L.T("wallets.destroy.sure") : L.T("wallets.destroy"), () => DestroyWallet(w));
|
||||||
b.End();
|
b.End();
|
||||||
b.End();
|
b.End();
|
||||||
b.End();
|
b.End();
|
||||||
|
b.End();
|
||||||
}
|
}
|
||||||
if (_renamePick != null) RenameRow(b);
|
if (_renamePick != null) RenameRow(b);
|
||||||
}
|
}
|
||||||
@@ -998,6 +1010,7 @@ namespace Decentralized
|
|||||||
b.BeginRow(8f, TextAnchor.MiddleLeft);
|
b.BeginRow(8f, TextAnchor.MiddleLeft);
|
||||||
b.AddLabel(L.T("wallets.rename.h", w.Address));
|
b.AddLabel(L.T("wallets.rename.h", w.Address));
|
||||||
b.BeginPanel(220f, -1f, TextAnchor.MiddleLeft, 0f, 0f);
|
b.BeginPanel(220f, -1f, TextAnchor.MiddleLeft, 0f, 0f);
|
||||||
|
_clear.Add(b.Last.image);
|
||||||
b.AddInput(WalletWindow.NameOf(w), _renameText, s => _renameText = s, "rename", s => _renameText = s);
|
b.AddInput(WalletWindow.NameOf(w), _renameText, s => _renameText = s, "rename", s => _renameText = s);
|
||||||
b.End();
|
b.End();
|
||||||
b.AddButton(L.T("wallets.rename.ok"), () =>
|
b.AddButton(L.T("wallets.rename.ok"), () =>
|
||||||
|
|||||||
Reference in new issue
Block a user