From 494800ef214b589bb8bd8ff88ec1e2f4b7e49cbf Mon Sep 17 00:00:00 2001 From: Daryl Lim <5508348+daryllimyt@users.noreply.github.com> Date: Fri, 19 Jun 2026 11:18:02 -0400 Subject: [PATCH] feat(ui): redesign commit selector dropdown --- .../components/registry/commit-selector.tsx | 110 ++++++++++++------ 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/registry/commit-selector.tsx b/frontend/src/components/registry/commit-selector.tsx index beb813d346..b101c5e930 100644 --- a/frontend/src/components/registry/commit-selector.tsx +++ b/frontend/src/components/registry/commit-selector.tsx @@ -1,8 +1,9 @@ "use client" -import { ChevronDownIcon, TagIcon } from "lucide-react" +import { Bot, ChevronDownIcon, TagIcon } from "lucide-react" import { useState } from "react" import type { GitCommitInfo } from "@/client" +import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { @@ -26,6 +27,27 @@ interface CommitSelectorProps { disabled?: boolean } +/** Returns true when a commit author is a service/bot account, e.g. "name[bot]". */ +function isBotAuthor(author: string): boolean { + return author.toLowerCase().includes("[bot]") +} + +/** Derives up to two uppercase initials from a commit author name. */ +function getAuthorInitials(author: string): string { + const cleaned = author + .replace(/\[bot\]/gi, "") + .replace(/[-_]+/g, " ") + .trim() + const parts = cleaned.split(/\s+/).filter(Boolean) + if (parts.length === 0) { + return "?" + } + if (parts.length === 1) { + return parts[0].slice(0, 2).toUpperCase() + } + return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase() +} + export function CommitSelector({ commits, currentCommitSha, @@ -100,10 +122,11 @@ export function CommitSelector({ Select commit -
+
{commits?.map((commit, index) => { const isSelected = commit.sha === effectiveCurrentSha const isHead = index === 0 + const isBot = isBotAuthor(commit.author) const commitDate = new Date(commit.date) const relativeTime = getRelativeTime(commitDate) @@ -115,43 +138,64 @@ export function CommitSelector({ setIsOpen(false) }} className={cn( - "flex flex-col items-start space-y-1 p-3", - isSelected && "bg-accent" + "relative flex cursor-pointer items-start gap-2.5 p-2.5", + isSelected && "bg-primary/5" )} > -
-
-
- - {commit.sha.substring(0, 7)} - - {isHead && ( - - HEAD - - )} - {isSelected && !isHead && ( - - Current - - )} - {isSelected && isHead && ( - - Current • HEAD - - )} -
- + {isSelected && ( + + )} + + + {isBot ? ( + + ) : ( + getAuthorInitials(commit.author) + )} + + +
+
+ + {commit.sha.substring(0, 7)} + + {isSelected && ( + + Current + + )} + {isHead && ( + + HEAD + + )} + {relativeTime}
+

+ {commit.message} +

+

+ {commit.author || "Unknown"} •{" "} + {commitDate.toLocaleDateString()} +

{commit.tags && commit.tags.length > 0 && ( -
+
{commit.tags.map((tag) => ( {tag} @@ -160,14 +204,6 @@ export function CommitSelector({
)}
-
-

- {commit.message} -

-

- by {commit.author} • {commitDate.toLocaleDateString()} -

-
) })}