diff --git a/internal/v3/ui/assets/style.css b/internal/v3/ui/assets/style.css index 05634e2..782cf13 100644 --- a/internal/v3/ui/assets/style.css +++ b/internal/v3/ui/assets/style.css @@ -20,3 +20,21 @@ body { align-items: center; justify-content: center; } + +.search { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +input { + width: 100%; + padding: 5px; +} + +table { + width: 100%; + font-size: 2rem; + text-align: center; +} diff --git a/internal/v3/ui/handlers/default.go b/internal/v3/ui/handlers/default.go index ca1aa05..c3a07fb 100644 --- a/internal/v3/ui/handlers/default.go +++ b/internal/v3/ui/handlers/default.go @@ -8,7 +8,6 @@ import ( "github.com/dadav/gorge/internal/log" "github.com/dadav/gorge/internal/v3/backend" "github.com/dadav/gorge/internal/v3/ui" - gen "github.com/dadav/gorge/pkg/gen/v3/openapi" "github.com/go-chi/chi/v5" ) @@ -43,19 +42,9 @@ func (g *GorgeService) SearchHandler(w http.ResponseWriter, r *http.Request) { return } - matching := []*gen.Module{} - for _, module := range modules { - if strings.Contains(module.Name, query) { - matching = append(matching, module) - } - } - - if len(matching) > 0 { - for _, foo := range matching { - ui.ModuleToTableRow(foo.Name, foo.Owner.Username, foo.CurrentRelease.Version).Render(context.Background(), w) + if strings.Contains(module.Name, query) || strings.Contains(module.Owner.Username, query) || strings.Contains(module.CurrentRelease.Version, query) { + ui.ModuleToTableRow(module.Name, module.Owner.Username, module.CurrentRelease.Version).Render(context.Background(), w) } - } else { - log.Log.Info("Nothing found") } } diff --git a/internal/v3/ui/index.templ b/internal/v3/ui/index.templ index bcefe35..7dcbfbf 100644 --- a/internal/v3/ui/index.templ +++ b/internal/v3/ui/index.templ @@ -5,17 +5,17 @@ import "github.com/dadav/gorge/internal/v3/ui/components" templ body() {
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

ModuleAuthorVersion
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }