Every workspace split into real panes: 19 panes across 7 workspaces, one program per panel

This commit is contained in:
Sam
2026-11-10 16:29:27 +11:00
parent 2640049f1f
commit 32fa2752af
19 changed files with 972 additions and 58 deletions

View File

@@ -35,6 +35,7 @@ type taskCost struct {
}
type projectModel struct {
panel string
client *paperclip.Client
folder string
@@ -55,8 +56,8 @@ type projectModel struct {
var projectTabs = []string{"facts", "costs", "settings"}
func newProjectModel(c *paperclip.Client, folder string) projectModel {
return projectModel{client: c, folder: folder}
func newProjectModel(c *paperclip.Client, folder, panel string) projectModel {
return projectModel{client: c, folder: folder, panel: panel}
}
func (m projectModel) Init() tea.Cmd {
@@ -193,7 +194,46 @@ func (m projectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
// singleView is one panel filling the pane: facts, costs or settings.
func (m projectModel) singleView() string {
titles := map[string]string{"facts": "the project", "costs": "what it has cost", "settings": "settings and limits"}
title := titles[m.panel]
if title == "" {
title = "the project"
}
var body []string
switch m.panel {
case "costs":
body = m.costLines()
case "settings":
body = m.settingLines()
default:
body = m.factLines()
}
if m.err != nil {
body = append([]string{lipgloss.NewStyle().Foreground(lipgloss.Color(active.Error)).Render("error: " + m.err.Error()), ""}, body...)
}
footer := hintLine([]string{
keyHint("↑↓ j k", "scroll"),
keyHint("r", "read again"),
keyHint("R", "rebuild"),
keyHint("?", "keys"),
}, m.width)
if m.showHelp {
return helpOverlay(title, [][2]string{
{"↑ ↓ j k", "scroll"}, {"r / R", "read again / rebuild"}, {"q", "leave"},
}, m.width, m.height)
}
return singlePanel(title, nil, 0, body, m.width, m.height, footer, m.scroll)
}
func (m projectModel) View() string {
if m.panel != "" {
if m.width == 0 {
return "reading…"
}
return m.singleView()
}
if m.width == 0 || m.height == 0 {
return "reading…"
}