Skip to content

Commit 52802c9

Browse files
committed
builds unit chart
1 parent f47548a commit 52802c9

File tree

6 files changed

+464
-52
lines changed

6 files changed

+464
-52
lines changed

src/dsstats.razorlib/Builds/BuildsComponent.razor

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
<style>
1212
.check-label:hover {
13-
color: white !important;
14-
background-color: #adb5bd !important;
15-
border-color: white !important;
13+
color: white !important;
14+
background-color: #adb5bd !important;
15+
border-color: white !important;
1616
}
1717
</style>
1818

@@ -25,24 +25,24 @@
2525
<nav>
2626
<div class="nav nav-tabs" id="nav-tab" role="tablist">
2727
<button class="@(initPlayers ? "nav-link" : "nav-link active")" id="nav-home-tab"
28-
data-bs-toggle="tab" data-bs-target="#nav-rating" type="button" role="tab"
29-
aria-controls="nav-ratings" aria-selected="true" @onclick="ByRating">
28+
data-bs-toggle="tab" data-bs-target="#nav-rating" type="button" role="tab"
29+
aria-controls="nav-ratings" aria-selected="true" @onclick="ByRating">
3030
By Ratings
3131
</button>
3232
<button class="@(initPlayers ? "nav-link active" : "nav-link")" id="nav-profile-tab"
33-
data-bs-toggle="tab" data-bs-target="#nav-players" type="button" role="tab"
34-
aria-controls="nav-players" aria-selected="false" @onclick="ByPlayers">
33+
data-bs-toggle="tab" data-bs-target="#nav-players" type="button" role="tab"
34+
aria-controls="nav-players" aria-selected="false" @onclick="ByPlayers">
3535
By Players
3636
</button>
3737
</div>
3838
</nav>
3939
<div class="tab-content mt-1 bgchart p-2 border rounded" id="nav-tabContent">
4040
<div class="@(initPlayers ? "tab-pane fade" : "tab-pane fade show active")" id="nav-rating"
41-
role="tabpanel" aria-labelledby="nav-rating-tab">
41+
role="tabpanel" aria-labelledby="nav-rating-tab">
4242
<RatingRangeRequest OnRangeSelected="e => LoadData()" />
4343
</div>
4444
<div class="@(initPlayers ? "tab-pane fade show active" : "tab-pane fade")" id="nav-players"
45-
role="tabpanel" aria-labelledby="nav-players-tab">
45+
role="tabpanel" aria-labelledby="nav-players-tab">
4646
<BuildPlayerRequest @ref="buildPlayerRequest" OnPlayersSet="e => LoadData()" />
4747
</div>
4848
</div>
@@ -63,13 +63,13 @@
6363
}
6464
</div>
6565
<CmdrSelectComponent Selected="Request.Interest" None="false"
66-
Std="@(Request.RatingType == RatingType.Std || Request.RatingType == RatingType.StdTE)"
67-
OnCommanderSelected="SelectInterest" />
66+
Std="@(Request.RatingType == RatingType.Std || Request.RatingType == RatingType.StdTE)"
67+
OnCommanderSelected="SelectInterest" />
6868
</div>
6969
<div>
7070
<CmdrSelectComponent Selected="Request.Versus" None="true"
71-
Std="@(Request.RatingType == RatingType.Std || Request.RatingType == RatingType.StdTE)"
72-
OnCommanderSelected="SelectVersus" />
71+
Std="@(Request.RatingType == RatingType.Std || Request.RatingType == RatingType.StdTE)"
72+
OnCommanderSelected="SelectVersus" />
7373
</div>
7474
</div>
7575
</div>
@@ -98,13 +98,13 @@
9898
Player Ratings Range
9999
<span class="text-danger">
100100
@(Request.FromRating <= Data.MinBuildRating ? "0"
101-
: Request.FromRating) - @(Request.ToRating >= Data.MaxBuildRating ?
101+
: Request.FromRating) - @(Request.ToRating >= Data.MaxBuildRating ?
102102
$"{Data.MaxBuildRating}+" : Request.ToRating)
103103
</span>
104104
</h5>
105105
}
106106
<div class="row">
107-
<div class="col-auto text-center align-self-center">
107+
<div class="col-auto mt-1">
108108
<span class="fw-bold">Breakpoint</span>
109109
</div>
110110
<div class="col-auto">
@@ -118,12 +118,19 @@
118118
continue;
119119
}
120120
<input type="radio" class="btn-check" name="bptoggle" id="@($"buildbp{bp}")"
121-
checked="@(Request.Breakpoint == bp)"
122-
autocomplete="off" @onchange="e => SetBreakpoint(e, bp)">
123-
<label class="btn btn-outline-light check-label" for="@($"buildbp{bp}")">
121+
checked="@(Request.Breakpoint == bp)"
122+
autocomplete="off" @onchange="e => SetBreakpoint(e, bp)">
123+
<label class="btn btn-sm btn-outline-light check-label" for="@($"buildbp{bp}")">
124124
@(bp == Breakpoint.All ? "Game End" : $"{bp}")
125125
</label>
126126
}
127+
<div class="form-check form-switch mt-1 ms-1">
128+
<label class="form-check-label">
129+
Adv. Table
130+
<input type="checkbox" class="form-check-input" @bind-value="ShowFullStats" />
131+
</label>
132+
133+
</div>
127134
</div>
128135
</fieldset>
129136
</form>
@@ -147,7 +154,7 @@
147154
</div>
148155
<div class="col-auto">
149156
<span class="badge bgchart2 border rounded">
150-
Winrate<br><span class="text-warning">@Response.BuildCounts.Winrate.ToString("N2", CultureInfo.InvariantCulture)%</span>
157+
Winrate<br><span class="text-warning">@Response.BuildCounts.Winrate.ToString("N2")%</span>
151158
</span>
152159
</div>
153160
</div>
@@ -159,7 +166,7 @@
159166
</div>
160167
<div class="col-auto">
161168
<span class="badge bgchart2 border rounded">
162-
∅ Gas<br><span class="text-warning">@Response.BuildCounts.Gas.ToString("N2", CultureInfo.InvariantCulture)</span>
169+
∅ Gas<br><span class="text-warning">@Response.BuildCounts.Gas.ToString("N2")</span>
163170
</span>
164171
</div>
165172
<div class="col-auto">
@@ -169,23 +176,23 @@
169176
</div>
170177
</div>
171178
<div class="d-flex mt-1 justify-content-center">
172-
<UnitsTable Units="Response.Units" />
179+
<UnitsTable Units="Response.Units" ShowFullStats="ShowFullStats" />
173180
</div>
174181
</div>
175182
</div>
176183
</div>
177-
<div class="col-auto" style="min-width: 800px;">
184+
<div class="col-auto">
178185
<div>
179186
<BuildMapComponent @ref="buildMapComponent" Request="Request" />
180187
</div>
181188
<div class="ms-2">
182189
<button class="btn btn-sm btn-outline-light bgchart"
183-
type="button"
184-
data-bs-toggle="collapse"
185-
data-bs-target="#buildreplays"
186-
aria-expanded="false"
187-
aria-controls="buildreplays"
188-
@onclick="e => showReplays = !showReplays">
190+
type="button"
191+
data-bs-toggle="collapse"
192+
data-bs-target="#buildreplays"
193+
aria-expanded="false"
194+
aria-controls="buildreplays"
195+
@onclick="e => showReplays = !showReplays">
189196
<span class="bi @(showReplays ? "bi bi-chevron-double-down" : "bi-chevron-double-up")"></span>
190197
Replays
191198
</button>
@@ -194,10 +201,14 @@
194201
@if (showReplays)
195202
{
196203
<BuildReplaysComponent @ref="buildReplaysComponent" Request="Request"
197-
OnReplayRequest="LoadReplay"
198-
OnMapRequest="MapRequest" />
204+
OnReplayRequest="LoadReplay"
205+
OnMapRequest="MapRequest" />
199206
}
200207
</div>
208+
<div class="border rounded border-secondary bgchart mt-2"
209+
style="min-width: 700px; width: 40vw; height: calc(40vw * 0.5); min-height: 350px;">
210+
<UnitsChartComponent @ref="unitsChartComponent" Request="Request" />
211+
</div>
201212
</div>
202213
</div>
203214
</div>
@@ -238,6 +249,8 @@
238249
BuildReplaysComponent? buildReplaysComponent;
239250
BuildMapComponent? buildMapComponent;
240251
ReplayDto? replayDto = null;
252+
private bool ShowFullStats;
253+
UnitsChartComponent? unitsChartComponent;
241254

242255
protected override void OnInitialized()
243256
{
@@ -280,6 +293,7 @@
280293
buildReplaysComponent?.Reload();
281294
buildMapComponent?.Update(Request, bpOnly);
282295
}
296+
unitsChartComponent?.Update(Request);
283297
}
284298

285299
private void SelectInterest(Commander cmdr)

0 commit comments

Comments
 (0)