init.go 693 B

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