mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
add stubs for bbtui
This commit is contained in:
57
graph/graph.go
Normal file
57
graph/graph.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package graph
|
||||
|
||||
import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/taigrr/gico/graph/help"
|
||||
)
|
||||
|
||||
type Graph struct {
|
||||
Help help.Help
|
||||
df lipgloss.DoeFoot
|
||||
}
|
||||
|
||||
func (g Graph) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
var cmd tea.Cmd
|
||||
switch msg := msg.(type) {
|
||||
case tea.WindowSizeMsg:
|
||||
h, _ := g.Help.Update(msg)
|
||||
t, _ := h.(help.Help)
|
||||
g.Help = t
|
||||
case tea.KeyMsg:
|
||||
switch msg.String() {
|
||||
case "ctrl+c", "q":
|
||||
return g, tea.Quit
|
||||
case "right", "l":
|
||||
case "up", "k":
|
||||
case "down", "j":
|
||||
case "left", "h":
|
||||
case "G":
|
||||
default:
|
||||
h, _ := g.Help.Update(msg)
|
||||
t, _ := h.(help.Help)
|
||||
g.Help = t
|
||||
}
|
||||
}
|
||||
return g, cmd
|
||||
}
|
||||
|
||||
func (g Graph) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g Graph) View() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func New() Graph {
|
||||
var g Graph
|
||||
g.Help = help.New()
|
||||
return g
|
||||
}
|
||||
|
||||
func (g Graph) UpdateDoeFoot(df lipgloss.DoeFoot) Graph {
|
||||
g.df = df
|
||||
g.Help = g.Help.UpdateDoeFoot(df)
|
||||
return g
|
||||
}
|
||||
30
graph/help/help.go
Normal file
30
graph/help/help.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package help
|
||||
|
||||
import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
type Help struct {
|
||||
df lipgloss.DoeFoot
|
||||
}
|
||||
|
||||
func (h Help) Update(m tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return h, nil
|
||||
}
|
||||
func (h Help) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h Help) View() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func New() Help {
|
||||
return Help{}
|
||||
}
|
||||
|
||||
func (h Help) UpdateDoeFoot(df lipgloss.DoeFoot) Help {
|
||||
h.df = df
|
||||
return h
|
||||
}
|
||||
Reference in New Issue
Block a user