wip: profile / channel bar mvp

This commit is contained in:
decentral1se 2023-07-22 20:22:19 +02:00
parent f6260c85e7
commit 69263f0aea
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 27 additions and 22 deletions

View File

@ -96,25 +96,13 @@ var (
mainStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder())
viewportStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderLeft(false).
BorderRight(false).
BorderTop(false).
BorderBottom(true)
viewportStyle = lipgloss.NewStyle()
profileNameButtonStyle = lipgloss.NewStyle().
Height(1).
Bold(true).
Underline(true)
profileNameButtonStyle = lipgloss.NewStyle()
inputStyle = lipgloss.NewStyle().
Height(1).
BorderStyle(lipgloss.NormalBorder()).
BorderLeft(false).
BorderRight(false).
BorderTop(true).
BorderBottom(false)
channelBarStyle = lipgloss.NewStyle()
inputStyle = lipgloss.NewStyle()
)
type profile struct {
@ -380,7 +368,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.height = msg.Height - 2
m.viewport = viewport.New(
m.width,
m.height-4,
m.height-3,
)
case tea.KeyMsg:
@ -502,7 +490,15 @@ func (m model) View() string {
// TODO: adjust when more panes are available
m.viewport.SetContent(strings.Join(*m.statusMsgs, "\n"))
statusButton := profileNameButtonStyle.Render("status")
channelBar := channelBarStyle.
Width(m.width).
AlignVertical(lipgloss.Center).
Render(lipgloss.NewStyle().Background(lipgloss.Color("14")).Foreground(lipgloss.Color("#fffff")).Render("N/A"))
statusButton := profileNameButtonStyle.
Width(m.width).
AlignVertical(lipgloss.Center).
Render(lipgloss.NewStyle().Background(lipgloss.Color("26")).Foreground(lipgloss.Color("#fffff")).Render("status"))
var profileNames []string
for _, profile := range m.profiles {
@ -525,14 +521,23 @@ func (m model) View() string {
Width(m.width).
Render(m.viewport.View()),
lipgloss.JoinHorizontal(
lipgloss.Left,
channelBar,
),
lipgloss.JoinHorizontal(
lipgloss.Left,
buttonBar...,
),
inputStyle.
Width(m.width).
Render(m.input.View()),
lipgloss.PlaceVertical(
1,
lipgloss.Bottom,
inputStyle.
Width(m.width).
Render(m.input.View()),
),
),
),
)