Fix table formatting
This commit is contained in:
@ -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),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user