From 62d72e60d9da785c4a60447277f9bd78855dbb04 Mon Sep 17 00:00:00 2001 From: dd84ai Date: Sun, 24 Mar 2024 21:24:26 +0100 Subject: [PATCH] feat: implementing tab switch --- darkstat/common/shared.templ | 42 +++++++++++++++++++----------------- darkstat/front/bases.templ | 27 +++++++++++++++++------ darkstat/front/index.templ | 15 +++++++++++++ darkstat/front/systems.templ | 23 ++++++++++++++++++++ darkstat/front/urls/urls.go | 4 +++- darkstat/linker/linker.go | 10 ++++++++- 6 files changed, 93 insertions(+), 28 deletions(-) create mode 100644 darkstat/front/index.templ create mode 100644 darkstat/front/systems.templ diff --git a/darkstat/common/shared.templ b/darkstat/common/shared.templ index e14735e0..03430817 100644 --- a/darkstat/common/shared.templ +++ b/darkstat/common/shared.templ @@ -1,18 +1,19 @@ package common import ( - "github.com/darklab8/fl-darkstat/darkstat/common/common_static" - "github.com/darklab8/fl-darkstat/darkstat/common/types" + "github.com/darklab8/fl-darkstat/darkstat/common/common_static" + "github.com/darklab8/fl-darkstat/darkstat/common/types" ) + templ Html5() { - - - { "darkstat" } - switch types.GetCtx(ctx).Theme { - case types.ThemeDark: - - case types.ThemeLight: - - } - @common_static.ResetCSS() - @common_static.CommonCSS() - @common_static.CustomCSS() - - - { children... } - + } + @common_static.ResetCSS() + @common_static.CommonCSS() + @common_static.CustomCSS() + + + + + { children... } + - -} \ No newline at end of file +} diff --git a/darkstat/front/bases.templ b/darkstat/front/bases.templ index 0db52c9c..4a7ef03e 100644 --- a/darkstat/front/bases.templ +++ b/darkstat/front/bases.templ @@ -2,7 +2,7 @@ package front import ( "strconv" - "github.com/darklab8/fl-darkstat/darkstat/common" + "github.com/darklab8/fl-darkstat/darkstat/front/urls" "github.com/darklab8/fl-darkstat/darkstat/common/types" "github.com/darklab8/fl-configs/configs/configs_export" ) @@ -11,12 +11,29 @@ var ( Smth = "abc" ) +templ TabContent() { +
+ { children... } +
+} + // 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 BasesT(bases []configs_export.Base) { - @common.Html5() { + +
+ + +
+ @TabContent() { - -
@@ -104,7 +119,7 @@ templ BasesT(bases []configs_export.Base) { } } -templ BasesInfo(info configs_export.Infocard) { +templ BasesInfocard(info configs_export.Infocard) { +
+ + +
+ @TabContent() { + Here will be systems + } +} diff --git a/darkstat/front/urls/urls.go b/darkstat/front/urls/urls.go index 06d83411..2ac39f55 100644 --- a/darkstat/front/urls/urls.go +++ b/darkstat/front/urls/urls.go @@ -5,5 +5,7 @@ import ( ) const ( - Bases utils_types.FilePath = "index.html" + Index utils_types.FilePath = "index.html" + Bases utils_types.FilePath = "bases.html" + Systems utils_types.FilePath = "systems.html" ) diff --git a/darkstat/linker/linker.go b/darkstat/linker/linker.go index 01c02ad9..30b37538 100644 --- a/darkstat/linker/linker.go +++ b/darkstat/linker/linker.go @@ -45,17 +45,25 @@ func (l *Linker) Link() *builder.Builder { build := builder.NewBuilder() build.RegComps( + builder.NewComponent( + urls.Index, + front.Index(), + ), builder.NewComponent( urls.Bases, front.BasesT(bases), ), + builder.NewComponent( + urls.Systems, + front.Systems(), + ), ) for _, base := range bases { build.RegComps( builder.NewComponent( utils_filepath.Join(utils_types.FilePath("infocard"), utils_types.FilePath(base.Nickname)), - front.BasesInfo(base.Infocard), + front.BasesInfocard(base.Infocard), ), ) }