Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useVirtualizer } from "@tanstack/react-virtual";
import { useEffect, useMemo, useRef } from "react";
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
import {
ContextMenu,
ContextMenuContent,
Expand All @@ -8,6 +8,7 @@ import {
ContextMenuShortcut,
ContextMenuTrigger,
} from "@/ui/context-menu";
import { bindScrollContainerWheel } from "@/ui/scroll-container-wheel";
import {
CopyIcon as Copy,
EyeIcon as Eye,
Expand Down Expand Up @@ -73,6 +74,12 @@ export function GitCommitTable({
overscan: 14,
});

useLayoutEffect(() => {
const element = scrollRef.current;
if (!element) return;
return bindScrollContainerWheel(element);
}, []);

useEffect(() => {
if (!selectedCommit) return;
const selectedIndex = visibleRows.findIndex((row) => row.commit.hash === selectedCommit.hash);
Expand Down Expand Up @@ -183,7 +190,11 @@ export function GitCommitTable({
<span className="w-32 shrink-0 text-right">{t("git.log.date")}</span>
</div>

<div ref={scrollRef} className="min-h-0 flex-1 overflow-auto">
<div
ref={scrollRef}
data-scroll-container=""
className="min-h-0 flex-1 overflow-auto [overflow-anchor:none]"
>
{visibleRows.length === 0 ? (
<div className="flex h-full items-center justify-center text-subtle-foreground">
{query ? t("git.log.noMatch") : t("git.log.noCommits")}
Expand Down Expand Up @@ -216,10 +227,10 @@ export function GitCommitTable({
title={t("git.log.openDiffHint")}
>
<GitGraphRow row={row} showDecorations={showDecorations} />
<span className="w-28 shrink-0 truncate px-2 text-subtle-foreground">
<span className="w-28 shrink-0 overflow-clip px-2 text-ellipsis whitespace-nowrap text-subtle-foreground">
{row.commit.author}
</span>
<span className="w-32 shrink-0 truncate text-right font-mono text-[11px] text-subtle-foreground">
<span className="w-32 shrink-0 overflow-clip text-ellipsis whitespace-nowrap text-right font-mono text-[11px] text-subtle-foreground">
{row.commit.date}
</span>
</ContextMenuTrigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function GitGraphRow({ row, showDecorations }: { row: GraphRow; showDecor
aria-hidden="true"
width={width}
height={ROW_HEIGHT}
className="shrink-0 overflow-visible"
className="pointer-events-none shrink-0 overflow-visible"
>
{row.incomingLaneColors.map((colorIndex, lane) => {
if (colorIndex === null) return null;
Expand Down Expand Up @@ -78,21 +78,24 @@ export function GitGraphRow({ row, showDecorations }: { row: GraphRow; showDecor
/>
</svg>

<div className="flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden">
<div className="flex min-w-0 flex-1 items-center gap-1.5 overflow-clip">
{showDecorations &&
row.labels.map((label, index) => (
<span
key={`${label.kind}:${label.title}:${index}`}
className={cn(
"max-w-28 shrink-0 truncate rounded border px-1.5 py-0.5 font-medium text-[10px] leading-none",
"max-w-28 shrink-0 overflow-clip text-ellipsis whitespace-nowrap rounded border px-1.5 py-0.5 font-medium text-[10px] leading-none",
gitGraphLabelClassName(label),
)}
title={label.title}
>
{label.title}
</span>
))}
<span className="min-w-0 flex-1 truncate text-foreground" title={row.commit.message}>
<span
className="min-w-0 flex-1 overflow-clip text-ellipsis whitespace-nowrap text-foreground"
title={row.commit.message}
>
{row.commit.message}
</span>
</div>
Expand Down
Loading