[OCaml] Mobile-friendly clone of cgit.
1
(** Ogit's vocabulary of page parts.
2
3
Where {!Ui} supplies generic building blocks, this module names the parts
4
specific to a Git browser and wires them to {!Routes}, so page modules can
5
describe a page without mentioning HTML or URL strings.
6
7
Every function returns a {!Ui.node}. Nothing here performs I/O. *)
8
9
(** {1 Page identity} *)
10
11
type page =
12
| Summary
13
| Commits
14
| Files
15
(** Which repository page is being shown. Drives the [aria-current] marker
16
in the navigation. *)
17
18
type site = { user_name : string; root_title : string; nav_logo : string }
19
(** Site-wide presentation settings, resolved once from configuration. *)
20
21
val site : user_name:string -> root_title:string -> nav_logo:string -> site
22
(** Construct a {!site} record. *)
23
24
(** {1 Routes as links} *)
25
26
val url : Routes.t -> string
27
(** Generate the URL path for a route. *)
28
29
val route_link :
30
?class_:string -> ?label:string -> Routes.t -> string -> Ui.node
31
(** A link to a route, with the route standing in for a hand-written URL. *)
32
33
val commits_url :
34
?filter_type:string ->
35
?author:string ->
36
?committer:string ->
37
?page_number:int ->
38
string ->
39
string
40
(** Build the URL for a commit list page, preserving active filters as query
41
parameters. *)
42
43
val clone_url : string -> string
44
(** The URL from which a repository can be cloned. *)
45
46
(** {1 Navigation} *)
47
48
val site_nav :
49
title:string -> logo:string -> ?home_href:string -> unit -> Ui.node
50
(** Top navigation for the repository list and project directory pages. *)
51
52
val repo_nav : active:page -> logo:string -> string -> Ui.node
53
(** Top navigation within a repository. *)
54
55
val compact_repo_nav : active:page -> string -> Ui.node
56
(** Bottom navigation for narrow viewports within a repository. *)
57
58
(** {1 Toolbar} *)
59
60
val toolbar : Ui.node list -> Ui.node
61
(** A toolbar container for repository page controls. *)
62
63
(** {1 Trees} *)
64
65
val directory :
66
?modifier:string -> route:Routes.t -> name:string -> Ui.node list -> Ui.node
67
(** A directory row that both expands in place and links to its own page. *)
68
69
val file_entry : ?modifier:string -> route:Routes.t -> string -> Ui.node
70
(** A file row linking to the blob view. *)
71
72
val overflow_row : route:Routes.t -> int -> Ui.node
73
(** The row closing a truncated listing, linking to the full contents. *)
74
75
(** {1 Sections} *)
76
77
val group : ?expanded:bool -> title:string -> Ui.node list -> Ui.node
78
(** A collapsible group of repositories on the root page. *)
79
80
(** {1 Inline pieces} *)
81
82
val commit_type_badge : ?href:string -> string -> Ui.node
83
(** A conventional-commit type badge, coloured per type. *)
84
85
val inline_readme : ?filename:string -> string -> Ui.node
86
(** A README rendered as semantic documentation. *)
87