import { Calendar, GitCommitHorizontal, Hash, UserRound } from "lucide-react"; import type { Repository } from "@/features/projects/hooks"; import { commitDiscussionQuery } from "@/features/projects/lib/discussionChannels"; import { commitShareLink } from "@/features/projects/lib/projectShareLinks"; import type { ProjectRepoCommit, ProjectRepoDiff } from "@/shared/api/types"; import { DiscussedInChannels } from "./DiscussionChannels"; import { CopyCommitHashButton } from "./ProjectCommitCopyButton"; import { ProjectDetailMetaList, ProjectDetailMetaRow, } from "./ProjectDetailMeta"; import { ProjectDetailSection } from "./ProjectDetailSection"; import { PROJECT_DETAIL_READING_COLUMN_CLASS } from "./projectPanelStyles"; import { ProjectDiffFilesPanel } from "./ProjectPullRequestFilesChangedPanel"; import { ProjectOriginReference } from "./ProjectOriginReference"; import { ProjectRichContent } from "./ProjectRichContent"; import { ShareLinkButton } from "./ShareLinkButton"; function commitDateLabel(timestamp: number) { return new Date(timestamp * 1_000).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short", }); } /** * Detail view for a single commit: title and meta header, then collapsible * description and the commit-vs-parent diff. */ export function ProjectCommitDetailPanel({ commit, commitHash, diff, diffError, diffLoading, originAgentName, originChannelId, project, }: { commit: ProjectRepoCommit | null; commitHash: string; diff: ProjectRepoDiff | null | undefined; diffError: unknown; diffLoading: boolean; originAgentName?: string | null; originChannelId?: string | null; project: Repository; }) { const shortHash = commit?.shortHash ?? commitHash.slice(0, 7); return (
Committed
{commit ? (
{commitDateLabel(commit.timestamp)}
) : null}
{commit?.authorName ? (
by {commit.authorName}
) : null}