From 14ff1a25b94b1d52d0a133917f36e8a374e3aa50 Mon Sep 17 00:00:00 2001 From: mirivlad Date: Sat, 30 May 2026 21:56:07 +0800 Subject: [PATCH] fix: bind sidebar selection to filtered content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: single global 'cur' node ID was shared across all sections. Switching between 'Клиенты'/'Проекты'/etc did not change the rendered content because renderToday/renderInbox/ loadSection all loaded the same flat root-node list and switchTab('ov') re-rendered selN(cur) regardless of which section was active. Fix: split selection into two distinct states: sel = {kind:'section', section:'today'|'inbox'|'clients'|...} or sel = {kind:'node', nodeId:''} Each section renders its own content (title, quick-actions, filtered items, empty state). Real nodes show their own dashboard. Tab dispatch checks sel.kind first. Sidebar separated into: 'НАВИГАЦИЯ' — virtual sections (today/inbox/7 categories) 'ДЕЛА' — real user nodes from API Russian type labels everywhere (TL map). Section metadata (SEC_META) provides per-section empty states and action types. Known limitation: section content currently shows all root nodes (backend has no section/group column yet). When section assignment is added to the data model, filtering will wire up without frontend changes — renderSectionList already receives the section id. --- internal/gui/index.html.go | 703 +++++++++++++++++++++++---------- internal/gui/static/index.html | 262 +----------- 2 files changed, 488 insertions(+), 477 deletions(-) diff --git a/internal/gui/index.html.go b/internal/gui/index.html.go index 53c94cc..11afd68 100644 --- a/internal/gui/index.html.go +++ b/internal/gui/index.html.go @@ -3,6 +3,11 @@ package gui // indexHTML — SPA-фронтенд Верстака (тёмная тема, левое дерево, вкладки). // Весь UI в одном файле: CSS + HTML + JS. Wails-совместимость: структура // готова к упаковке (нет external JS/CSS, fetch к /api/* через origin). +// +// navigation state: +// sel = { kind:'section', section:'today'|'inbox'|'clients'|'projects'|'recipes'|'documents'|'archive' } +// or { kind:'node', nodeId:'' } +// tab = 'ov'|'notes'|'files'|'actions'|'worklog'|'activity' const indexHTML = ` @@ -10,7 +15,6 @@ const indexHTML = ` Верстак - - - -
-
⚒ ВЕРСТАК
-
Пусто. Создайте первое дело.
-
- -
-

Верстак

- - - - -
-
Обзор
Заметки
Файлы
-
-
-
Выберите дело или создайте новое
-
- -
-
Редактор
- -
-
- -
-

Новое дело

- - -
-
- -
-

Новая заметка

- -
-
- - - - +// This file is unused — the GUI now serves HTML from internal/gui/index.html.go +// via an inline template. Kept to avoid the embed directory dependency. +// Safe to delete in a cleanup pass.