1+ import { Button } from "@/components/ui/button" ;
2+ import { Tooltip , TooltipContent , TooltipTrigger } from "@/components/ui/tooltip" ;
13import { getCommit , getDiff } from "@/features/git" ;
24import { isServiceError } from "@/lib/utils" ;
35import { format } from "date-fns" ;
6+ import { FileCode } from "lucide-react" ;
7+ import Link from "next/link" ;
48import { formatAuthorsText , getCommitAuthors } from "../../../components/commitAuthors" ;
59import { AuthorsAvatarGroup } from "../../../components/commitParts" ;
10+ import { getBrowsePath } from "../../../hooks/utils" ;
11+ import { CommitHashLine } from "./commitHashLine" ;
12+ import { CommitMessage } from "./commitMessage" ;
613import { computeTotalChangeCounts , DiffStat } from "./diffStat" ;
714import { FileDiffList } from "./fileDiffList" ;
815
@@ -50,7 +57,6 @@ export const CommitDiffPanel = async ({ repoName, commitSha, path }: CommitDiffP
5057 ) ;
5158 }
5259
53- const isMergeCommit = commitResponse . parents . length > 1 ;
5460 const baseSha = commitResponse . parents . length > 0 ? commitResponse . parents [ 0 ] : null ;
5561 const subject = commitResponse . message . split ( '\n' ) [ 0 ] ;
5662 const formattedDate = format ( new Date ( commitResponse . date ) , 'MMM d, yyyy' ) ;
@@ -59,8 +65,30 @@ export const CommitDiffPanel = async ({ repoName, commitSha, path }: CommitDiffP
5965
6066 return (
6167 < div className = "flex flex-col h-full" >
62- < div className = "flex flex-col gap-2 p-4 border-b shrink-0" >
63- < h1 className = "text-lg font-semibold" > { subject } </ h1 >
68+ < div className = "flex flex-col gap-2 p-3 border-b shrink-0" >
69+ < div className = "flex flex-row items-start gap-2" >
70+ < div className = "flex-1 min-w-0" >
71+ < CommitMessage subject = { subject } body = { commitResponse . body } />
72+ </ div >
73+ < Tooltip >
74+ < TooltipTrigger asChild >
75+ < Button asChild variant = "outline" size = "sm" className = "flex-shrink-0" >
76+ < Link
77+ href = { getBrowsePath ( {
78+ repoName,
79+ revisionName : commitResponse . hash ,
80+ path : '' ,
81+ pathType : 'tree' ,
82+ } ) }
83+ >
84+ < FileCode className = "h-4 w-4 mr-1" />
85+ Browse files
86+ </ Link >
87+ </ Button >
88+ </ TooltipTrigger >
89+ < TooltipContent > View code at this commit</ TooltipContent >
90+ </ Tooltip >
91+ </ div >
6492 < div className = "flex flex-row items-center gap-2 text-sm text-muted-foreground" >
6593 < AuthorsAvatarGroup authors = { authors } />
6694 < span
@@ -71,17 +99,11 @@ export const CommitDiffPanel = async ({ repoName, commitSha, path }: CommitDiffP
7199 </ span >
72100 < span > committed on { formattedDate } </ span >
73101 </ div >
74- < div className = "text-xs font-mono text-muted-foreground" >
75- { commitResponse . hash . substring ( 0 , 12 ) }
76- { baseSha && (
77- < > · parent { baseSha . substring ( 0 , 12 ) } </ >
78- ) }
79- </ div >
80- { isMergeCommit && (
81- < div className = "text-xs text-muted-foreground italic" >
82- Merge commit — diff shown against first parent
83- </ div >
84- ) }
102+ < CommitHashLine
103+ repoName = { repoName }
104+ commitHash = { commitResponse . hash }
105+ parents = { commitResponse . parents }
106+ />
85107 </ div >
86108 < div className = "flex flex-row items-center justify-between gap-2 px-4 py-2 border-b shrink-0" >
87109 < h2 className = "text-sm font-medium" >
0 commit comments