package model import ( tea "github.com/charmbracelet/bubbletea" "tasksquire/common" "tasksquire/pages" "tasksquire/taskwarrior" ) type MainModel struct { common *common.Common selectedPage tea.Model selectedTask *taskwarrior.Task selectedReport *taskwarrior.Report selectedContext *taskwarrior.Context } func NewMainModel(common *common.Common) *MainModel { m := &MainModel{ common: common, selectedReport: common.TW.GetReport("next"), selectedContext: common.TW.GetActiveContext(), } m.selectedPage = pages.NewReportPage(common, m.selectedReport) return m } func (m MainModel) Init() tea.Cmd { return m.selectedPage.Init() } func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd // switch msg := msg.(type) { // case tea.KeyMsg: // switch { // case key.Matches(msg, m.common.Keymap.Add): // case key.Matches(msg, m.common.Keymap.Edit): // } // } m.selectedPage, cmd = m.selectedPage.Update(msg) return m, cmd } func (m MainModel) View() string { return m.selectedPage.View() }