main ba1e2c7

registry.go RawHistoryFolder

1package homepage
2
3import (
4	"context"
5	"fmt"
6
7	"github.com/bnema/dumber/internal/application/port"
8	"github.com/bnema/dumber/internal/logging"
9)
10
11// Config holds dependencies for homepage handlers.
12type Config struct {
13	HistoryUC   port.HomepageHistory
14	FavoritesUC port.HomepageFavorites
15}
16
17// RegisterHandlers registers all homepage message handlers with the router.
18func RegisterHandlers(ctx context.Context, router port.WebUIHandlerRouter, cfg Config) error {
19	log := logging.FromContext(ctx)
20	log.Debug().Msg("registering homepage message handlers")
21
22	handlers := Handlers(cfg)
23	for msgType, handler := range handlers {
24		if err := port.RegisterWebUIMessage(router, msgType, handler); err != nil {
25			return fmt.Errorf("failed to register handler %s: %w", msgType, err)
26		}
27		log.Debug().Str("type", msgType).Msg("registered homepage handler")
28	}
29
30	log.Info().Int("count", len(handlers)).Msg("homepage handlers registered")
31	return nil
32}
33
34// Handlers returns every homepage handler keyed by its WebUI message type.
35func Handlers(cfg Config) map[string]port.WebUIMessageHandler {
36	history := NewHistoryHandlers(cfg.HistoryUC)
37	favorites := NewFavoritesHandlers(cfg.FavoritesUC)
38	tags := NewTagHandlers(cfg.FavoritesUC)
39
40	return map[string]port.WebUIMessageHandler{
41		port.MsgHistoryTimeline:         history.HandleTimeline(),
42		port.MsgHistoryTimelineByDomain: history.HandleTimelineByDomain(),
43		port.MsgHistoryTimelineWindow:   history.HandleTimelineWindow(),
44		port.MsgHistorySearchFTS:        history.HandleSearchFTS(),
45		port.MsgHistoryDeleteEntry:      history.HandleDeleteEntry(),
46		port.MsgHistoryDeleteRange:      history.HandleDeleteRange(),
47		port.MsgHistoryClearAll:         history.HandleClearAll(),
48		port.MsgHistoryStats:            history.HandleStats(),
49		port.MsgHistoryAnalytics:        history.HandleAnalytics(),
50		port.MsgHistoryDomainStats:      history.HandleDomainStats(),
51		port.MsgHistoryDeleteDomain:     history.HandleDeleteDomain(),
52
53		port.MsgFavoriteList:          favorites.HandleList(),
54		port.MsgFavoriteCreate:        favorites.HandleCreate(),
55		port.MsgFavoriteUpdate:        favorites.HandleUpdate(),
56		port.MsgFavoriteDelete:        favorites.HandleDelete(),
57		port.MsgFavoriteSetShortcut:   favorites.HandleSetShortcut(),
58		port.MsgFavoriteGetByShortcut: favorites.HandleGetByShortcut(),
59
60		port.MsgTagList:   tags.HandleList(),
61		port.MsgTagCreate: tags.HandleCreate(),
62		port.MsgTagDelete: tags.HandleDelete(),
63		port.MsgTagUpdate: tags.HandleUpdate(),
64		port.MsgTagAssign: tags.HandleAssign(),
65		port.MsgTagRemove: tags.HandleRemove(),
66	}
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