Новая настройка app_settings.indicator_mode (color | accessible), переключается на /setup. В режиме accessible сигналы, которые раньше держались только на цвете, переходят на форму/текст: - качество цены (0-9) — 5-ступенчатый signal-meter вместо градиентной точки/числа; единый модуль web/static/price-quality.js, ветвление по window.QF_INDICATOR_MODE; - вкладка «Ценообразование»: ведущая колонка-meter вместо заливки строк, пометка W вместо амбер-подсветки world-цен, ⚠ вместо красного «загрязнённого» итога. - GET/PUT /api/settings/ui (без рестарта), регистрируется в обоих наборах роутов. /setup переустроен: две колонки одной высоты, кнопка «Вернуться в приложение», исправлен <title>. Документация: bible-local 02/03/04 + decisions/2026-08-31-accessible-indicator-mode.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LbRvQgPZpM4SJTaX3iLrXk
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.mchus.pro/mchus/quoteforge/internal/localdb"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// SettingsHandler serves per-client UI display preferences stored in app_settings.
|
|
type SettingsHandler struct {
|
|
localDB *localdb.LocalDB
|
|
}
|
|
|
|
func NewSettingsHandler(localDB *localdb.LocalDB) *SettingsHandler {
|
|
return &SettingsHandler{localDB: localDB}
|
|
}
|
|
|
|
type uiSettingsResponse struct {
|
|
IndicatorMode string `json:"indicator_mode"`
|
|
}
|
|
|
|
// GetUI returns the current UI display preferences.
|
|
func (h *SettingsHandler) GetUI(c *gin.Context) {
|
|
c.JSON(http.StatusOK, uiSettingsResponse{
|
|
IndicatorMode: h.localDB.GetIndicatorMode(),
|
|
})
|
|
}
|
|
|
|
// PutUI updates UI display preferences. Currently only indicator_mode.
|
|
func (h *SettingsHandler) PutUI(c *gin.Context) {
|
|
req, ok := BindJSON[struct {
|
|
IndicatorMode string `json:"indicator_mode"`
|
|
}](c)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
if err := h.localDB.SetIndicatorMode(req.IndicatorMode); err != nil {
|
|
RespondError(c, http.StatusUnprocessableEntity, "invalid indicator_mode", err)
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, uiSettingsResponse{
|
|
IndicatorMode: h.localDB.GetIndicatorMode(),
|
|
})
|
|
}
|