This commit is contained in:
Martin Pander
2026-03-03 21:11:58 +01:00
parent f6ce2e30dc
commit 6f77b03555
8 changed files with 1409 additions and 295 deletions

View File

@@ -3,8 +3,8 @@ package pages
import (
"tasksquire/internal/common"
tea "charm.land/bubbletea/v2"
"charm.land/bubbles/v2/key"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
)
@@ -48,7 +48,7 @@ func (m *MainPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.common.SetSize(msg.Width, msg.Height)
tabHeight := lipgloss.Height(m.renderTabBar())
contentHeight := max(msg.Height - tabHeight, 0)
contentHeight := max(msg.Height-tabHeight, 0)
newMsg := tea.WindowSizeMsg{Width: msg.Width, Height: contentHeight}
activePage, cmd := m.activePage.Update(newMsg)
@@ -58,14 +58,14 @@ func (m *MainPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeyMsg:
// Only handle tab key for page switching when at the top level (no subpages active)
if key.Matches(msg, m.common.Keymap.Next) && !m.common.HasSubpages() {
// if m.activePage == m.taskPage {
// m.activePage = m.timePage
// m.currentTab = 1
// } else {
// m.activePage = m.taskPage
// m.currentTab = 0
// }
//
// if m.activePage == m.taskPage {
// m.activePage = m.timePage
// m.currentTab = 1
// } else {
// m.activePage = m.taskPage
// m.currentTab = 0
// }
//
tabHeight := lipgloss.Height(m.renderTabBar())
contentHeight := m.height - tabHeight
if contentHeight < 0 {
@@ -100,7 +100,7 @@ func (m *MainPage) renderTabBar() string {
}
func (m *MainPage) View() tea.View {
v := tea.NewView(lipgloss.JoinVertical(lipgloss.Left, m.renderTabBar(), m.activePage.View().Content))
v := tea.NewView(lipgloss.NewStyle().Margin(1, 3).Render(lipgloss.JoinVertical(lipgloss.Left, m.renderTabBar(), m.activePage.View().Content)))
v.AltScreen = true
return v
// return lipgloss.JoinVertical(lipgloss.Left, m.renderTabBar(), m.activePage.View())