mirror of
https://github.com/taigrr/gico.git
synced 2026-04-01 18:58:59 -07:00
initialize authors and repos
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/bubbles/list"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
|
||||
"github.com/taigrr/gico/commits"
|
||||
)
|
||||
@@ -90,7 +89,8 @@ func (m Settings) Init() tea.Cmd {
|
||||
}
|
||||
|
||||
func (m Settings) View() string {
|
||||
return fmt.Sprintf("This is the settings view %s", "fmt")
|
||||
return lipgloss.JoinHorizontal(lipgloss.Top, m.AuthorList.View(), m.RepoList.View())
|
||||
// return fmt.Sprintf("This is the settings view %s", "fmt")
|
||||
}
|
||||
|
||||
func NewSettings() (Settings, error) {
|
||||
@@ -133,5 +133,16 @@ func NewSettings() (Settings, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
repoItems := []list.Item{}
|
||||
for _, v := range m.AllRepos {
|
||||
repoItems = append(repoItems, v)
|
||||
}
|
||||
m.RepoList = list.New(repoItems, newItemDelegate(newDelegateKeyMap()), 0, 4)
|
||||
|
||||
authItems := []list.Item{}
|
||||
for _, v := range m.AllAuthors {
|
||||
authItems = append(authItems, v)
|
||||
}
|
||||
m.AuthorList = list.New(authItems, newItemDelegate(newDelegateKeyMap()), 0, 4)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
9
ui/ui.go
9
ui/ui.go
@@ -131,9 +131,12 @@ func (m model) View() string {
|
||||
if m.quitting {
|
||||
return ""
|
||||
}
|
||||
mainView := lipgloss.JoinVertical(lipgloss.Top, m.GraphModel.View(), m.CommitLogModel.View(), m.HelpModel.ShortHelpView(m.Bindings))
|
||||
if m.cursor == settings {
|
||||
return lipgloss.JoinHorizontal(lipgloss.Left, m.SettingsModel.View(), mainView)
|
||||
return m.SettingsModel.View()
|
||||
}
|
||||
return mainView
|
||||
return lipgloss.JoinVertical(lipgloss.Top,
|
||||
m.GraphModel.View(),
|
||||
m.CommitLogModel.View(),
|
||||
m.HelpModel.ShortHelpView(m.Bindings),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user