refactor(ui): вынести панель «Детали задачи» (TaskDetailPanel) из монолита окна
Спеца 12.11: интерфейс + Nil + TaskDetailText в internal/ui/task_detail.go, Fyne-реализация в internal/ui/desktop/task_detail_panel.go. selectTask делегирует в панель; диалог и «Состояние» — отдельные панели, не трогаем.
This commit is contained in:
@@ -44,9 +44,7 @@ type Window struct {
|
||||
|
||||
// виджеты
|
||||
taskList *TaskListPanel
|
||||
titleLbl *widget.Label
|
||||
statusLbl *widget.Label
|
||||
detailLbl *widget.Label
|
||||
detail *TaskDetailPanel
|
||||
convLbl *widget.Label
|
||||
stateLbl *widget.Label
|
||||
logs *LogPanel
|
||||
@@ -83,12 +81,7 @@ func (w *Window) SetOnQuit(fn func()) { w.onQuit = fn }
|
||||
|
||||
// build собирает виджеты и раскладку.
|
||||
func (w *Window) build() {
|
||||
w.titleLbl = widget.NewLabel("—")
|
||||
w.titleLbl.TextStyle = fyne.TextStyle{Bold: true}
|
||||
w.statusLbl = widget.NewLabel("")
|
||||
w.statusLbl.TextStyle = fyne.TextStyle{Italic: true}
|
||||
w.detailLbl = widget.NewLabel("")
|
||||
w.detailLbl.Wrapping = fyne.TextWrapWord
|
||||
w.detail = NewTaskDetailPanel()
|
||||
|
||||
w.convLbl = widget.NewLabel("Выберите задачу.")
|
||||
w.convLbl.Wrapping = fyne.TextWrapWord
|
||||
@@ -111,7 +104,7 @@ func (w *Window) build() {
|
||||
left := container.NewBorder(nil, quitBtn, nil, nil, w.taskList.Widget())
|
||||
|
||||
// Рабочая область: детали сверху, диалог снизу (сплит 2×2 в плане).
|
||||
details := container.NewVBox(w.titleLbl, w.statusLbl, w.detailLbl)
|
||||
details := w.detail.Widget()
|
||||
convScroll := container.NewScroll(w.convLbl)
|
||||
right := container.NewVSplit(
|
||||
container.NewScroll(details),
|
||||
@@ -176,19 +169,11 @@ func (w *Window) selectTask(id int64) {
|
||||
ctx := context.Background()
|
||||
t, err := w.store.GetTask(ctx, id)
|
||||
if err != nil {
|
||||
w.titleLbl.SetText("—")
|
||||
w.statusLbl.SetText("")
|
||||
w.detailLbl.SetText("")
|
||||
w.detail.ShowEmpty()
|
||||
w.convLbl.SetText("")
|
||||
return
|
||||
}
|
||||
w.titleLbl.SetText(t.Title)
|
||||
w.statusLbl.SetText(string(t.Status))
|
||||
detail := "Цель: " + t.Goal
|
||||
if len(t.Repos) > 0 {
|
||||
detail += "\nРепозитории: " + strings.Join(t.Repos, ", ")
|
||||
}
|
||||
w.detailLbl.SetText(detail)
|
||||
w.detail.ShowTask(t)
|
||||
|
||||
// Диалог: история + краткие трассы.
|
||||
hist, err := w.store.GetHistory(ctx, id)
|
||||
|
||||
Reference in New Issue
Block a user