diff options
| author | Marius Peter <marius.peter@tutanota.com> | 2025-06-29 18:44:58 +0200 | 
|---|---|---|
| committer | Marius Peter <marius.peter@tutanota.com> | 2025-06-29 18:44:58 +0200 | 
| commit | d875d02eeb8bdfe8038445fff4b3212b57485c9a (patch) | |
| tree | 79e86f675a288cc60ab9732a3a46ef8eeb8ef5c7 /lib | |
| parent | 7277ab93adcad0cd7ecc9a230dff82d1b82d1bcc (diff) | |
Replace commit short hash with timestamp.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/static/styles.css | 2 | ||||
| -rw-r--r-- | lib/views.ml | 14 | 
2 files changed, 11 insertions, 5 deletions
| diff --git a/lib/static/styles.css b/lib/static/styles.css index 4035a3d..8bf104f 100644 --- a/lib/static/styles.css +++ b/lib/static/styles.css @@ -77,7 +77,7 @@ h1 {      padding: 0.5em 0;  } -.commit-hash { +.timestamp {      font-family: monospace;  } diff --git a/lib/views.ml b/lib/views.ml index 576fa14..392075f 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -99,9 +99,15 @@ module Repo = struct      HTML.(li [] [ Routes.link_to (Refs repo) (txt "%s" branch.name) ])    let li_of_commit repo (commit : Resolvers.Commit.t) = -    let short_hash = Resolvers.short_hash commit.hash in -    let hash_span = -      HTML.(span [ class_ "commit-hash" ] [ txt "%s" short_hash ]) +    let timestamp (date, _) = +      let tm = date |> Int64.to_float |> Unix.localtime in +      Printf.sprintf "%04d-%02d-%02d %02d:%02d" (tm.tm_year + 1900) +        (tm.tm_mon + 1) tm.tm_mday tm.tm_hour tm.tm_min +    in +    let timestamp_span = +      (* HTML.(span [ class_ "commit-hash" ] [ txt "%s" commit.datetime ]) *) +      HTML.( +        span [ class_ "timestamp" ] [ txt "%s" (timestamp commit.author.date) ])      in      let description =        match commit.message with @@ -109,7 +115,7 @@ module Repo = struct        | Some msg -> txt " %s" msg      in      let route = Routes.Commit (repo, commit.hash) in -    let node = HTML.null [ hash_span; description ] in +    let node = HTML.null [ timestamp_span; description ] in      HTML.li [] [ Routes.link_to route node ]    let li_of_entry repo (entry : Resolvers.Entry.t) = | 
