From 58643f38bdd62dc538a03865b1f81eb77d957779 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 31 Dec 2024 14:56:37 +0100 Subject: feat: show scores in results table in dev mode --- internal/components/packages.templ | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'internal/components/packages.templ') diff --git a/internal/components/packages.templ b/internal/components/packages.templ index b90fcd5..6e14026 100644 --- a/internal/components/packages.templ +++ b/internal/components/packages.templ @@ -1,6 +1,7 @@ package components import ( + "go.alanpearce.eu/searchix/internal/config" "go.alanpearce.eu/searchix/internal/index" "go.alanpearce.eu/searchix/internal/nix" ) @@ -12,19 +13,22 @@ templ Packages(result *index.Result) { Attribute Name Description + if config.DevMode { + Score + } for _, hit := range result.Hits { if m := convertMatch[nix.Package](hit.Data); m != nil { - @packageRow(*m) + @packageRow(hit, *m) } } } -templ packageRow(p nix.Package) { +templ packageRow(hit index.DocumentMatch, p nix.Package) { @openDialogLink(p.Attribute) @@ -35,5 +39,10 @@ templ packageRow(p nix.Package) { { p.Description } + if config.DevMode { + + @score(hit) + + } } -- cgit 1.4.1