fix show project name as nav-home link in repo navigation

Replace the breadcrumb trail with a simple text link showing the project name (last path segment) as the nav-home anchor content. Links to the repo's summary page. Remove the now-unused repo_trail function.

Commit
30dae5f0c14b79734be2f7e6942ddf34536940d7
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
lib/views/components.ml
index 898a1a38..c442a620 100644..100644
@@ -81,26 +81,6 @@
81 81 Ui.link ~id:"nav-logo" ~href
82 82 [ Ui.image ~class_:"site-logo" ~alt ~src:(asset_url source) () ]
83 83
84 Removed: (** The trail of a nested repository path. Intermediate segments link to their
85 Removed: project directory; the final segment links to the repository itself. *)
86 Removed: let repo_trail repo =
87 Removed: let segments =
88 Removed: String.split_on_char '/' repo |> List.filter (fun segment -> segment <> "")
89 Removed: in
90 Removed: let last = List.length segments - 1 in
91 Removed: let crumb_of index segment =
92 Removed: let route =
93 Removed: if index = last then Routes.Repo repo
94 Removed: else
95 Removed: Routes.Project_dir
96 Removed: (String.concat "/" (List_ext.take (index + 1) segments))
97 Removed: in
98 Removed: Ui.crumb ~href:(url route) segment
99 Removed: in
100 Removed: Ui.breadcrumb ~id:"nav-home" ~class_:"repo-hierarchy"
101 Removed: ~separator_class:"nav-home-sep" ~separator_decorative:true ~separator:"/"
102 Removed: (List.mapi crumb_of segments)
103 Removed:
104 84 (** Top navigation away from any repository: the repository list and project
105 85 directory pages. When [home_href] is absent the page {i is} the list, so the
106 86 logo points outward instead of back to itself. *)
@@ -121,10 +101,15 @@
121 101 (** Top navigation within a repository. The link list collapses behind a
122 102 CSS-only control on narrow viewports. *)
123 103 let repo_nav ~active ~logo:source repo =
104 Added: let project_name =
105 Added: match String.split_on_char '/' repo |> List.rev with
106 Added: | last :: _ -> last
107 Added: | [] -> repo
108 Added: in
124 109 Ui.navigation ~id:"top" ~label:"Repository navigation"
125 110 [
126 111 logo ~href:"/" ~alt:"Repository list" source;
127 Removed: repo_trail repo;
112 Added: Ui.text_link ~id:"nav-home" ~href:(url (Routes.Repo repo)) project_name;
128 113 Ui.css_toggle ~id:"nav-toggle" ~toggle_class:"nav-toggle"
129 114 ~control_class:"nav-hamburger" ~label:"Menu" ~glyph:"\xe2\x8b\xae" ();
130 115 Ui.nav_links ~id:"nav-links"