Fix table formatting
This commit is contained in:
@ -96,7 +96,7 @@ func (p *ContextPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ContextPickerPage) View() string {
|
||||
return p.common.Styles.Main.Render(p.form.View())
|
||||
return p.common.Styles.Base.Render(p.form.View())
|
||||
}
|
||||
|
||||
func (p *ContextPickerPage) updateContextCmd() tea.Msg {
|
||||
|
||||
@ -92,7 +92,7 @@ func (p *ProjectPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ProjectPickerPage) View() string {
|
||||
return p.common.Styles.Main.Render(p.form.View())
|
||||
return p.common.Styles.Base.Render(p.form.View())
|
||||
}
|
||||
|
||||
func (p *ProjectPickerPage) updateProjectCmd() tea.Msg {
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
package pages
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"tasksquire/common"
|
||||
"tasksquire/components/table"
|
||||
"tasksquire/taskwarrior"
|
||||
@ -34,15 +33,15 @@ func NewReportPage(com *common.Common, report *taskwarrior.Report) *ReportPage {
|
||||
activeReport: report,
|
||||
activeContext: com.TW.GetActiveContext(),
|
||||
activeProject: "",
|
||||
taskTable: table.New(com),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ReportPage) SetSize(width int, height int) {
|
||||
p.common.SetSize(width, height)
|
||||
slog.Info("FramSize", "vert", p.common.Styles.Main.GetVerticalFrameSize(), "horz", p.common.Styles.Main.GetHorizontalFrameSize())
|
||||
|
||||
p.taskTable.SetWidth(width - p.common.Styles.Main.GetVerticalFrameSize())
|
||||
p.taskTable.SetHeight(height - p.common.Styles.Main.GetHorizontalFrameSize())
|
||||
p.taskTable.SetWidth(width - p.common.Styles.Base.GetVerticalFrameSize())
|
||||
p.taskTable.SetHeight(height - p.common.Styles.Base.GetHorizontalFrameSize())
|
||||
}
|
||||
|
||||
func (p *ReportPage) Init() tea.Cmd {
|
||||
@ -130,9 +129,9 @@ func (p *ReportPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
func (p *ReportPage) View() string {
|
||||
// return p.common.Styles.Main.Render(p.taskTable.View()) + "\n"
|
||||
if p.tasks == nil || len(p.tasks) == 0 {
|
||||
return p.common.Styles.Main.Render("No tasks found")
|
||||
return p.common.Styles.Base.Render("No tasks found")
|
||||
}
|
||||
return p.common.Styles.Main.Render(p.taskTable.View())
|
||||
return p.taskTable.View()
|
||||
}
|
||||
|
||||
func (p *ReportPage) populateTaskTable(tasks taskwarrior.Tasks) {
|
||||
@ -151,11 +150,12 @@ func (p *ReportPage) populateTaskTable(tasks taskwarrior.Tasks) {
|
||||
}
|
||||
|
||||
p.taskTable = table.New(
|
||||
p.common,
|
||||
table.WithReport(p.activeReport),
|
||||
table.WithTasks(tasks),
|
||||
table.WithFocused(true),
|
||||
table.WithWidth(p.common.Width()-p.common.Styles.Main.GetVerticalFrameSize()),
|
||||
table.WithHeight(p.common.Height()-p.common.Styles.Main.GetHorizontalFrameSize()-10),
|
||||
table.WithWidth(p.common.Width()-p.common.Styles.Base.GetVerticalFrameSize()),
|
||||
table.WithHeight(p.common.Height()-p.common.Styles.Base.GetHorizontalFrameSize()-1),
|
||||
table.WithStyles(p.common.Styles.TableStyle),
|
||||
)
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ func (p *ReportPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ReportPickerPage) View() string {
|
||||
return p.common.Styles.Main.Render(p.form.View())
|
||||
return p.common.Styles.Base.Render(p.form.View())
|
||||
}
|
||||
|
||||
func (p *ReportPickerPage) updateReportCmd() tea.Msg {
|
||||
|
||||
@ -314,7 +314,7 @@ func (s *StatusLine) View() string {
|
||||
var mode string
|
||||
switch s.mode {
|
||||
case ModeNormal:
|
||||
mode = s.common.Styles.Main.Render("NORMAL")
|
||||
mode = s.common.Styles.Base.Render("NORMAL")
|
||||
case ModeInsert:
|
||||
mode = s.common.Styles.Active.Inline(true).Render("INSERT")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user