-
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
121 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
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,87 @@ | ||
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 ThrusterDetailedUrl(thruster configs_export.Thruster) string { | ||
return "thrusters/thruster_base_" + strings.ToLower(thruster.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 ThrusterT(thrusters []configs_export.Thruster) { | ||
@TabMenu(urls.Thrusters) | ||
@TabContent() { | ||
<div class="splitter"> | ||
<div id="table-wrapper"> | ||
<div id="table-top"> | ||
<table class="sortable"> | ||
<thead> | ||
<tr> | ||
<th style="width:200px;">Thruster</th> | ||
<th style="width:50px;">Price</th> | ||
<th style="width:50px;">Buyable</th> | ||
<th style="width:50px;">Max Force</th> | ||
<th style="width:50px;">Power Usage</th> | ||
<th style="width:50px;">Efficiency</th> | ||
<th style="width:100px;">Value</th> | ||
<th style="width:100px;">Rating</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 _, thruster := range thrusters { | ||
<tr | ||
id={ "bottominfo_click" + thruster.Nickname } | ||
hx-get={ types.GetCtx(ctx).SiteRoot + ThrusterDetailedUrl(thruster) } | ||
hx-trigger="click" | ||
hx-target="#table-bottom" | ||
hx-swap="innerHTML" | ||
> | ||
<td>{ thruster.Name }</td> | ||
<td>{ strconv.Itoa(thruster.Price) } </td> | ||
<td>{ strconv.FormatBool(len(thruster.Bases) > 0) }</td> | ||
<td>{ strconv.Itoa(thruster.MaxForce) } </td> | ||
<td>{ strconv.Itoa(thruster.PowerUsage) }</td> | ||
<td>{ fmt.Sprintf("%.2f",thruster.Efficiency) }</td> | ||
<td>{ fmt.Sprintf("%.2f", thruster.Value) }</td> | ||
<td>{ fmt.Sprintf("%.2f", thruster.Rating) }</td> | ||
<td>{ strconv.Itoa(thruster.HitPts) }</td> | ||
<td>{ strconv.FormatBool(thruster.Lootable) }</td> | ||
<td>{ thruster.Nickname } </td> | ||
<td>{ strconv.Itoa(thruster.NameID) } </td> | ||
<td>{ strconv.Itoa(thruster.InfoID) } </td> | ||
<td | ||
id={ "infocard_click" + thruster.Nickname } | ||
hx-get={ types.GetCtx(ctx).SiteRoot + InfocardURL(configs_export.InfocardKey(thruster.Nickname)) } | ||
hx-trigger="click" | ||
hx-target="#infocard_view" | ||
hx-swap="innerHTML" | ||
></td> | ||
@templ.Raw(JoinClickTriggers("bottominfo_click"+thruster.Nickname, "infocard_click"+thruster.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