wip: multiple profiles (drop colours also)
This commit is contained in:
parent
d926f3888a
commit
115aad7b37
@ -13,8 +13,7 @@ const (
|
||||
)
|
||||
|
||||
var mainStyle = lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("#F7B3DA"))
|
||||
BorderStyle(lipgloss.NormalBorder())
|
||||
|
||||
type mainModel struct {
|
||||
username string
|
||||
@ -39,7 +38,7 @@ func NewMainModel(username, homeDir string) mainModel {
|
||||
|
||||
// TODO(d1): programmatically fill in profile names
|
||||
profileBarModel := newProfileBarModel([]string{
|
||||
"status",
|
||||
"status", "profile1", "profile2", "profile3",
|
||||
})
|
||||
|
||||
statusPaneModel := newStatusPaneModel()
|
||||
|
@ -7,9 +7,10 @@ import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
var profileBarStyle = lipgloss.NewStyle().
|
||||
var profileNameButtonStyle = lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).
|
||||
MarginLeft(1)
|
||||
Padding(0, 1).
|
||||
Bold(true)
|
||||
|
||||
type profileBarModel struct {
|
||||
state int
|
||||
@ -33,8 +34,8 @@ func (m profileBarModel) Init() tea.Cmd {
|
||||
}
|
||||
|
||||
func (m profileBarModel) Update(msg tea.Msg) (profileBarModel, tea.Cmd) {
|
||||
// TODO(d1): bubblezone handle clicks, fire msgs to mainModel to switch
|
||||
switch msg := msg.(type) {
|
||||
//TODO(d1): bubblezone handle clicks, fire msgs to mainModel to switch
|
||||
case tea.WindowSizeMsg:
|
||||
m.width = msg.Width
|
||||
}
|
||||
@ -43,7 +44,26 @@ func (m profileBarModel) Update(msg tea.Msg) (profileBarModel, tea.Cmd) {
|
||||
|
||||
func (m profileBarModel) View() string {
|
||||
body := strings.Builder{}
|
||||
//TODO(d1): render profile names, nice colours etc.
|
||||
body.WriteString(profileBarStyle.Render("...profileBar..."))
|
||||
|
||||
var profileNames []string
|
||||
for idx, profileName := range m.profileNames {
|
||||
rendered := profileNameButtonStyle.Render(profileName)
|
||||
|
||||
if idx > 0 {
|
||||
rendered = profileNameButtonStyle.
|
||||
MarginLeft(1).
|
||||
Render(profileName)
|
||||
}
|
||||
|
||||
profileNames = append(profileNames, rendered)
|
||||
}
|
||||
|
||||
body.WriteString(
|
||||
lipgloss.JoinHorizontal(
|
||||
lipgloss.Left,
|
||||
profileNames...,
|
||||
),
|
||||
)
|
||||
|
||||
return body.String()
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
|
||||
var viewportStyle = lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("#BBFFFF")).
|
||||
MarginLeft(1)
|
||||
|
||||
type statusPaneModel struct {
|
||||
|
@ -13,7 +13,6 @@ var titleStyle = lipgloss.NewStyle().
|
||||
Bold(true)
|
||||
|
||||
var backgroundStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#EE00EE")).
|
||||
Align(lipgloss.Center)
|
||||
|
||||
type titleModel struct {
|
||||
|
Reference in New Issue
Block a user