init.go

 1package page
 2
 3import (
 4	tea "github.com/charmbracelet/bubbletea"
 5	"github.com/kujtimiihoxha/termai/internal/tui/layout"
 6)
 7
 8var InitPage PageID = "init"
 9
10type initPage struct {
11	layout layout.SinglePaneLayout
12}
13
14func (i initPage) Init() tea.Cmd {
15	return nil
16}
17
18func (i initPage) Update(_ tea.Msg) (tea.Model, tea.Cmd) {
19	return i, nil
20}
21
22func (i initPage) View() string {
23	return "Initializing..."
24}
25
26func NewInitPage() tea.Model {
27	return layout.NewSinglePane(
28		&initPage{},
29		layout.WithSinglePaneFocusable(true),
30		layout.WithSinglePaneBordered(true),
31		layout.WithSignlePaneBorderText(
32			map[layout.BorderPosition]string{
33				layout.TopMiddleBorder: "Welcome to termai",
34			},
35		),
36	)
37}