all repos — searchix @ 6781684647ad7f131054a93e1d13105d865c0e83

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: enable combined search

Alan Pearce
commit

6781684647ad7f131054a93e1d13105d865c0e83

parent

442345898802e93b0b884fd0f1c3492e08c34049

1 file changed, 14 insertions(+), 5 deletions(-)

changed files
M internal/components/results.templinternal/components/results.templ
@@ -3,6 +3,7 @@
import ( "strconv" "go.alanpearce.eu/searchix/internal/nix" + "go.alanpearce.eu/searchix/internal/config" ) func convertMatch[I nix.Importable](m nix.Importable) *I {
@@ -16,11 +17,15 @@
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) + if r.Source != nil { + switch r.Source.Importer { + case config.Options: + @Options(r.Results) + case config.Packages: + @Packages(r.Results) + } + } else { + @Combined(r.Results) } <footer aria-label="pagination"> <nav id="pagination">
@@ -50,3 +55,7 @@
templ openDialogLink(attr string) { <a class="open-dialog" href={ templ.SafeURL(attr) }>{ attr }</a> } + +templ openCombinedDialogLink(attr string) { + <a class="open-dialog" href={ templ.SafeURL("/" + attr) }>{ attr }</a> +}