about summary refs log tree commit diff stats
path: root/internal/components/packages.templ
diff options
context:
space:
mode:
Diffstat (limited to 'internal/components/packages.templ')
-rw-r--r--internal/components/packages.templ13
1 files changed, 11 insertions, 2 deletions
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) {
 				<th scope="col">Attribute</th>
 				<th scope="col">Name</th>
 				<th scope="col">Description</th>
+				if config.DevMode {
+					<th scope="col">Score</th>
+				}
 			</tr>
 		</thead>
 		<tbody>
 			for _, hit := range result.Hits {
 				if m := convertMatch[nix.Package](hit.Data); m != nil {
-					@packageRow(*m)
+					@packageRow(hit, *m)
 				}
 			}
 		</tbody>
 	</table>
 }
 
-templ packageRow(p nix.Package) {
+templ packageRow(hit index.DocumentMatch, p nix.Package) {
 	<tr>
 		<td>
 			@openDialogLink(p.Attribute)
@@ -35,5 +39,10 @@ templ packageRow(p nix.Package) {
 		<td>
 			{ p.Description }
 		</td>
+		if config.DevMode {
+			<td>
+				@score(hit)
+			</td>
+		}
 	</tr>
 }