[WIP] Layout
This commit is contained in:
@ -4,24 +4,47 @@ import (
|
||||
"context"
|
||||
|
||||
"tasksquire/taskwarrior"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
type Common struct {
|
||||
Ctx context.Context
|
||||
PageStack *Stack[tea.Model]
|
||||
TW taskwarrior.TaskWarrior
|
||||
Keymap *Keymap
|
||||
Styles *Styles
|
||||
Ctx context.Context
|
||||
TW taskwarrior.TaskWarrior
|
||||
Keymap *Keymap
|
||||
Styles *Styles
|
||||
|
||||
pageStack *Stack[Component]
|
||||
width int
|
||||
height int
|
||||
}
|
||||
|
||||
func NewCommon(ctx context.Context, tw taskwarrior.TaskWarrior) *Common {
|
||||
return &Common{
|
||||
Ctx: ctx,
|
||||
PageStack: NewStack[tea.Model](),
|
||||
TW: tw,
|
||||
Keymap: NewKeymap(),
|
||||
Styles: NewStyles(tw.GetConfig()),
|
||||
Ctx: ctx,
|
||||
TW: tw,
|
||||
Keymap: NewKeymap(),
|
||||
Styles: NewStyles(tw.GetConfig()),
|
||||
|
||||
pageStack: NewStack[Component](),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Common) SetSize(width, height int) {
|
||||
c.width = width
|
||||
c.height = height
|
||||
}
|
||||
|
||||
func (c *Common) Width() int {
|
||||
return c.width
|
||||
}
|
||||
|
||||
func (c *Common) Height() int {
|
||||
return c.height
|
||||
}
|
||||
|
||||
func (c *Common) PushPage(page Component) {
|
||||
c.pageStack.Push(page)
|
||||
}
|
||||
|
||||
func (c *Common) PopPage() (Component, error) {
|
||||
return c.pageStack.Pop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user