Skip to content

Commit 934a33a

Browse files
committed
WIP showing card info
1 parent af46c67 commit 934a33a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

pkg/cmd/project/project.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ func projectRun(opts *ProjectOptions) error {
125125
selectedCard--
126126
}
127127
case 's':
128-
if selectedCard < cardsToShow-1 {
128+
if selectedCard < cardsToShow {
129129
selectedCard++
130130
}
131131
case 'a':
132132
if selectedColumn > 0 {
133133
selectedColumn--
134134
}
135135
case 'd':
136-
if selectedColumn < colsToShow-1 {
136+
if selectedColumn < colsToShow {
137137
selectedColumn++
138138
}
139139
}
@@ -150,6 +150,8 @@ func projectRun(opts *ProjectOptions) error {
150150
}
151151
}()
152152

153+
var cardInfo *Card
154+
153155
loop:
154156
for {
155157
select {
@@ -167,6 +169,9 @@ loop:
167169
colY := 1
168170
drawRect(s, style, colX, colY, colWidth, colHeight, false)
169171
drawStr(s, colX+1, colY+1, style, col.Name)
172+
if selectedColumn == ix && selectedCard >= len(col.Cards) {
173+
selectedCard = len(col.Cards) - 1
174+
}
170175
for ic, card := range col.Cards {
171176
if ic == cardsToShow {
172177
break
@@ -176,6 +181,7 @@ loop:
176181
if selectedColumn == ix && selectedCard == ic {
177182
cardStyle = style.Foreground(tcell.ColorGreen)
178183
bold = true
184+
cardInfo = card
179185
}
180186
drawRect(s, cardStyle, colX+1, (ic*cardHeight)+colY+2, cardWidth, cardHeight, bold)
181187
cardNote := card.Note
@@ -187,6 +193,15 @@ loop:
187193
drawStr(s, colX+2, (ic*cardHeight)+colY+3, style, cardNote)
188194
}
189195
}
196+
197+
// Info box
198+
infoX := colWidth * colsToShow
199+
infoY := 1
200+
infoWidth := colWidth * 2
201+
infoHeight := colHeight
202+
drawRect(s, style, infoX, infoY, infoWidth, infoHeight, true)
203+
drawStr(s, infoX+1, infoY+1, style, cardInfo.Note)
204+
190205
s.Show()
191206
}
192207

0 commit comments

Comments
 (0)