main 5041353

about.go RawHistoryFolder

1package styles
2
3import (
4	"fmt"
5	"strings"
6
7	"github.com/charmbracelet/lipgloss"
8
9	"github.com/bnema/dumber/internal/domain/build"
10)
11
12// AboutRenderer renders build info in fastfetch style.
13type AboutRenderer struct {
14	theme *Theme
15}
16
17// NewAboutRenderer creates a new about renderer with the given theme.
18func NewAboutRenderer(theme *Theme) *AboutRenderer {
19	return &AboutRenderer{theme: theme}
20}
21
22// Render renders build info with ASCII logo and styled info lines.
23func (r *AboutRenderer) Render(info build.Info) string {
24	logo := r.renderLogo()
25	lines := r.renderInfoLines(info)
26
27	// Combine horizontally: logo | info
28	return lipgloss.JoinHorizontal(lipgloss.Top, logo, "   ", lines)
29}
30
31func (r *AboutRenderer) renderLogo() string {
32	// ASCII art: Lightning bolt + D (matches pixel logo)
33	// All in accent color (green)
34	logoStyle := lipgloss.NewStyle().Foreground(r.theme.Accent).Bold(true)
35
36	// Simple bold D
37	logo := `██████▄
38██   ██
39██   ██
40██   ██
41██████▀`
42
43	return logoStyle.MarginTop(1).MarginLeft(2).Render(logo)
44}
45
46func (r *AboutRenderer) renderInfoLines(info build.Info) string {
47	keyStyle := r.theme.Subtle
48	valStyle := r.theme.Highlight
49	iconStyle := lipgloss.NewStyle().Foreground(r.theme.Accent)
50
51	lines := []string{
52		fmt.Sprintf("%s %s %s", iconStyle.Render(IconVersion), keyStyle.Render("Version"), valStyle.Render(info.Version)),
53		fmt.Sprintf("%s %s %s", iconStyle.Render(IconGitBranch), keyStyle.Render("Commit"), valStyle.Render(info.Commit)),
54		fmt.Sprintf("%s %s %s", iconStyle.Render(IconCalendar), keyStyle.Render("Built"), valStyle.Render(info.BuildDate)),
55		fmt.Sprintf("%s %s %s", iconStyle.Render(IconGo), keyStyle.Render("Go"), valStyle.Render(info.GoVersion)),
56		"",
57		fmt.Sprintf("%s %s", iconStyle.Render(IconGithub), keyStyle.Render(build.RepoURL())),
58		fmt.Sprintf(
59			"%s %s %s",
60			iconStyle.Render(IconHeart),
61			keyStyle.Render("Made with love by"),
62			valStyle.Render(strings.Join(build.Contributors(), ", ")),
63		),
64	}
65
66	return strings.Join(lines, "\n")
67}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close