feat(settings): add gear trigger and panel markup to base template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ashisgreat22 2026-03-22 02:51:29 +01:00
parent 8e53a8b11d
commit 84777211f8
2 changed files with 21 additions and 1 deletions

View file

@ -14,12 +14,30 @@
<link title="kafka" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
</head>
<body class="{{if .Query}}search_on_results{{end}}">
<header class="site-header">
<span class="site-title">kafka</span>
<!-- Desktop trigger (hidden on mobile via CSS) -->
<button id="settings-trigger" class="settings-trigger settings-trigger-desktop"
aria-label="Preferences" aria-expanded="false" aria-controls="settings-popover">&#9881;</button>
</header>
<!-- Mobile FAB trigger (shown only on mobile via CSS) -->
<button id="settings-trigger-mobile" class="settings-trigger settings-trigger-mobile"
aria-label="Preferences" aria-expanded="false" aria-controls="settings-popover"
style="display:none;">&#9881;</button>
<main>
{{template "content" .}}
</main>
<footer>
<p>Powered by <a href="https://git.ashisgreat.xyz/penal-colony/kafka">kafka</a> — a privacy-respecting, open metasearch engine</p>
</footer>
<script src="/static/js/settings.js"></script>
<div id="settings-popover" data-open="false" role="dialog" aria-label="Preferences" aria-modal="true">
<div class="settings-popover-header">
Preferences
<button class="settings-popover-close" aria-label="Close">&#215;</button>
</div>
<div class="settings-popover-body"></div>
</div>
<script>
(function () {
'use strict';

View file

@ -32,6 +32,7 @@ type PageData struct {
Infoboxes []InfoboxView
UnresponsiveEngines [][2]string
PageNumbers []PageNumber
ShowHeader bool
}
// ResultView is a template-friendly wrapper around a MainResult.
@ -163,12 +164,13 @@ func FromResponse(resp contracts.SearchResponse, query string, pageno int) PageD
// RenderIndex renders the homepage (search box only).
func RenderIndex(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
return tmplIndex.ExecuteTemplate(w, "base", PageData{})
return tmplIndex.ExecuteTemplate(w, "base", PageData{ShowHeader: true})
}
// RenderSearch renders the full search results page (with base layout).
func RenderSearch(w http.ResponseWriter, data PageData) error {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
data.ShowHeader = true
return tmplFull.ExecuteTemplate(w, "base", data)
}