package components import ( "strconv" "log/slog" "searchix/internal/nix" ) func convertMatch[I nix.Importable](m nix.Importable) *I { i, ok := m.(I) if !ok { slog.Warn("Converting match failed", "match", m) return nil } return &i } templ Results(r ResultData) { if r.Query != "" { if r.Results != nil && r.Results.Total > 0 { switch r.Results.Hits[0].Data.(type) { case nix.Option: @Options(r.Results) case nix.Package: @Packages(r.Results) } } else { Nothing found } } else {
} } templ ResultsPage(r ResultData) { @SearchPage(r.TemplateData, r) { @Results(r) } } templ openDialogLink(attr string) { { attr } }