MCPcopy Create free account
hub / github.com/LunaSource/Luna / View

Method View

ui/models.go:204–260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202
203 now := time.Now().Format("15:04:05")
204 header := style.TitleStyle.Render(style.IconMoon + " Luna Commits " + style.IconAngleRight + " " + now)
205
206 switch m.state {
207
208 case stateLoading:
209 b.WriteString(header + "\n")
210 b.WriteString(style.BoxStyle.Render(m.spinner.View() + " Loading available files..."))
211
212 case stateSelecting:
213 var list strings.Builder
214 for i, f := range m.available {
215 cursor := " "
216 if i == m.cursor {
217 cursor = style.Accent(style.IconAngleRight + " ")
218 }
219
220 box := style.Muted(style.IconSquare)
221 if m.selected[f.Path] {
222 box = style.SuccessStyle.Render(style.IconCheckSquare)
223 }
224
225 badge := strings.TrimSpace(f.Status)
226 if badge == "" {
227 badge = "??"
228 }
229
230 list.WriteString(fmt.Sprintf("%s%s %s %s\n", cursor, box, style.Muted(badge), f.Path))
231 }
232
233 selectedCount := 0
234 for _, v := range m.selected {
235 if v {
236 selectedCount++
237 }
238 }
239
240 help := style.Muted(fmt.Sprintf(
241 "%s%s move space select a all enter stage & commit (%d selected) q quit",
242 style.IconArrowUp, style.IconArrowDown, selectedCount,
243 ))
244
245 body := fmt.Sprintf(
246 "%s\n%s\n\n%s",
247 style.Muted("Select files to stage and commit"),
248 list.String(),
249 help,
250 )
251
252 b.WriteString(header + "\n")
253 b.WriteString(style.BoxStyle.Render(body))
254
255 case stateStaging:
256 b.WriteString(header + "\n")
257 b.WriteString(style.BoxStyle.Render(m.spinner.View() + " Staging selected files..."))
258
259 case stateProcessing:
260 progressVal := float64(m.currentFile) / float64(len(m.files))
261 box := fmt.Sprintf(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected