Skip to content

Commit 795aa1e

Browse files
committed
fix sc auctions
1 parent cb017e7 commit 795aa1e

File tree

3 files changed

+88
-26
lines changed

3 files changed

+88
-26
lines changed

Components/Pages/ScAuctions.razor

Lines changed: 69 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@
3636
{
3737
@foreach (var ipo in _activeIpos)
3838
{
39-
<div class="card mb-2">
39+
<div class="card mb-2" style="cursor:pointer" @onclick="() => NavigateToStatus(ipo.ContractIndex)">
4040
<div class="card-body py-2 px-3">
4141
<div class="d-flex justify-content-between align-items-center">
4242
<div>
4343
<span class="fw-bold small">Contract #@ipo.ContractIndex</span>
4444
<span class="badge bg-secondary ms-1">@ipo.AssetName</span>
4545
</div>
46+
<span class="text-muted small">→</span>
4647
</div>
4748
<div class="small text-muted mt-1">
4849
<AddressDisplay Address="@QubicContracts.GetContractIdentity((int)ipo.ContractIndex).ToString()" TruncateChars="10" ShowCopy="false" />
@@ -74,16 +75,19 @@
7475
}
7576
</select>
7677
}
77-
<input type="number" class="form-control form-control-sm" min="1" max="23" @bind="_statusContractIndex"
78-
placeholder="Or enter contract index (1-23)" />
78+
<input type="number" class="form-control form-control-sm" min="1" max="1023" @bind="_statusContractIndex"
79+
placeholder="Or enter contract index" />
7980
</div>
8081
<button class="btn btn-primary w-100" @onclick="LookupStatus" disabled="@_statusLoading">
8182
@(_statusLoading ? "Looking up..." : "Lookup")
8283
</button>
8384

8485
@if (Backend.ActiveBackend != QueryBackend.DirectNetwork)
8586
{
86-
<div class="alert alert-warning mt-2 small py-1">This feature requires DirectNetwork backend.</div>
87+
<div class="alert alert-warning mt-2 small py-1 d-flex align-items-center justify-content-between">
88+
<span>Requires DirectNetwork backend.</span>
89+
<button class="btn btn-sm btn-warning ms-2" @onclick="SwitchToDirectNetwork">Switch</button>
90+
</div>
8791
}
8892

8993
@if (_ipoStatus != null)
@@ -104,17 +108,44 @@
104108
@if (Seed.HasSeed && _mySlots.Count > 0)
105109
{
106110
<div class="card mt-3 border-primary">
107-
<div class="card-header small fw-bold">My Bids</div>
111+
<div class="card-header small fw-bold d-flex justify-content-between align-items-center">
112+
<span>My Bids</span>
113+
@if (_mySlots.Any(s => s.Price == _minBid))
114+
{
115+
<span class="badge bg-warning text-dark">⚠ At Risk</span>
116+
}
117+
else
118+
{
119+
<span class="badge bg-success">✓ Safe</span>
120+
}
121+
</div>
108122
<div class="card-body py-2 small">
109-
<div class="mb-2">
110-
<strong>@_mySlots.Count</strong> slot@(_mySlots.Count != 1 ? "s" : "")
111-
| Total: <strong class="mono">@_mySlots.Sum(s => s.Price).ToString("N0") QU</strong>
123+
<div class="mb-2 text-muted">
124+
@_mySlots.Count slot@(_mySlots.Count != 1 ? "s" : "") · Total: <strong class="mono">@_mySlots.Sum(s => s.Price).ToString("N0") QU</strong>
112125
</div>
113126
@foreach (var slot in _mySlots)
114127
{
115-
<div class="d-flex justify-content-between border-bottom py-1">
116-
<span class="mono">Slot #@slot.Index</span>
117-
<span class="mono">@slot.Price.ToString("N0") QU</span>
128+
var rank = _allSlots.FindIndex(s => s.Index == slot.Index) + 1;
129+
var atRisk = _filledSlots >= QubicConstants.NumberOfComputors && slot.Price == _minBid;
130+
<div class="border-bottom py-1">
131+
<div class="d-flex justify-content-between align-items-center">
132+
<span class="mono">Slot #@slot.Index</span>
133+
<span>
134+
@if (atRisk)
135+
{
136+
<span class="badge bg-warning text-dark me-1">At Risk</span>
137+
}
138+
else
139+
{
140+
<span class="badge bg-success me-1">Safe</span>
141+
}
142+
<span class="mono">#@rank</span>
143+
</span>
144+
</div>
145+
<div class="d-flex justify-content-between text-muted">
146+
<AddressDisplay Address="@slot.Identity" TruncateChars="10" ShowCopy="false" />
147+
<span class="mono">@slot.Price.ToString("N0") QU</span>
148+
</div>
118149
</div>
119150
}
120151
</div>
@@ -173,8 +204,8 @@
173204
}
174205
</select>
175206
}
176-
<input type="number" class="form-control form-control-sm" min="1" max="23" @bind="_bidContractIndex"
177-
placeholder="Or enter contract index (1-23)" />
207+
<input type="number" class="form-control form-control-sm" min="1" max="1023" @bind="_bidContractIndex"
208+
placeholder="Or enter contract index" />
178209
</div>
179210
<div class="mb-2">
180211
<label class="small text-muted">Price per Share (QU)</label>
@@ -184,10 +215,10 @@
184215
<label class="small text-muted">Number of Shares (1-676)</label>
185216
<input type="number" class="form-control form-control-sm" min="1" max="676" @bind="_bidQuantity" />
186217
</div>
187-
@if (_bidPrice > 0 && _bidQuantity > 0)
188-
{
189-
<div class="small text-muted mb-2">Total cost: <strong>@((_bidPrice * _bidQuantity).ToString("N0")) QU</strong></div>
190-
}
218+
<div class="alert alert-info py-2 mb-2 d-flex justify-content-between align-items-center small">
219+
<span>Total to pay:</span>
220+
<strong class="mono">@((_bidPrice > 0 && _bidQuantity > 0 ? _bidPrice * _bidQuantity : 0).ToString("N0")) QU</strong>
221+
</div>
191222

192223
@if (!_bidConfirmed)
193224
{
@@ -240,6 +271,20 @@
240271

241272
private void SetTab(string tab) { _activeTab = tab; _error = null; _result = null; }
242273

274+
private void SwitchToDirectNetwork()
275+
{
276+
Backend.ActiveBackend = QueryBackend.DirectNetwork;
277+
StateHasChanged();
278+
}
279+
280+
private async Task NavigateToStatus(uint contractIndex)
281+
{
282+
_statusContractIndex = contractIndex;
283+
_activeTab = "Status";
284+
_error = null; _result = null;
285+
await LookupStatus();
286+
}
287+
243288
// -- Browse --
244289
private bool _browseLoading;
245290
private IReadOnlyList<IpoInfo>? _activeIpos;
@@ -253,7 +298,7 @@
253298
private long _maxBid;
254299
private long _avgBid;
255300
private long _totalBid;
256-
private List<(int Index, long Price)> _mySlots = [];
301+
private List<(int Index, string Identity, long Price)> _mySlots = [];
257302
private List<(int Index, string Identity, long Price)> _allSlots = [];
258303

259304
// -- Bid --
@@ -291,11 +336,11 @@
291336
_filledSlots = 0; _minBid = 0; _maxBid = 0; _avgBid = 0; _totalBid = 0;
292337
try
293338
{
294-
if (_statusContractIndex < 1 || _statusContractIndex > 23)
295-
{ _error = "Contract index must be between 1 and 23."; return; }
339+
if (_statusContractIndex < 1 || _statusContractIndex > 1023)
340+
{ _error = "Contract index must be between 1 and 1023."; return; }
296341

297342
if (Backend.ActiveBackend != QueryBackend.DirectNetwork)
298-
{ _error = "This feature requires the DirectNetwork backend. Switch to DirectNetwork in Settings."; return; }
343+
{ _error = "This feature requires the DirectNetwork backend."; return; }
299344

300345
_ipoStatus = await Backend.GetIpoStatusAsync(_statusContractIndex);
301346
ComputeStatusSummary();
@@ -321,7 +366,7 @@
321366
filled.Add((i, identity.Value.ToString(), price));
322367

323368
if (myPk != null && _ipoStatus.PublicKeys[i].AsSpan().SequenceEqual(myPk))
324-
_mySlots.Add((i, price));
369+
_mySlots.Add((i, identity.Value.ToString(), price));
325370
}
326371

327372
_filledSlots = filled.Count;
@@ -341,8 +386,8 @@
341386
private async Task PreviewBid()
342387
{
343388
_error = null; _result = null;
344-
if (_bidContractIndex < 1 || _bidContractIndex > 23)
345-
{ _error = "Contract index must be between 1 and 23."; return; }
389+
if (_bidContractIndex < 1 || _bidContractIndex > 1023)
390+
{ _error = "Contract index must be between 1 and 1023."; return; }
346391
if (_bidPrice <= 0) { _error = "Price per share must be positive."; return; }
347392
if (_bidQuantity < 1 || _bidQuantity > 676) { _error = "Number of shares must be 1-676."; return; }
348393

Qubic.Net.Wallet.Mobile.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<!-- App identifiers -->
1717
<ApplicationTitle>Qubic Wallet</ApplicationTitle>
1818
<ApplicationId>org.qubic.lab.wallet</ApplicationId>
19-
<ApplicationDisplayVersion>0.5.0</ApplicationDisplayVersion>
20-
<ApplicationVersion>5</ApplicationVersion>
19+
<ApplicationDisplayVersion>0.5.1</ApplicationDisplayVersion>
20+
<ApplicationVersion>6</ApplicationVersion>
2121

2222
<!-- Android -->
2323
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24</SupportedOSPlatformVersion>

wwwroot/app.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
--bs-link-color: var(--qb-accent-cyan);
8383
--bs-link-hover-color: var(--qb-accent-cyan-muted);
8484
--bs-emphasis-color: var(--qb-text-primary);
85+
--bs-modal-bg: var(--qb-bg-card);
86+
--bs-modal-color: var(--qb-text-primary);
87+
--bs-modal-border-color: var(--qb-border-strong);
88+
--bs-modal-header-border-color: var(--qb-border);
89+
--bs-modal-footer-border-color: var(--qb-border);
8590
}
8691

8792
/* ── Base ── */
@@ -540,3 +545,15 @@ h4 { font-size: 1.15rem; }
540545
background: var(--qb-accent-cyan-dim);
541546
border-left: 2px solid var(--qb-accent-cyan);
542547
}
548+
549+
/* ── Accent Card Header ── */
550+
.card-header-accent {
551+
background: var(--qb-accent-cyan-dim);
552+
color: var(--qb-accent-cyan);
553+
border-bottom-color: var(--qb-border-strong);
554+
}
555+
556+
/* ── Modal Dark Mode Fix ── */
557+
[data-bs-theme="dark"] .btn-close {
558+
filter: invert(1) grayscale(100%) brightness(200%);
559+
}

0 commit comments

Comments
 (0)