v0.28.0 3cb3770

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/infrastructure/webkit"
9	"github.com/bnema/dumber/internal/logging"
10)
11
12// Config holds dependencies for homepage handlers.
13type Config struct {
14	HistoryUC   port.HomepageHistory
15	FavoritesUC port.HomepageFavorites
16}
17
18// RegisterHandlers registers all homepage message handlers with the router.
19func RegisterHandlers(ctx context.Context, router *webkit.MessageRouter, cfg Config) error {
20	log := logging.FromContext(ctx)
21	log.Debug().Msg("registering homepage message handlers")
22
23	// Common callback for all homepage handlers
24	const callback = "__dumber_homepage_response"
25	const errorCallback = "__dumber_error"
26	const worldName = "" // main world
27
28	handlers := make(map[string]webkit.MessageHandler)
29
30	// History handlers
31	historyHandlers := NewHistoryHandlers(cfg.HistoryUC)
32	handlers["history_timeline"] = historyHandlers.HandleTimeline()
33	handlers["history_search_fts"] = historyHandlers.HandleSearchFTS()
34	handlers["history_delete_entry"] = historyHandlers.HandleDeleteEntry()
35	handlers["history_delete_range"] = historyHandlers.HandleDeleteRange()
36	handlers["history_clear_all"] = historyHandlers.HandleClearAll()
37	handlers["history_analytics"] = historyHandlers.HandleAnalytics()
38	handlers["history_domain_stats"] = historyHandlers.HandleDomainStats()
39	handlers["history_delete_domain"] = historyHandlers.HandleDeleteDomain()
40
41	// Favorites handlers
42	favoritesHandlers := NewFavoritesHandlers(cfg.FavoritesUC)
43	handlers["favorite_list"] = favoritesHandlers.HandleList()
44	handlers["favorite_set_shortcut"] = favoritesHandlers.HandleSetShortcut()
45	handlers["favorite_get_by_shortcut"] = favoritesHandlers.HandleGetByShortcut()
46	handlers["favorite_set_folder"] = favoritesHandlers.HandleSetFolder()
47
48	// Folder handlers
49	folderHandlers := NewFolderHandlers(cfg.FavoritesUC)
50	handlers["folder_list"] = folderHandlers.HandleList()
51	handlers["folder_create"] = folderHandlers.HandleCreate()
52	handlers["folder_delete"] = folderHandlers.HandleDelete()
53	handlers["folder_update"] = folderHandlers.HandleUpdate() // Requires UpdateFolder()
54
55	// Tag handlers
56	tagHandlers := NewTagHandlers(cfg.FavoritesUC)
57	handlers["tag_list"] = tagHandlers.HandleList()
58	handlers["tag_create"] = tagHandlers.HandleCreate()
59	handlers["tag_delete"] = tagHandlers.HandleDelete()
60	handlers["tag_update"] = tagHandlers.HandleUpdate() // Requires UpdateTag()
61	handlers["tag_assign"] = tagHandlers.HandleAssign()
62	handlers["tag_remove"] = tagHandlers.HandleRemove()
63
64	// Register all handlers
65	for msgType, handler := range handlers {
66		if err := router.RegisterHandlerWithCallbacks(msgType, callback, errorCallback, worldName, handler); err != nil {
67			return fmt.Errorf("failed to register handler %s: %w", msgType, err)
68		}
69		log.Debug().Str("type", msgType).Msg("registered homepage handler")
70	}
71
72	log.Info().Int("count", len(handlers)).Msg("homepage handlers registered")
73	return nil
74}

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