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