Skip to content

Commit 8b5d29e

Browse files
authored
[BE] Highlight the selected branch and commit (#6990)
Made with Claude code. This is a small feature to highlight the selected commit. This is useful the dropdown list is long. ### Testing The branch and commit are bold when they are selected on https://torchci-git-fork-huydhn-highlight-selected-83f4be-fbopensource.vercel.app/benchmark/llms?repoName=vllm-project%2Fvllm Signed-off-by: Huy Do <[email protected]>
1 parent 29f1bcc commit 8b5d29e

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

torchci/components/benchmark/BranchAndCommitPicker.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,17 @@ export function BranchAndCommitPicker({
179179
id={`branch-picker-select-${commit}`}
180180
>
181181
{displayBranches.map((b: string) => (
182-
<MenuItem key={`${b}-${commit}`} value={b}>
182+
<MenuItem
183+
key={`${b}-${commit}`}
184+
value={b}
185+
sx={{
186+
backgroundColor: b === branch ? "#e3f2fd" : "inherit",
187+
fontWeight: b === branch ? "bold" : "normal",
188+
"&:hover": {
189+
backgroundColor: b === branch ? "#bbdefb" : undefined,
190+
},
191+
}}
192+
>
183193
{b}
184194
</MenuItem>
185195
))}
@@ -209,6 +219,14 @@ export function BranchAndCommitPicker({
209219
value={r.head_sha}
210220
condition={isCommitHighlight(highlightConfig?.keys, r)}
211221
customColor={highlightConfig?.highlightColor}
222+
sx={{
223+
backgroundColor: r.head_sha === commit ? "#e8f5e8" : undefined,
224+
fontWeight: r.head_sha === commit ? "bold" : "normal",
225+
"&:hover": {
226+
backgroundColor:
227+
r.head_sha === commit ? "#c8e6c8" : undefined,
228+
},
229+
}}
212230
>
213231
{r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} (
214232
{dayjs(r.event_time).format("YYYY/MM/DD")})

torchci/components/benchmark/HighlightMenu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const HighlightMenuItem = ({
1111
condition,
1212
children,
1313
customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR,
14+
sx,
1415
...props
1516
}: HighlightMenuItemProps) => {
1617
const highlightStyle = {
@@ -22,6 +23,7 @@ export const HighlightMenuItem = ({
2223
<MenuItem
2324
{...props}
2425
sx={{
26+
...sx,
2527
...(condition && highlightStyle),
2628
}}
2729
>

0 commit comments

Comments
 (0)