Unify styles
This commit is contained in:
@@ -19,8 +19,19 @@ type TableStyle struct {
|
||||
Selected lipgloss.Style
|
||||
}
|
||||
|
||||
type Palette struct {
|
||||
Primary lipgloss.Style
|
||||
Secondary lipgloss.Style
|
||||
Accent lipgloss.Style
|
||||
Muted lipgloss.Style
|
||||
Border lipgloss.Style
|
||||
Background lipgloss.Style
|
||||
Text lipgloss.Style
|
||||
}
|
||||
|
||||
type Styles struct {
|
||||
Colors map[string]*lipgloss.Style
|
||||
Colors map[string]*lipgloss.Style
|
||||
Palette Palette
|
||||
|
||||
Base lipgloss.Style
|
||||
|
||||
@@ -50,23 +61,43 @@ func NewStyles(config *taskwarrior.TWConfig) *Styles {
|
||||
|
||||
styles.Colors = colors
|
||||
|
||||
styles.Base = lipgloss.NewStyle()
|
||||
// Initialize Palette (Iceberg Light)
|
||||
styles.Palette.Primary = lipgloss.NewStyle().Foreground(lipgloss.Color("#2d539e")) // Blue
|
||||
styles.Palette.Secondary = lipgloss.NewStyle().Foreground(lipgloss.Color("#7759b4")) // Purple
|
||||
styles.Palette.Accent = lipgloss.NewStyle().Foreground(lipgloss.Color("#c57339")) // Orange
|
||||
styles.Palette.Muted = lipgloss.NewStyle().Foreground(lipgloss.Color("#8389a3")) // Grey
|
||||
styles.Palette.Border = lipgloss.NewStyle().Foreground(lipgloss.Color("#cad0de")) // Light Grey Border
|
||||
styles.Palette.Background = lipgloss.NewStyle().Background(lipgloss.Color("#e8e9ec")) // Light Background
|
||||
styles.Palette.Text = lipgloss.NewStyle().Foreground(lipgloss.Color("#33374c")) // Dark Text
|
||||
|
||||
// Override from config if available (example mapping)
|
||||
if s, ok := styles.Colors["primary"]; ok {
|
||||
styles.Palette.Primary = *s
|
||||
}
|
||||
if s, ok := styles.Colors["secondary"]; ok {
|
||||
styles.Palette.Secondary = *s
|
||||
}
|
||||
if s, ok := styles.Colors["active"]; ok {
|
||||
styles.Palette.Accent = *s
|
||||
}
|
||||
|
||||
styles.Base = lipgloss.NewStyle().Foreground(styles.Palette.Text.GetForeground())
|
||||
|
||||
styles.TableStyle = TableStyle{
|
||||
// Header: lipgloss.NewStyle().Bold(true).Padding(0, 1).BorderBottom(true),
|
||||
Cell: lipgloss.NewStyle().Padding(0, 1, 0, 0),
|
||||
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1, 0, 0).Underline(true),
|
||||
Selected: lipgloss.NewStyle().Bold(true).Reverse(true),
|
||||
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1, 0, 0).Underline(true).Foreground(styles.Palette.Primary.GetForeground()),
|
||||
Selected: lipgloss.NewStyle().Bold(true).Reverse(true).Foreground(styles.Palette.Accent.GetForeground()),
|
||||
}
|
||||
|
||||
formTheme := huh.ThemeBase()
|
||||
formTheme.Focused.Title = formTheme.Focused.Title.Bold(true)
|
||||
formTheme.Focused.SelectSelector = formTheme.Focused.SelectSelector.SetString("→ ")
|
||||
formTheme.Focused.SelectedOption = formTheme.Focused.SelectedOption.Bold(true)
|
||||
formTheme.Focused.MultiSelectSelector = formTheme.Focused.MultiSelectSelector.SetString("→ ")
|
||||
formTheme.Focused.SelectedPrefix = formTheme.Focused.SelectedPrefix.SetString("✓ ")
|
||||
formTheme.Focused.Title = formTheme.Focused.Title.Bold(true).Foreground(styles.Palette.Primary.GetForeground())
|
||||
formTheme.Focused.SelectSelector = formTheme.Focused.SelectSelector.SetString("→ ").Foreground(styles.Palette.Accent.GetForeground())
|
||||
formTheme.Focused.SelectedOption = formTheme.Focused.SelectedOption.Bold(true).Foreground(styles.Palette.Accent.GetForeground())
|
||||
formTheme.Focused.MultiSelectSelector = formTheme.Focused.MultiSelectSelector.SetString("→ ").Foreground(styles.Palette.Accent.GetForeground())
|
||||
formTheme.Focused.SelectedPrefix = formTheme.Focused.SelectedPrefix.SetString("✓ ").Foreground(styles.Palette.Accent.GetForeground())
|
||||
formTheme.Focused.UnselectedPrefix = formTheme.Focused.SelectedPrefix.SetString("• ")
|
||||
formTheme.Blurred.Title = formTheme.Blurred.Title.Bold(true)
|
||||
formTheme.Blurred.Title = formTheme.Blurred.Title.Bold(true).Foreground(styles.Palette.Muted.GetForeground())
|
||||
formTheme.Blurred.SelectSelector = formTheme.Blurred.SelectSelector.SetString(" ")
|
||||
formTheme.Blurred.SelectedOption = formTheme.Blurred.SelectedOption.Bold(true)
|
||||
formTheme.Blurred.MultiSelectSelector = formTheme.Blurred.MultiSelectSelector.SetString(" ")
|
||||
@@ -77,27 +108,38 @@ func NewStyles(config *taskwarrior.TWConfig) *Styles {
|
||||
|
||||
styles.Tab = lipgloss.NewStyle().
|
||||
Padding(0, 1).
|
||||
Foreground(lipgloss.Color("240"))
|
||||
Foreground(styles.Palette.Muted.GetForeground())
|
||||
|
||||
styles.ActiveTab = styles.Tab.
|
||||
Foreground(lipgloss.Color("252")).
|
||||
Foreground(styles.Palette.Primary.GetForeground()).
|
||||
Bold(true)
|
||||
|
||||
styles.TabBar = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), false, false, true, false).
|
||||
BorderForeground(lipgloss.Color("240")).
|
||||
BorderForeground(styles.Palette.Border.GetForeground()).
|
||||
MarginBottom(1)
|
||||
|
||||
styles.ColumnFocused = lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true).Padding(1)
|
||||
styles.ColumnBlurred = lipgloss.NewStyle().Border(lipgloss.HiddenBorder(), true).Padding(1)
|
||||
styles.ColumnInsert = lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true).Padding(1)
|
||||
if styles.Colors["active"] != nil {
|
||||
styles.ColumnInsert = styles.ColumnInsert.BorderForeground(styles.Colors["active"].GetForeground())
|
||||
}
|
||||
styles.ColumnFocused = lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true).Padding(1).BorderForeground(styles.Palette.Primary.GetForeground())
|
||||
styles.ColumnBlurred = lipgloss.NewStyle().Border(lipgloss.HiddenBorder(), true).Padding(1).BorderForeground(styles.Palette.Border.GetForeground())
|
||||
styles.ColumnInsert = lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true).Padding(1).BorderForeground(styles.Palette.Accent.GetForeground())
|
||||
|
||||
return &styles
|
||||
}
|
||||
|
||||
func (s *Styles) GetModalSize(width, height int) (int, int) {
|
||||
modalWidth := 60
|
||||
if width < 64 {
|
||||
modalWidth = width - 4
|
||||
}
|
||||
|
||||
modalHeight := 20
|
||||
if height < 24 {
|
||||
modalHeight = height - 4
|
||||
}
|
||||
|
||||
return modalWidth, modalHeight
|
||||
}
|
||||
|
||||
func parseColorString(color string) *lipgloss.Style {
|
||||
if color == "" {
|
||||
return nil
|
||||
|
||||
@@ -81,10 +81,10 @@ func (d *DetailsViewer) View() string {
|
||||
// Title bar
|
||||
titleStyle := lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("252"))
|
||||
Foreground(d.common.Styles.Palette.Text.GetForeground())
|
||||
|
||||
helpStyle := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("240"))
|
||||
Foreground(d.common.Styles.Palette.Muted.GetForeground())
|
||||
|
||||
header := lipgloss.JoinHorizontal(
|
||||
lipgloss.Left,
|
||||
@@ -96,7 +96,7 @@ func (d *DetailsViewer) View() string {
|
||||
// Container style
|
||||
containerStyle := lipgloss.NewStyle().
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(lipgloss.Color("240")).
|
||||
BorderForeground(d.common.Styles.Palette.Border.GetForeground()).
|
||||
Padding(0, 1).
|
||||
Width(d.width).
|
||||
Height(d.height)
|
||||
@@ -104,7 +104,7 @@ func (d *DetailsViewer) View() string {
|
||||
// Optional: highlight border when focused (for future interactivity)
|
||||
if d.focused {
|
||||
containerStyle = containerStyle.
|
||||
BorderForeground(lipgloss.Color("86"))
|
||||
BorderForeground(d.common.Styles.Palette.Accent.GetForeground())
|
||||
}
|
||||
|
||||
content := lipgloss.JoinVertical(
|
||||
|
||||
@@ -90,7 +90,22 @@ func New(
|
||||
delegate.ShowDescription = false
|
||||
delegate.SetSpacing(0)
|
||||
|
||||
// Update Styles
|
||||
delegate.Styles.NormalTitle = lipgloss.NewStyle().Foreground(c.Styles.Palette.Text.GetForeground())
|
||||
delegate.Styles.SelectedTitle = lipgloss.NewStyle().Foreground(c.Styles.Palette.Accent.GetForeground()).Bold(true).PaddingLeft(2)
|
||||
delegate.Styles.NormalDesc = lipgloss.NewStyle().Foreground(c.Styles.Palette.Muted.GetForeground())
|
||||
delegate.Styles.SelectedDesc = lipgloss.NewStyle().Foreground(c.Styles.Palette.Accent.GetForeground()).PaddingLeft(2)
|
||||
delegate.Styles.FilterMatch = lipgloss.NewStyle().Foreground(c.Styles.Palette.Secondary.GetForeground()).Underline(true)
|
||||
|
||||
l := list.New([]list.Item{}, delegate, 0, 0)
|
||||
l.Styles.FilterPrompt = lipgloss.NewStyle().Foreground(c.Styles.Palette.Accent.GetForeground())
|
||||
l.Styles.FilterCursor = lipgloss.NewStyle().Foreground(c.Styles.Palette.Accent.GetForeground())
|
||||
|
||||
// Ensure the filter input text is readable (using Text color instead of potentially inheriting something else)
|
||||
l.FilterInput.TextStyle = lipgloss.NewStyle().Foreground(c.Styles.Palette.Text.GetForeground())
|
||||
l.FilterInput.PromptStyle = l.Styles.FilterPrompt
|
||||
l.FilterInput.CursorStyle = l.Styles.FilterCursor
|
||||
|
||||
l.SetShowTitle(false)
|
||||
l.SetShowHelp(false)
|
||||
l.SetShowStatusBar(false)
|
||||
|
||||
@@ -530,7 +530,7 @@ func (m *Model) renderRow(r int) string {
|
||||
if m.rows[r].IsGap {
|
||||
gapText := m.rows[r].GetString("gap_display")
|
||||
gapStyle := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("240")).
|
||||
Foreground(m.common.Styles.Palette.Muted.GetForeground()).
|
||||
Align(lipgloss.Center).
|
||||
Width(m.Width())
|
||||
return gapStyle.Render(gapText)
|
||||
|
||||
@@ -65,16 +65,9 @@ func NewContextPickerPage(common *common.Common) *ContextPickerPage {
|
||||
func (p *ContextPickerPage) SetSize(width, height int) {
|
||||
p.common.SetSize(width, height)
|
||||
|
||||
// Set list size with some padding/limits to look like a picker
|
||||
listWidth := width - 4
|
||||
if listWidth > 40 {
|
||||
listWidth = 40
|
||||
}
|
||||
listHeight := height - 6
|
||||
if listHeight > 20 {
|
||||
listHeight = 20
|
||||
}
|
||||
p.picker.SetSize(listWidth, listHeight)
|
||||
// Use shared modal sizing logic
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(width, height)
|
||||
p.picker.SetSize(modalWidth-2, modalHeight-2)
|
||||
}
|
||||
|
||||
func (p *ContextPickerPage) Init() tea.Cmd {
|
||||
@@ -124,20 +117,23 @@ func (p *ContextPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ContextPickerPage) View() string {
|
||||
width := p.common.Width() - 4
|
||||
if width > 40 {
|
||||
width = 40
|
||||
}
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(p.common.Width(), p.common.Height())
|
||||
|
||||
content := p.picker.View()
|
||||
styledContent := lipgloss.NewStyle().Width(width).Render(content)
|
||||
styledContent := lipgloss.NewStyle().
|
||||
Width(modalWidth).
|
||||
Height(modalHeight).
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(p.common.Styles.Palette.Border.GetForeground()).
|
||||
Padding(0, 1).
|
||||
Render(content)
|
||||
|
||||
return lipgloss.Place(
|
||||
p.common.Width(),
|
||||
p.common.Height(),
|
||||
lipgloss.Center,
|
||||
lipgloss.Center,
|
||||
p.common.Styles.Base.Render(styledContent),
|
||||
styledContent,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -55,16 +55,9 @@ func NewProjectPickerPage(common *common.Common, activeProject string) *ProjectP
|
||||
func (p *ProjectPickerPage) SetSize(width, height int) {
|
||||
p.common.SetSize(width, height)
|
||||
|
||||
// Set list size with some padding/limits to look like a picker
|
||||
listWidth := width - 4
|
||||
if listWidth > 40 {
|
||||
listWidth = 40
|
||||
}
|
||||
listHeight := height - 6
|
||||
if listHeight > 20 {
|
||||
listHeight = 20
|
||||
}
|
||||
p.picker.SetSize(listWidth, listHeight)
|
||||
// Use shared modal sizing logic
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(width, height)
|
||||
p.picker.SetSize(modalWidth-2, modalHeight-2)
|
||||
}
|
||||
|
||||
func (p *ProjectPickerPage) Init() tea.Cmd {
|
||||
@@ -112,20 +105,23 @@ func (p *ProjectPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ProjectPickerPage) View() string {
|
||||
width := p.common.Width() - 4
|
||||
if width > 40 {
|
||||
width = 40
|
||||
}
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(p.common.Width(), p.common.Height())
|
||||
|
||||
content := p.picker.View()
|
||||
styledContent := lipgloss.NewStyle().Width(width).Render(content)
|
||||
styledContent := lipgloss.NewStyle().
|
||||
Width(modalWidth).
|
||||
Height(modalHeight).
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(p.common.Styles.Palette.Border.GetForeground()).
|
||||
Padding(0, 1).
|
||||
Render(content)
|
||||
|
||||
return lipgloss.Place(
|
||||
p.common.Width(),
|
||||
p.common.Height(),
|
||||
lipgloss.Center,
|
||||
lipgloss.Center,
|
||||
p.common.Styles.Base.Render(styledContent),
|
||||
styledContent,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -335,30 +335,33 @@ func (p *ProjectTaskPickerPage) View() string {
|
||||
// Create distinct styling for focused vs blurred pickers
|
||||
var projectStyled, taskStyled string
|
||||
|
||||
focusedBorder := p.common.Styles.Palette.Accent.GetForeground()
|
||||
blurredBorder := p.common.Styles.Palette.Border.GetForeground()
|
||||
|
||||
if p.focusedPicker == 0 {
|
||||
// Project picker is focused
|
||||
projectStyled = lipgloss.NewStyle().
|
||||
Border(lipgloss.ThickBorder()).
|
||||
BorderForeground(lipgloss.Color("6")). // Cyan for focused
|
||||
BorderForeground(focusedBorder).
|
||||
Padding(0, 1).
|
||||
Render(projectView)
|
||||
|
||||
taskStyled = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("240")). // Gray for blurred
|
||||
BorderForeground(blurredBorder).
|
||||
Padding(0, 1).
|
||||
Render(taskView)
|
||||
} else {
|
||||
// Task picker is focused
|
||||
projectStyled = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("240")). // Gray for blurred
|
||||
BorderForeground(blurredBorder).
|
||||
Padding(0, 1).
|
||||
Render(projectView)
|
||||
|
||||
taskStyled = lipgloss.NewStyle().
|
||||
Border(lipgloss.ThickBorder()).
|
||||
BorderForeground(lipgloss.Color("6")). // Cyan for focused
|
||||
BorderForeground(focusedBorder).
|
||||
Padding(0, 1).
|
||||
Render(taskView)
|
||||
}
|
||||
@@ -376,7 +379,7 @@ func (p *ProjectTaskPickerPage) View() string {
|
||||
// Add help text
|
||||
helpText := "Tab/Shift+Tab: switch focus • Enter: select • a: add task • e: edit • t: track time • Esc: cancel"
|
||||
helpStyled := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("241")).
|
||||
Foreground(p.common.Styles.Palette.Muted.GetForeground()).
|
||||
Italic(true).
|
||||
Render(helpText)
|
||||
|
||||
|
||||
@@ -57,16 +57,9 @@ func NewReportPickerPage(common *common.Common, activeReport *taskwarrior.Report
|
||||
func (p *ReportPickerPage) SetSize(width, height int) {
|
||||
p.common.SetSize(width, height)
|
||||
|
||||
// Set list size with some padding/limits to look like a picker
|
||||
listWidth := width - 4
|
||||
if listWidth > 40 {
|
||||
listWidth = 40
|
||||
}
|
||||
listHeight := height - 6
|
||||
if listHeight > 20 {
|
||||
listHeight = 20
|
||||
}
|
||||
p.picker.SetSize(listWidth, listHeight)
|
||||
// Use shared modal sizing logic
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(width, height)
|
||||
p.picker.SetSize(modalWidth-2, modalHeight-2)
|
||||
}
|
||||
|
||||
func (p *ReportPickerPage) Init() tea.Cmd {
|
||||
@@ -112,20 +105,23 @@ func (p *ReportPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ReportPickerPage) View() string {
|
||||
width := p.common.Width() - 4
|
||||
if width > 40 {
|
||||
width = 40
|
||||
}
|
||||
modalWidth, modalHeight := p.common.Styles.GetModalSize(p.common.Width(), p.common.Height())
|
||||
|
||||
content := p.picker.View()
|
||||
styledContent := lipgloss.NewStyle().Width(width).Render(content)
|
||||
styledContent := lipgloss.NewStyle().
|
||||
Width(modalWidth).
|
||||
Height(modalHeight).
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(p.common.Styles.Palette.Border.GetForeground()).
|
||||
Padding(0, 1).
|
||||
Render(content)
|
||||
|
||||
return lipgloss.Place(
|
||||
p.common.Width(),
|
||||
p.common.Height(),
|
||||
lipgloss.Center,
|
||||
lipgloss.Center,
|
||||
p.common.Styles.Base.Render(styledContent),
|
||||
styledContent,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -323,11 +323,13 @@ func (p *TaskEditorPage) View() string {
|
||||
|
||||
tabs := ""
|
||||
for i, a := range p.areas {
|
||||
style := p.common.Styles.Base
|
||||
if i == p.area {
|
||||
tabs += p.common.Styles.Base.Bold(true).Render(fmt.Sprintf(" %s ", a.GetName()))
|
||||
style = style.Bold(true).Foreground(p.common.Styles.Palette.Accent.GetForeground())
|
||||
} else {
|
||||
tabs += p.common.Styles.Base.Render(fmt.Sprintf(" %s ", a.GetName()))
|
||||
style = style.Foreground(p.common.Styles.Palette.Muted.GetForeground())
|
||||
}
|
||||
tabs += style.Render(fmt.Sprintf(" %s ", a.GetName()))
|
||||
}
|
||||
|
||||
page := lipgloss.JoinVertical(
|
||||
@@ -1001,149 +1003,8 @@ func (d *detailsEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
func (d *detailsEdit) View() string {
|
||||
return d.ta.View()
|
||||
// dtls := `
|
||||
// # Cool Details!
|
||||
// ## Things I need
|
||||
// - [ ] A thing
|
||||
// - [x] Done thing
|
||||
|
||||
// ## People
|
||||
// - pe1
|
||||
// - pe2
|
||||
// `
|
||||
|
||||
// details, err := d.renderer.Render(dtls)
|
||||
// if err != nil {
|
||||
// slog.Error(err.Error())
|
||||
// return "Could not parse markdown"
|
||||
// }
|
||||
|
||||
// d.vp.SetContent(details)
|
||||
// return d.vp.View()
|
||||
}
|
||||
|
||||
// func (p *TaskEditorPage) SetSize(width, height int) {
|
||||
// p.common.SetSize(width, height)
|
||||
// }
|
||||
|
||||
// func (p *TaskEditorPage) Init() tea.Cmd {
|
||||
// // return p.form.Init()
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// func (p *TaskEditorPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
// var cmds []tea.Cmd
|
||||
|
||||
// switch msg := msg.(type) {
|
||||
// case SwitchModeMsg:
|
||||
// switch mode(msg) {
|
||||
// case modeNormal:
|
||||
// p.mode = modeNormal
|
||||
// case modeInsert:
|
||||
// p.mode = modeInsert
|
||||
// }
|
||||
// case changeAreaMsg:
|
||||
// p.selectedArea = area(msg)
|
||||
// p.columns = append([]tea.Model{p.areaList}, p.areas[p.selectedArea]...)
|
||||
// case nextColumnMsg:
|
||||
// p.columnCursor++
|
||||
// if p.columnCursor > len(p.columns)-1 {
|
||||
// p.columnCursor = 0
|
||||
// }
|
||||
// case prevColumnMsg:
|
||||
// p.columnCursor--
|
||||
// if p.columnCursor < 0 {
|
||||
// p.columnCursor = len(p.columns) - 1
|
||||
// }
|
||||
// }
|
||||
|
||||
// switch p.mode {
|
||||
// case modeNormal:
|
||||
// switch msg := msg.(type) {
|
||||
// case tea.KeyMsg:
|
||||
// switch {
|
||||
// case key.Matches(msg, p.common.Keymap.Back):
|
||||
// model, err := p.common.PopPage()
|
||||
// if err != nil {
|
||||
// slog.Error("page stack empty")
|
||||
// return nil, tea.Quit
|
||||
// }
|
||||
// return model, BackCmd
|
||||
// case key.Matches(msg, p.common.Keymap.Insert):
|
||||
// return p, p.switchModeCmd(modeInsert)
|
||||
// // case key.Matches(msg, p.common.Keymap.Ok):
|
||||
// // p.form.State = huh.StateCompleted
|
||||
// case key.Matches(msg, p.common.Keymap.Left):
|
||||
// return p, prevColumn()
|
||||
// case key.Matches(msg, p.common.Keymap.Right):
|
||||
// return p, nextColumn()
|
||||
// }
|
||||
// }
|
||||
// case modeInsert:
|
||||
// switch msg := msg.(type) {
|
||||
// case tea.KeyMsg:
|
||||
// switch {
|
||||
// case key.Matches(msg, p.common.Keymap.Back):
|
||||
// return p, p.switchModeCmd(modeNormal)
|
||||
// }
|
||||
// }
|
||||
|
||||
// var cmd tea.Cmd
|
||||
// if p.columnCursor == 0 {
|
||||
// p.areaList, cmd = p.areaList.Update(msg)
|
||||
// p.selectedArea = p.areaList.(areaList).Area()
|
||||
// cmds = append(cmds, cmd)
|
||||
// } else {
|
||||
// p.areas[p.selectedArea][p.columnCursor-1], cmd = p.areas[p.selectedArea][p.columnCursor-1].Update(msg)
|
||||
// cmds = append(cmds, cmd)
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// var cmd tea.Cmd
|
||||
// if p.columnCursor == 0 {
|
||||
// p.areaList, cmd = p.areaList.Update(msg)
|
||||
// p.selectedArea = p.areaList.(areaList).Area()
|
||||
// cmds = append(cmds, cmd)
|
||||
// } else {
|
||||
// p.areas[p.selectedArea][p.columnCursor-1], cmd = p.areas[p.selectedArea][p.columnCursor-1].Update(msg)
|
||||
// cmds = append(cmds, cmd)
|
||||
// }
|
||||
|
||||
// p.statusline, cmd = p.statusline.Update(msg)
|
||||
// cmds = append(cmds, cmd)
|
||||
|
||||
// // if p.form.State == huh.StateCompleted {
|
||||
// // cmds = append(cmds, p.updateTasksCmd)
|
||||
// // model, err := p.common.PopPage()
|
||||
// // if err != nil {
|
||||
// // slog.Error("page stack empty")
|
||||
// // return nil, tea.Quit
|
||||
// // }
|
||||
// // return model, tea.Batch(cmds...)
|
||||
// // }
|
||||
|
||||
// return p, tea.Batch(cmds...)
|
||||
// }
|
||||
|
||||
// func (p *TaskEditorPage) View() string {
|
||||
// columns := make([]string, len(p.columns))
|
||||
// for i, c := range p.columns {
|
||||
// columns[i] = c.View()
|
||||
// }
|
||||
|
||||
// return lipgloss.JoinVertical(
|
||||
// lipgloss.Left,
|
||||
// lipgloss.JoinHorizontal(
|
||||
// lipgloss.Top,
|
||||
// // lipgloss.Place(p.common.Width(), p.common.Height()-1, 0.5, 0.5, p.form.View(), lipgloss.WithWhitespaceBackground(p.common.Styles.Warning.GetForeground())),
|
||||
// // lipgloss.Place(p.common.Width(), p.common.Height()-1, 0.5, 0.5, p.form.View(), lipgloss.WithWhitespaceChars(" . ")),
|
||||
// columns...,
|
||||
// ),
|
||||
// p.statusline.View(),
|
||||
// )
|
||||
// }
|
||||
|
||||
func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
p.task.Project = p.areas[0].(*taskEdit).projectPicker.GetValue()
|
||||
|
||||
@@ -1160,10 +1021,6 @@ func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
}
|
||||
}
|
||||
|
||||
// if *(p.areas[0].(*taskEdit).newProjectName) != "" {
|
||||
// p.task.Project = *p.areas[0].(*taskEdit).newProjectName
|
||||
// }
|
||||
|
||||
// Sync timestamp fields from the timeEdit area (area 2)
|
||||
p.areas[2].(*timeEdit).syncToTaskFields()
|
||||
|
||||
@@ -1172,8 +1029,6 @@ func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
Entry: time.Now().Format("20060102T150405Z"),
|
||||
Description: *(p.areas[0].(*taskEdit).newAnnotation),
|
||||
})
|
||||
|
||||
// p.common.TW.AddTaskAnnotation(p.task.Uuid, *p.areas[0].(*taskEdit).newAnnotation)
|
||||
}
|
||||
|
||||
if _, ok := p.task.Udas["details"]; ok || p.areas[3].(*detailsEdit).ta.Value() != "" {
|
||||
@@ -1184,100 +1039,5 @@ func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
return UpdatedTasksMsg{}
|
||||
}
|
||||
|
||||
// type StatusLine struct {
|
||||
// common *common.Common
|
||||
// mode mode
|
||||
// input textinput.Model
|
||||
// }
|
||||
|
||||
// func NewStatusLine(common *common.Common, mode mode) *StatusLine {
|
||||
// input := textinput.New()
|
||||
// input.Placeholder = ""
|
||||
// input.Prompt = ""
|
||||
// input.Blur()
|
||||
|
||||
// return &StatusLine{
|
||||
// input: textinput.New(),
|
||||
// common: common,
|
||||
// mode: mode,
|
||||
// }
|
||||
// }
|
||||
|
||||
// func (s *StatusLine) Init() tea.Cmd {
|
||||
// s.input.Blur()
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// func (s *StatusLine) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
// var cmd tea.Cmd
|
||||
|
||||
// switch msg := msg.(type) {
|
||||
// case SwitchModeMsg:
|
||||
// s.mode = mode(msg)
|
||||
// switch s.mode {
|
||||
// case modeNormal:
|
||||
// s.input.Blur()
|
||||
// case modeInsert:
|
||||
// s.input.Focus()
|
||||
// }
|
||||
// case tea.KeyMsg:
|
||||
// switch {
|
||||
// case key.Matches(msg, s.common.Keymap.Back):
|
||||
// s.input.Blur()
|
||||
// case key.Matches(msg, s.common.Keymap.Input):
|
||||
// s.input.Focus()
|
||||
// }
|
||||
// }
|
||||
|
||||
// s.input, cmd = s.input.Update(msg)
|
||||
// return s, cmd
|
||||
// }
|
||||
|
||||
// func (s *StatusLine) View() string {
|
||||
// var mode string
|
||||
// switch s.mode {
|
||||
// case modeNormal:
|
||||
// mode = s.common.Styles.Base.Render("NORMAL")
|
||||
// case modeInsert:
|
||||
// mode = s.common.Styles.Active.Inline(true).Reverse(true).Render("INSERT")
|
||||
// }
|
||||
// return lipgloss.JoinHorizontal(lipgloss.Left, mode, s.input.View())
|
||||
// }
|
||||
|
||||
// // TODO: move this to taskwarrior; add missing date formats
|
||||
|
||||
// type itemDelegate struct{}
|
||||
|
||||
// func (d itemDelegate) Height() int { return 1 }
|
||||
// func (d itemDelegate) Spacing() int { return 0 }
|
||||
// func (d itemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }
|
||||
// func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) {
|
||||
// i, ok := listItem.(item)
|
||||
// if !ok {
|
||||
// return
|
||||
// }
|
||||
|
||||
// str := fmt.Sprintf("%s", i)
|
||||
|
||||
// fn := itemStyle.Render
|
||||
// if index == m.Index() {
|
||||
// fn = func(s ...string) string {
|
||||
// return selectedItemStyle.Render("> " + strings.Join(s, " "))
|
||||
// }
|
||||
// }
|
||||
|
||||
// fmt.Fprint(w, fn(str))
|
||||
// }
|
||||
|
||||
// var (
|
||||
// titleStyle = lipgloss.NewStyle().MarginLeft(2)
|
||||
// itemStyle = lipgloss.NewStyle().PaddingLeft(4)
|
||||
// selectedItemStyle = lipgloss.NewStyle().PaddingLeft(2).Foreground(lipgloss.Color("170"))
|
||||
// paginationStyle = list.DefaultStyles().PaginationStyle.PaddingLeft(4)
|
||||
// helpStyle = list.DefaultStyles().HelpStyle.PaddingLeft(4).PaddingBottom(1)
|
||||
// quitTextStyle = lipgloss.NewStyle().Margin(1, 0, 2, 4)
|
||||
// )
|
||||
|
||||
// type item string
|
||||
|
||||
// func (i item) FilterValue() string { return "" }
|
||||
// type StatusLine struct { ... }
|
||||
// ...
|
||||
|
||||
@@ -144,7 +144,7 @@ func (p *TimePage) renderHeader() string {
|
||||
|
||||
slog.Info("Rendering time page header", "text", headerText, "timespan", p.selectedTimespan)
|
||||
// Make header bold and prominent
|
||||
headerStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("6"))
|
||||
headerStyle := lipgloss.NewStyle().Bold(true).Foreground(p.common.Styles.Palette.Accent.GetForeground())
|
||||
return headerStyle.Render(headerText)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user