-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package front | ||
|
||
import ( | ||
"strconv" | ||
"github.com/darklab8/fl-darkstat/darkstat/front/urls" | ||
"github.com/darklab8/fl-darkstat/darkstat/common/types" | ||
"github.com/darklab8/fl-configs/configs/configs_export" | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
func MineDetailedUrl(mine configs_export.Mine) string { | ||
return "mines/mines_base_" + strings.ToLower(mine.Nickname) | ||
} | ||
|
||
// https://www.cssscript.com/minimalist-table-sortable/#:~:text=Description%3A-,sorttable.,clicking%20on%20the%20table%20headers | ||
// https://www.cssscript.com/fast-html-table-sorting/ | ||
templ MinesT(mines []configs_export.Mine) { | ||
@TabMenu(urls.Mines) | ||
@TabContent() { | ||
<div class="splitter"> | ||
<div id="table-wrapper"> | ||
<div id="table-top"> | ||
<table class="sortable"> | ||
<thead> | ||
<tr> | ||
<th style="width:200px;">Mine</th> | ||
<th style="width:50px;">Price</th> | ||
<th style="width:50px;">Ammo Price</th> | ||
<th style="width:50px;">Hull Dmg</th> | ||
<th style="width:50px;">Shield Dmg</th> | ||
<th style="width:100px;">Value</th> | ||
<th style="width:100px;">Refire</th> | ||
<th style="width:50px;">Detonation Dist.</th> | ||
<th style="width:50px;">Radius</th> | ||
<th style="width:50px;">Seek Dist.</th> | ||
<th style="width:50px;">Top Speed</th> | ||
<th style="width:50px;">Acceleration</th> | ||
<th style="width:50px;">Linear Drag</th> | ||
<th style="width:50px;">Lifetime</th> | ||
<th style="width:50px;">Owner Safe</th> | ||
<th style="width:50px;">Toughness</th> | ||
<th style="width:50px;">Hit Pts</th> | ||
<th style="width:50px;">Lootable</th> | ||
<th style="width:50px;">Nickname</th> | ||
<th style="width:100px;">Name ID</th> | ||
<th style="width:100px;">Info ID</th> | ||
<th style="max-width:100%;"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
for _, mine := range mines { | ||
<tr | ||
id={ "bottominfo_click" + mine.Nickname } | ||
hx-get={ types.GetCtx(ctx).SiteRoot + MineDetailedUrl(mine) } | ||
hx-trigger="click" | ||
hx-target="#table-bottom" | ||
hx-swap="innerHTML" | ||
> | ||
<td>{ mine.Name }</td> | ||
<td>{ strconv.Itoa(mine.Price) } </td> | ||
<td>{ strconv.Itoa(mine.AmmoPrice) } </td> | ||
<td>{ strconv.Itoa(mine.HullDamage) }</td> | ||
<td>{ strconv.Itoa(mine.ShieldDamage) }</td> | ||
<td>{ fmt.Sprintf("%.2f",mine.Value) }</td> | ||
<td>{ fmt.Sprintf("%.2f", mine.Refire) }</td> | ||
<td>{ fmt.Sprintf("%.2f", mine.DetonationDistance) }</td> | ||
<td>{ fmt.Sprintf("%.2f",mine.Radius) }</td> | ||
<td>{ strconv.Itoa(mine.SeekDistance) }</td> | ||
<td>{ strconv.Itoa(mine.TopSpeed) }</td> | ||
<td>{ strconv.Itoa(mine.Acceleration) }</td> | ||
<td>{ fmt.Sprintf("%.6f",mine.LinearDrag) }</td> | ||
<td>{ fmt.Sprintf("%.2f",mine.LifeTime) }</td> | ||
<td>{ strconv.Itoa(mine.OwnerSafe) }</td> | ||
<td>{ fmt.Sprintf("%.2f",mine.Toughness) }</td> | ||
<td>{ strconv.Itoa(mine.HitPts) }</td> | ||
<td>{ strconv.FormatBool(mine.Lootable) }</td> | ||
<td>{ mine.Nickname } </td> | ||
<td>{ strconv.Itoa(mine.IdsName) } </td> | ||
<td>{ strconv.Itoa(mine.IdsInfo) } </td> | ||
<td | ||
id={ "infocard_click" + mine.Nickname } | ||
hx-get={ types.GetCtx(ctx).SiteRoot + InfocardURL(configs_export.InfocardKey(mine.Nickname)) } | ||
hx-trigger="click" | ||
hx-target="#infocard_view" | ||
hx-swap="innerHTML" | ||
></td> | ||
@templ.Raw(JoinClickTriggers("bottominfo_click"+mine.Nickname, "infocard_click"+mine.Nickname)) | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
</div> | ||
<div id="table-bottom"> | ||
@GoodAtBaseSharedT(ShowPricePerVolume(false)) | ||
</div> | ||
</div> | ||
<div id="infocard_view"> | ||
@InfocardShared() | ||
</div> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters