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/options.templ | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'internal/components/options.templ') diff --git a/internal/components/options.templ b/internal/components/options.templ index 8e31132..097f66f 100644 --- a/internal/components/options.templ +++ b/internal/components/options.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" ) @@ -11,19 +12,22 @@ templ Options(result *index.Result) { Title Description + if config.DevMode { + Score + } for _, hit := range result.Hits { if m := convertMatch[nix.Option](hit.Data); m != nil { - @optionRow(*m) + @optionRow(hit, *m) } } } -templ optionRow(o nix.Option) { +templ optionRow(hit index.DocumentMatch, o nix.Option) { @openDialogLink(o.Name) @@ -32,5 +36,10 @@ templ optionRow(o nix.Option) { @markdown(firstSentence(o.Description)) + if config.DevMode { + + @score(hit) + + } } -- cgit 1.4.1