fix: API JSON error responses + navbar with dropdowns

- Add backend/libs/go-http-errors for consistent JSON errors
- REST API: use writeMethodNotAllowed, writeNotFound, writeInternalError
- middleware, gateway, search: use httperrors.WriteJSON
- SPA: navbar with Explore/Tools/More dropdowns, initNavDropdowns()
- Next.js: Navbar component with dropdowns + mobile menu

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-16 03:09:53 -08:00
parent 53114e75fd
commit a36ab9d47c
16 changed files with 3979 additions and 3191 deletions

View File

@@ -0,0 +1,26 @@
package httperrors
import (
"encoding/json"
"net/http"
)
// ErrorResponse is the standard JSON error body for API responses.
type ErrorResponse struct {
Error struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
// WriteJSON writes a JSON error response with the given status code and message.
func WriteJSON(w http.ResponseWriter, statusCode int, code, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode)
json.NewEncoder(w).Encode(ErrorResponse{
Error: struct {
Code string `json:"code"`
Message string `json:"message"`
}{Code: code, Message: message},
})
}