about summary refs log tree commit diff stats
path: root/internal/components/data.go
diff options
context:
space:
mode:
authorAlan Pearce2024-06-21 13:02:08 +0200
committerAlan Pearce2024-06-21 15:44:12 +0200
commita1dfc548198a1326e71f1dd70303a5d3441f7a39 (patch)
tree03e7d60dc389678ee7cadaac4d5e64596dffde91 /internal/components/data.go
parentcac323d9ae70f55a43fd99b73e60cf614be11797 (diff)
downloadsearchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.tar.lz
searchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.tar.zst
searchix-a1dfc548198a1326e71f1dd70303a5d3441f7a39.zip
refactor: switch to templ for HTML templates
Diffstat (limited to 'internal/components/data.go')
-rw-r--r--internal/components/data.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/components/data.go b/internal/components/data.go
new file mode 100644
index 0000000..64caeaa
--- /dev/null
+++ b/internal/components/data.go
@@ -0,0 +1,37 @@
+package components
+
+import (
+	"searchix/frontend"
+	"searchix/internal/config"
+	search "searchix/internal/index"
+	"searchix/internal/nix"
+
+	"github.com/blevesearch/bleve/v2"
+)
+
+type TemplateData struct {
+	Sources       []*config.Source
+	Source        config.Source
+	Query         string
+	Results       bool
+	SourceResult  *bleve.SearchResult
+	ExtraHeadHTML string
+	Code          int
+	Message       string
+	Assets        *frontend.AssetCollection
+}
+
+type ResultData struct {
+	TemplateData
+	Query          string
+	ResultsPerPage int
+	Results        *search.Result
+	Prev           string
+	Next           string
+}
+
+type DocumentData struct {
+	TemplateData
+	Document *nix.Importable
+	Children *search.Result
+}