Skip to content

Commit

Permalink
Make fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Harris <[email protected]>
  • Loading branch information
eharris128 committed Sep 5, 2024
1 parent 8be2dcb commit e19359c
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 266 deletions.
22 changes: 11 additions & 11 deletions pkg/app/master/tui/common/const.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package common

import (
tea "github.com/charmbracelet/bubbletea"
)

var (
// P the current tea program
P *tea.Program
Models []tea.Model
)
package common

import (
tea "github.com/charmbracelet/bubbletea"
)

var (
// P the current tea program
P *tea.Program
Models []tea.Model
)
22 changes: 11 additions & 11 deletions pkg/app/master/tui/common/styles.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package common

import "github.com/charmbracelet/lipgloss"

var (
Bold = Regular.Bold(true)
Border = Regular.Border(lipgloss.NormalBorder())
Regular = lipgloss.NewStyle()
Padded = Regular.Padding(0, 1)
HelpStyle = Regular.Padding(0, 1).Background(lipgloss.Color("#ffffff")).Foreground(lipgloss.Color("#000000")).Render
)
package common

import "github.com/charmbracelet/lipgloss"

var (
Bold = Regular.Bold(true)
Border = Regular.Border(lipgloss.NormalBorder())
Regular = lipgloss.NewStyle()
Padded = Regular.Padding(0, 1)
HelpStyle = Regular.Padding(0, 1).Background(lipgloss.Color("#ffffff")).Foreground(lipgloss.Color("#000000")).Render
)
144 changes: 72 additions & 72 deletions pkg/app/master/tui/home/model.go
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
package home

import (
"log"

"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/mintoolkit/mint/pkg/app/master/tui/common"
"github.com/mintoolkit/mint/pkg/app/master/tui/keys"
)

type mode int

const (
nav mode = iota
image
debug
)

// Default Model
type Model struct {
mode mode
}

func InitialModel() (tea.Model, tea.Cmd) {
m := &Model{mode: nav}
log.Printf("Welcome model initialized: %v", m)
return m, nil
}

func (m Model) Init() tea.Cmd {
// Just return `nil`, which means "no I/O right now, please."
return nil
}

// Update is called to handle user input and update the model's state.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch {
case key.Matches(msg, keys.Global.Quit):
return m, tea.Quit // Quit the program.
case key.Matches(msg, keys.Welcome.Images):
m.mode = image
// TODO - Unhardcode the model index
return common.Models[1].Update(nil)

// TODO - support debug model
// case key.Matches(msg, keys.Welcome.Debug):
// m.mode = debug
// // TODO - Unhardcode the model index
// return common.Models[2].Update(nil)
}
}
return m, nil
}

// View returns the view that should be displayed.
func (m Model) View() string {
content := "Dashboard\n Select which view you would like to open\n"

return lipgloss.JoinVertical(lipgloss.Left,
content,
m.help(),
)
}
func (m Model) help() string {
return common.HelpStyle("• i: Open images view • q: quit")
// TODO - support debug view
// return common.HelpStyle("• i: Open images view • d: Open debug view • q: quit")
}
package home

import (
"log"

"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/mintoolkit/mint/pkg/app/master/tui/common"
"github.com/mintoolkit/mint/pkg/app/master/tui/keys"
)

type mode int

const (
nav mode = iota
image
debug
)

// Default Model
type Model struct {
mode mode
}

func InitialModel() (tea.Model, tea.Cmd) {
m := &Model{mode: nav}
log.Printf("Welcome model initialized: %v", m)
return m, nil
}

func (m Model) Init() tea.Cmd {
// Just return `nil`, which means "no I/O right now, please."
return nil
}

// Update is called to handle user input and update the model's state.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch {
case key.Matches(msg, keys.Global.Quit):
return m, tea.Quit // Quit the program.
case key.Matches(msg, keys.Welcome.Images):
m.mode = image
// TODO - Unhardcode the model index
return common.Models[1].Update(nil)

// TODO - support debug model
// case key.Matches(msg, keys.Welcome.Debug):
// m.mode = debug
// // TODO - Unhardcode the model index
// return common.Models[2].Update(nil)
}
}
return m, nil
}

// View returns the view that should be displayed.
func (m Model) View() string {
content := "Dashboard\n Select which view you would like to open\n"

return lipgloss.JoinVertical(lipgloss.Left,
content,
m.help(),
)
}
func (m Model) help() string {
return common.HelpStyle("• i: Open images view • q: quit")
// TODO - support debug view
// return common.HelpStyle("• i: Open images view • d: Open debug view • q: quit")
}
Loading

0 comments on commit e19359c

Please sign in to comment.