Skip to content

Commit 644cf64

Browse files
committed
fix(web): separate the sidebar handle and timeline minimap
1 parent 0685aaf commit 644cf64

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
109109
import { resolveThreadReferenceCopyTarget } from "@t3tools/client-runtime/thread-reference";
110110
import { resolveTerminalSessionLabel } from "@t3tools/shared/terminalLabels";
111111
import { useAtomValue } from "@effect/atom-react";
112-
import { type SetStateAction, use, useEffect, useLayoutEffect, useRef, useState } from "react";
112+
import {
113+
type CSSProperties,
114+
type SetStateAction,
115+
use,
116+
useEffect,
117+
useLayoutEffect,
118+
useRef,
119+
useState,
120+
} from "react";
113121
import { BackgroundThreadContext } from "./chat/backgroundThread";
114122
import { useLocation, useNavigate } from "@tanstack/react-router";
115123
import { assistantCitationFromLocation } from "../lib/assistantCitationNavigation";
@@ -3298,6 +3306,11 @@ export default function ChatView(props: ChatViewProps) {
32983306
)}
32993307
data-chat-column-maximized-away={rightPanelMaximized ? "true" : "false"}
33003308
data-chat-column
3309+
style={
3310+
{
3311+
"--chat-header-height": embedded ? "0px" : "var(--workspace-topbar-height)",
3312+
} as CSSProperties
3313+
}
33013314
inert={rightPanelMaximized}
33023315
>
33033316
{embedded ? null : (

‎apps/web/src/components/chat/MessagesTimeline.logic.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,25 @@ import {
3030
deriveMessagesTimelineRowsWithState,
3131
shouldCollapseUserMessage,
3232
resolveAssistantMessageCopyState,
33+
resolveTimelineMinimapHitStripWidth,
3334
type MessagesTimelineRow,
3435
workEntryDisplayLabel,
3536
} from "./MessagesTimeline.logic";
3637

38+
describe("resolveTimelineMinimapHitStripWidth", () => {
39+
it.each([
40+
{ viewport: 1280, content: 768, expected: 40 },
41+
{ viewport: 768, content: 672, expected: 16 },
42+
{ viewport: 768, content: 704, expected: 0 },
43+
{ viewport: 768, content: 720, expected: 0 },
44+
])(
45+
"keeps the minimap inside the gutter at $viewport/$content",
46+
({ viewport, content, expected }) => {
47+
expect(resolveTimelineMinimapHitStripWidth(viewport, content)).toBe(expected);
48+
},
49+
);
50+
});
51+
3752
describe("resolveAssistantMessageCopyState", () => {
3853
it("copies the rendered representation of Codex directives", () => {
3954
expect(

‎apps/web/src/components/chat/MessagesTimeline.logic.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export function resolveTimelineMinimapHasPersistentGutter(
438438
);
439439
}
440440

441-
const TIMELINE_MINIMAP_HIT_STRIP_LEFT = 12;
441+
const TIMELINE_MINIMAP_HIT_STRIP_LEFT = 32;
442442
const TIMELINE_MINIMAP_HIT_STRIP_MAX_WIDTH = 40;
443443
const TIMELINE_MINIMAP_EXPANDED_HIT_STRIP_WIDTH = "22rem";
444444

‎apps/web/src/components/chat/TimelineMinimap.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function TimelineMinimap({
115115
return (
116116
<div
117117
className={cn(
118-
"group/minimap pointer-events-none absolute inset-y-0 left-0 z-40 hidden w-18 [@media(pointer:fine)]:block",
118+
"group/minimap pointer-events-none absolute bottom-0 left-0 top-[calc(-1*var(--chat-header-height,0px))] z-40 hidden w-18 [@media(pointer:fine)]:block",
119119
hasPersistentGutter
120120
? "opacity-100"
121121
: "opacity-0 transition-opacity duration-150 hover:opacity-100 focus-within:opacity-100",
@@ -127,7 +127,7 @@ export function TimelineMinimap({
127127
<div className="relative h-full w-full select-none">
128128
<div
129129
className={cn(
130-
"absolute top-1/2 left-3 -translate-y-1/2",
130+
"absolute top-1/2 left-8 -translate-y-1/2",
131131
hitStripWidth > 0 && !passThrough ? "pointer-events-auto" : "pointer-events-none",
132132
)}
133133
onMouseDown={() => {

0 commit comments

Comments
 (0)