Skip to content

Commit c0b67b7

Browse files
authored
fix(web): wrap interruption footers as one sentence (pingdotgg#34649)
1 parent 3af5018 commit c0b67b7

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@ export function TimelineSystemDivider(props: {
1717
const Icon = props.icon;
1818
const content = (
1919
<>
20-
{Icon ? <Icon className="size-3 shrink-0" /> : null}
21-
<span className="font-medium">{props.label}</span>
20+
<span
21+
className={cn(
22+
"inline-flex items-center gap-1.5 align-baseline font-medium",
23+
props.wrapDetail && "shrink-0 whitespace-nowrap",
24+
)}
25+
>
26+
{Icon ? <Icon className="size-3 shrink-0 self-center" /> : null}
27+
{props.label}
28+
</span>
2229
{props.detail ? (
2330
<span
2431
className={cn(
25-
"inline-flex min-w-0 items-center opacity-70",
32+
"min-w-0 opacity-70",
33+
props.wrapDetail ? "ml-1.5 wrap-anywhere" : "inline-flex items-center",
2634
typeof props.detail === "string" &&
27-
(props.wrapDetail ? "max-w-80 whitespace-pre-wrap" : "max-w-80 truncate"),
35+
(props.wrapDetail ? "whitespace-pre-wrap" : "max-w-80 truncate"),
2836
)}
2937
>
3038
{props.showDetailSeparator === false ? null : "·\u00a0"}
@@ -50,7 +58,10 @@ export function TimelineSystemDivider(props: {
5058
type="button"
5159
aria-label={props.actionLabel}
5260
onClick={props.onAction}
53-
className="flex min-w-0 cursor-pointer items-center gap-1.5 rounded-full border border-border/70 bg-background px-2.5 py-1 transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"
61+
className={cn(
62+
"min-w-0 cursor-pointer rounded-full border border-border/70 bg-background px-2.5 py-1 transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70",
63+
props.wrapDetail ? "text-center" : "flex items-center gap-1.5",
64+
)}
5465
/>
5566
}
5667
>
@@ -59,7 +70,12 @@ export function TimelineSystemDivider(props: {
5970
<TooltipPopup side="top">{props.actionLabel}</TooltipPopup>
6071
</Tooltip>
6172
) : (
62-
<span className="flex min-w-0 flex-wrap items-center justify-center gap-1.5 rounded-full px-2 py-1">
73+
<span
74+
className={cn(
75+
"min-w-0 rounded-full px-2 py-1",
76+
props.wrapDetail ? "text-center" : "flex flex-wrap items-center justify-center gap-1.5",
77+
)}
78+
>
6379
{content}
6480
</span>
6581
)}

0 commit comments

Comments
 (0)