diff --git a/darkstat/front/shared.templ b/darkstat/front/shared.templ index 9086de7f..efcc52ee 100644 --- a/darkstat/front/shared.templ +++ b/darkstat/front/shared.templ @@ -139,6 +139,7 @@ templ TabMenu(url utils_types.FilePath) { + }
diff --git a/darkstat/front/ships.templ b/darkstat/front/ships.templ index aa098008..a897f0b5 100644 --- a/darkstat/front/ships.templ +++ b/darkstat/front/ships.templ @@ -9,14 +9,30 @@ import ( "strings" ) -func ShipDetailedUrl(ship configs_export.Ship) string { - return "ships/ships_base_" + strings.ToLower(ship.Nickname) +func ShipDetailedUrl(ship configs_export.Ship, mode ShipTabMode) string { + if mode == ShipShowBases { + return "ships/ships_base_" + strings.ToLower(ship.Nickname) + } else if mode == ShipShowDetails { + return "ships/ships_details_" + strings.ToLower(ship.Nickname) + } + panic("unsupported ship mode") } +type ShipTabMode int64 + +const ( + ShipShowBases ShipTabMode = iota + ShipShowDetails +) + // 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 ShipsT(ships []configs_export.Ship) { - @TabMenu(urls.Ships) +templ ShipsT(ships []configs_export.Ship, mode ShipTabMode) { + if mode == ShipShowBases { + @TabMenu(urls.Ships) + } else if mode == ShipShowDetails { + @TabMenu(urls.ShipDetails) + } @TabContent() {
@@ -54,7 +70,7 @@ templ ShipsT(ships []configs_export.Ship) { for _, ship := range ships {
- @GoodAtBaseSharedT(ShowPricePerVolume(false)) + if mode == ShipShowBases { + @GoodAtBaseSharedT(ShowPricePerVolume(false)) + } else if mode == ShipShowDetails { + @ShipDetailsShared([]string{}) + }
@@ -105,3 +125,37 @@ templ ShipsT(ships []configs_export.Ship) {
} } + +templ ShipDetailsShared(columns []string) { + + + + + for index, _ := range columns { + + } + + + + + { children... } + +
Ship HardpointEquip { strconv.Itoa(index) }
+} + +templ ShipDetails(ship configs_export.Ship) { + @ShipDetailsShared(ship.BiggestHardpoint) { + for _, slot := range ship.Slots { + + { slot.SlotName } + for _, equip := range slot.AllowedEquip { + { equip } + } + for _, _ = range ship.BiggestHardpoint[len(slot.AllowedEquip):] { + + } + + + } + } +} diff --git a/darkstat/front/urls/urls.go b/darkstat/front/urls/urls.go index cc8ff632..b6004963 100644 --- a/darkstat/front/urls/urls.go +++ b/darkstat/front/urls/urls.go @@ -17,4 +17,5 @@ const ( Shields utils_types.FilePath = "shields.html" Thrusters utils_types.FilePath = "thrusters.html" Ships utils_types.FilePath = "ships.html" + ShipDetails utils_types.FilePath = "ship_details.html" ) diff --git a/darkstat/linker/linker.go b/darkstat/linker/linker.go index 28c3c5af..22de6766 100644 --- a/darkstat/linker/linker.go +++ b/darkstat/linker/linker.go @@ -213,7 +213,11 @@ func (l *Linker) Link() *builder.Builder { ), builder.NewComponent( urls.Ships, - front.ShipsT(data.Ships), + front.ShipsT(data.Ships, front.ShipShowBases), + ), + builder.NewComponent( + urls.ShipDetails, + front.ShipsT(data.Ships, front.ShipShowDetails), ), ) @@ -310,9 +314,13 @@ func (l *Linker) Link() *builder.Builder { for _, ship := range data.Ships { build.RegComps( builder.NewComponent( - utils_types.FilePath(front.ShipDetailedUrl(ship)), + utils_types.FilePath(front.ShipDetailedUrl(ship, front.ShipShowBases)), front.GoodAtBaseInfoT(ship.Bases, front.ShowPricePerVolume(false)), ), + builder.NewComponent( + utils_types.FilePath(front.ShipDetailedUrl(ship, front.ShipShowDetails)), + front.ShipDetails(ship), + ), ) } diff --git a/go.mod b/go.mod index c8929ff1..10cdbf7a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21.1 require ( github.com/a-h/templ v0.2.543 - github.com/darklab8/fl-configs v0.26.0 + github.com/darklab8/fl-configs v0.27.0 github.com/darklab8/go-typelog v0.6.0 github.com/darklab8/go-utils v0.12.0 github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4 diff --git a/go.sum b/go.sum index 66a23b58..8440e3d9 100644 --- a/go.sum +++ b/go.sum @@ -30,6 +30,8 @@ github.com/darklab8/fl-configs v0.25.0 h1:A3ydu6zAiA8Szsv7bCaatsHDz1qdRGXhkQBUkB github.com/darklab8/fl-configs v0.25.0/go.mod h1:8zaCaFL21TvawP65KB9NOJ+nEpaMDQYsnoOi77RiSVY= github.com/darklab8/fl-configs v0.26.0 h1:sxNYGvvUqSh+x7h6HJx7cCAeZBmvUCtf12kHYhwnYtA= github.com/darklab8/fl-configs v0.26.0/go.mod h1:8zaCaFL21TvawP65KB9NOJ+nEpaMDQYsnoOi77RiSVY= +github.com/darklab8/fl-configs v0.27.0 h1:z62lSXdPSw1Qq9z860iVRHtT6l6qkzBEbAxsrG+esFs= +github.com/darklab8/fl-configs v0.27.0/go.mod h1:8zaCaFL21TvawP65KB9NOJ+nEpaMDQYsnoOi77RiSVY= github.com/darklab8/go-typelog v0.6.0 h1:Ci8imc7ScXiy5e1qMgf46NyJjrqNLPoIE1gbVe7bxl4= github.com/darklab8/go-typelog v0.6.0/go.mod h1:AwwOf3dkp/tpevHFNbkB+PbwlDrUUgO1CVFkEnj+q5w= github.com/darklab8/go-utils v0.12.0 h1:LxsG3yVNf9W4xyV+tHPOaZB2ewItgM/1BzOXyKFvofs=