Skip to content

Commit 2884345

Browse files
committed
fix(web): long inline file labels wrap within the chat
1 parent e828e8e commit 2884345

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ function useChatMarkdownState({
850850
fileLinkParentSuffixByPath,
851851
)
852852
}
853+
wrapLabel={label !== undefined}
853854
copyMarkdown={copyMarkdown}
854855
theme={resolvedTheme}
855856
threadRef={threadRef}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { WorkspaceEntryIcon } from "./WorkspaceEntryIcon";
55
export function FileTagChipContent(props: {
66
path: string;
77
label: string;
8+
wrapLabel?: boolean | undefined;
89
theme: "light" | "dark";
910
environmentId?: EnvironmentId | null | undefined;
1011
cwd?: string | undefined;
@@ -17,7 +18,13 @@ export function FileTagChipContent(props: {
1718
cwd={props.cwd}
1819
theme={props.theme}
1920
/>
20-
<ContextChipLabel>{props.label}</ContextChipLabel>
21+
<ContextChipLabel
22+
className={
23+
props.wrapLabel ? "overflow-visible whitespace-normal break-all text-left" : undefined
24+
}
25+
>
26+
{props.label}
27+
</ContextChipLabel>
2128
</>
2229
);
2330
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface MarkdownFileLinkProps {
3333
panelPath: string | null;
3434
line?: number | undefined;
3535
label: string;
36+
wrapLabel?: boolean | undefined;
3637
copyMarkdown: string;
3738
theme: "light" | "dark";
3839
threadRef?: ScopedThreadRef | undefined;
@@ -57,6 +58,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({
5758
panelPath,
5859
line,
5960
label,
61+
wrapLabel,
6062
copyMarkdown,
6163
theme,
6264
threadRef,
@@ -353,6 +355,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({
353355
path={iconPath}
354356
environmentId={environmentId}
355357
label={label}
358+
wrapLabel={wrapLabel}
356359
theme={theme}
357360
/>
358361
</ContextChip>
@@ -372,6 +375,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({
372375
path={iconPath}
373376
environmentId={environmentId}
374377
label={label}
378+
wrapLabel={wrapLabel}
375379
theme={theme}
376380
/>
377381
</ContextChip>
@@ -400,6 +404,7 @@ function areMarkdownFileLinkPropsEqual(
400404
previous.panelPath === next.panelPath &&
401405
previous.line === next.line &&
402406
previous.label === next.label &&
407+
previous.wrapLabel === next.wrapLabel &&
403408
previous.copyMarkdown === next.copyMarkdown &&
404409
previous.theme === next.theme &&
405410
previous.threadRef === next.threadRef &&

0 commit comments

Comments
 (0)