1package page
2
3import (
4 tea "github.com/charmbracelet/bubbletea"
5 "github.com/kujtimiihoxha/termai/internal/tui/components/logs"
6 "github.com/kujtimiihoxha/termai/internal/tui/layout"
7)
8
9var LogsPage PageID = "logs"
10
11type logsPage struct {
12 table logs.TableComponent
13 details logs.DetailComponent
14}
15
16func (p *logsPage) Init() tea.Cmd {
17 return nil
18}
19
20func (p *logsPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
21 return p, nil
22}
23
24func (p *logsPage) View() string {
25 return p.table.View() + "\n" + p.details.View()
26}
27
28func NewLogsPage() tea.Model {
29 return layout.NewBentoLayout(
30 layout.BentoPanes{
31 layout.BentoRightTopPane: logs.NewLogsTable(),
32 layout.BentoRightBottomPane: logs.NewLogsDetails(),
33 },
34 layout.WithBentoLayoutCurrentPane(layout.BentoRightTopPane),
35 layout.WithBentoLayoutRightTopHeightRatio(0.5),
36 )
37}