commit cb8b88085f33ae4b68ad1316488c995a0f157619
Author: tri <tri@thac.loan>
Date:   Sun Sep 28 12:42:07 2025 +0700

    show most recently updated repos first

diff --git a/src/main.zig b/src/main.zig
index 00c953b..6f1d53a 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -69,6 +69,8 @@ pub fn main() !u8 {
         // TODO: write repo's commits
     }
 
+    std.mem.sort(RepoSummary, repo_summaries.items, {}, RepoSummary.lessThan);
+
     try writeHomePage(target_dir, repo_summaries.items);
 
     inline for (.{ "style.css", "script.js" }) |asset_name| {
@@ -86,6 +88,13 @@ const RepoSummary = struct {
     commit_count: usize,
     last_commit_time: []const u8,
     last_commit_msg: []const u8,
+
+    // Sort by newest first using last_commit_time strings.
+    // Not accurate because it just compares ISO datetime strings, which may be
+    // in different timezones, in which case the sorting will be incorrect.
+    pub fn lessThan(_: void, lhs: RepoSummary, rhs: RepoSummary) bool {
+        return !std.mem.lessThan(u8, lhs.last_commit_time, rhs.last_commit_time);
+    }
 };
 
 // TODO: decide on some sort of templating system