Skip to content

Commit 367ec66

Browse files
cleanup
1 parent e22623e commit 367ec66

File tree

2 files changed

+14
-59
lines changed

2 files changed

+14
-59
lines changed

styles.go

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ const (
3030

3131
var BaseStyle = lipgloss.NewStyle().
3232
BorderStyle(lipgloss.NormalBorder()).
33-
BorderForeground(lipgloss.Color("240")).Height(20)
33+
BorderForeground(lipgloss.Color("240")).Height(5)
3434

3535
var FocusStyle = lipgloss.NewStyle().
3636
BorderStyle(lipgloss.ThickBorder()).
37-
BorderForeground(lipgloss.Color("250")).Height(20)
37+
BorderForeground(lipgloss.Color("250")).Height(5)
3838

3939
var DocStyle = lipgloss.NewStyle().Margin(1, 2)
4040

@@ -51,65 +51,10 @@ var H2Style = lipgloss.NewStyle().
5151
Foreground(lipgloss.Color(cTextLightGray)).
5252
Background(lipgloss.Color(cTitle)).
5353
Padding(0, 1).Bold(true)
54-
55-
var DetailTitleStyle = lipgloss.NewStyle().
56-
Width(defaultDetailWidth).
57-
Foreground(lipgloss.Color(cTextLightGray)).
58-
Background(lipgloss.Color(cDetailTitle)).
59-
Padding(0, 1).
60-
Align(lipgloss.Center)
61-
var InputTitleStyle = lipgloss.NewStyle().
62-
Width(defaultInputWidth).
63-
Foreground(lipgloss.Color(cTextLightGray)).
64-
Background(lipgloss.Color(cDetailTitle)).
65-
Padding(0, 1).
66-
Align(lipgloss.Center)
67-
var SelectedTitle = lipgloss.NewStyle().
68-
Border(lipgloss.NormalBorder(), false, false, false, true).
69-
BorderForeground(lipgloss.AdaptiveColor{Light: cItemTitleLight, Dark: cItemTitleDark}).
70-
Foreground(lipgloss.AdaptiveColor{Light: cItemTitleLight, Dark: cItemTitleDark}).
71-
Padding(0, 0, 0, 1)
72-
var SelectedDesc = SelectedTitle.Copy().
73-
Foreground(lipgloss.AdaptiveColor{Light: cItemDescLight, Dark: cItemDescDark})
74-
var DimmedTitle = lipgloss.NewStyle().
75-
Foreground(lipgloss.AdaptiveColor{Light: cDimmedTitleLight, Dark: cDimmedTitleDark}).
76-
Padding(0, 0, 0, 2)
77-
var DimmedDesc = DimmedTitle.Copy().
78-
Foreground(lipgloss.AdaptiveColor{Light: cDimmedDescDark, Dark: cDimmedDescLight})
79-
var InputStyle = lipgloss.NewStyle().
80-
Margin(1, 1).
81-
Padding(1, 2).
82-
Border(lipgloss.RoundedBorder(), true, true, true, true).
83-
BorderForeground(lipgloss.Color(cPromptBorder)).
84-
Render
85-
var DetailStyle = lipgloss.NewStyle().
86-
Padding(1, 2).
87-
Border(lipgloss.ThickBorder(), false, false, false, true).
88-
BorderForeground(lipgloss.AdaptiveColor{Light: cItemTitleLight, Dark: cItemTitleDark}).
89-
Render
90-
var ErrStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(cError)).Render
91-
var NoStyle = lipgloss.NewStyle()
92-
var FocusedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(cPromptBorder))
93-
var BlurredStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
9454
var BrightTextStyle = lipgloss.NewStyle().
9555
Foreground(lipgloss.AdaptiveColor{Light: cDimmedTitleLight, Dark: cDimmedTitleDark}).Render
9656
var NormalTextStyle = lipgloss.NewStyle().
9757
Foreground(lipgloss.AdaptiveColor{Light: cDimmedDescLight, Dark: cDimmedDescDark})
98-
var SpecialTextStyle = lipgloss.NewStyle().
99-
Width(defaultDetailWidth).
100-
Margin(0, 0, 1, 0).
101-
Foreground(lipgloss.AdaptiveColor{Light: cItemTitleLight, Dark: cItemTitleDark}).
102-
Align(lipgloss.Center).Render
103-
var DetailsBlockLeft = lipgloss.NewStyle().
104-
Width(defaultDetailWidth / 2).
105-
Foreground(lipgloss.AdaptiveColor{Light: cDimmedTitleLight, Dark: cDimmedTitleDark}).
106-
Align(lipgloss.Right).
107-
Render
108-
var DetailsBlockRight = lipgloss.NewStyle().
109-
Width(defaultDetailWidth / 2).
110-
Foreground(lipgloss.AdaptiveColor{Light: cDimmedDescLight, Dark: cDimmedDescDark}).
111-
Align(lipgloss.Left).
112-
Render
11358
var HelpStyle = list.DefaultStyles().HelpStyle.Width(defaultListWidth).Height(5)
11459

11560
func init() {

view.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
2828
}
2929
case tea.WindowSizeMsg:
3030
verticalMarginHeight := 2
31+
leftSideWidth := m.workerTable.Width()
32+
BaseStyle.Height(msg.Height - verticalMarginHeight)
33+
FocusStyle.Height(msg.Height - verticalMarginHeight)
34+
3135
if !m.ready {
3236
// Since this program is using the full size of the viewport we
3337
// need to wait until we've received the window dimensions before
@@ -40,8 +44,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
4044
m.viewport.SetContent(RenderWorkerDetails(m))
4145
m.ready = true
4246
} else {
43-
m.viewport.Width = msg.Width
47+
m.viewport.Width = msg.Width - leftSideWidth
48+
m.jobsTable.SetWidth(msg.Width)
4449
m.viewport.Height = msg.Height - verticalMarginHeight
50+
m.jobsTable.SetHeight(msg.Height - verticalMarginHeight * 2)
4551
}
4652
case tea.KeyMsg:
4753
selectedWorkerName, _ := m.GetSelectedRowName()
@@ -102,6 +108,9 @@ func (m model) View() string {
102108
rightStyle = FocusStyle
103109
}
104110

111+
var leftSide string
112+
leftSide = leftStyle.Render(m.workerTable.View())
113+
105114
var rightSide string
106115
if m.showDetails {
107116
rightSide = rightStyle.Render(m.viewport.View())
@@ -111,7 +120,8 @@ func (m model) View() string {
111120

112121
return lipgloss.JoinHorizontal(
113122
lipgloss.Left,
114-
leftStyle.Render(m.workerTable.View()),
123+
leftSide,
115124
rightSide,
116125
)
126+
117127
}

0 commit comments

Comments
 (0)