// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial // SPDX-FileCopyrightText: 2025-2026 Christian Galo package server import "git.coopcloud.tech/wiki-cafe/member-console/internal/forms" // The landing surface's lookup (spec operator-panel-navigation "The landing // surface's lookup is a search form"; spec form-conventions "Every mutation // form's no-JS behavior is a recorded decision"; design D4). A search form // renders a native GET action and carries no CSRF header, so it keeps a // true no-JS fallback: without JavaScript the lookup navigates and resolves // exactly as it does with JavaScript (finding FA-24 correction 8). // // This file is the form's home; the registry is only the index (design D1). // It sits beside operator.go, which parses the query string through the // declaration and never through r.FormValue. const operatorLookupFormName = "operator.lookup.search" // The lookup is a wide bar: the Bar family is the only one a Search form // may declare (design D20), and Wide drops the 30rem cap so the bar spans // the content column. It is the landing surface's primary control and its // width says so. Its button is outline like every other bar's, because a // search is not a commit; round 3 left this one filled as an exception and // the maintainer noticed the exception (2026-09-04). var operatorLookupForm = forms.Register(forms.FormSpec{ Name: operatorLookupFormName, Kind: forms.KindSearch, Family: forms.Bar, Wide: true, Method: "GET", Path: "/operator/lookup", Target: "#lookup-result", Swap: "innerHTML", Fields: []forms.Field{ { // The placeholder repeats the visually hidden label: a search // bar is the one control whose prompt lives in the box, and // round 3's copy audit had emptied it under the format-example // rule until the maintainer asked for the text back // (2026-09-05: "it was good"). The label stays for the screen // reader, next to the equally-hidden

that names the // region. Name: "term", Label: "Find anything by its name, key, or number", HideLabel: true, Control: forms.Text, Placeholder: "Find anything by its name, key, or number", Autocomplete: "off", }, }, Commit: "Look up", }) // lookupForm renders the lookup declaration bound to the operator's typed // term, so a re-render (a disambiguation list, a no-match notice) keeps // what they typed in the control. func lookupForm(term string) forms.FormView { values := forms.NewValues() values.Set("term", term) return forms.Render(operatorLookupForm, forms.Binding{ Mode: forms.ModeRecord, Values: values, }) }