From 9bba919f67acc77515c2409c2d1ce5997688d08a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 10 Nov 2026 10:31:46 +0000 Subject: [PATCH] fix(web): PDF attachment chips no longer look like failed ones The PDF accent is nearly the invalid-chip red, and context chips paint their label in the accent, so a healthy PDF chip read as an error. PDF chips now keep the red on the icon only and draw the label in the surrounding text colour; invalid chips still paint the label red. Message-bubble ink overrides move to a --context-chip-message-ink variable so they keep winning over the per-kind ink. Fixes pingdotgg/t3code#33044 AI-assisted; verified with the tests and tools listed above. --- apps/web/src/components/ContextChip.tsx | 8 +++++--- apps/web/src/components/chat/TimelineUserMessageRow.tsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/ContextChip.tsx b/apps/web/src/components/ContextChip.tsx index 13a19167fe929..dabe1f4844532 100644 --- a/apps/web/src/components/ContextChip.tsx +++ b/apps/web/src/components/ContextChip.tsx @@ -6,7 +6,7 @@ import type * as React from "react"; import { cn } from "~/lib/utils"; const contextChipVariants = cva( - "inline-flex max-w-full items-center gap-[0.2em] font-medium leading-[normal] text-(--context-chip-ink) [--context-chip-ink:var(--context-chip-accent)] [--document-icon-stroke:var(--context-chip-ink)] [&_svg]:block [&_svg]:size-[1em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-current rounded-sm disabled:cursor-default", + "inline-flex max-w-full items-center gap-[0.2em] font-medium leading-[normal] text-(--context-chip-ink) [--context-chip-ink:var(--context-chip-message-ink,var(--context-chip-accent))] [--document-icon-stroke:var(--context-chip-ink)] [&_svg]:block [&_svg]:size-[1em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-current rounded-sm disabled:cursor-default", { defaultVariants: { kind: "neutral" }, variants: { @@ -30,7 +30,9 @@ const contextChipVariants = cva( thread: "[--context-chip-accent:var(--context-chip-thread)]", environment: "[--context-chip-accent:var(--context-chip-environment)]", citation: "[--context-chip-accent:var(--context-chip-citation)]", - "doc-pdf": "[--context-chip-accent:var(--context-chip-doc-pdf)]", + // PDF red reads as the invalid state, so only the icon carries it. + "doc-pdf": + "[--context-chip-accent:var(--context-chip-doc-pdf)] [--context-chip-ink:var(--context-chip-message-ink,currentColor)] [--document-icon-stroke:var(--context-chip-message-ink,var(--context-chip-accent))]", "doc-word": "[--context-chip-accent:var(--context-chip-doc-word)]", "doc-spreadsheet": "[--context-chip-accent:var(--context-chip-doc-spreadsheet)]", "doc-slides": "[--context-chip-accent:var(--context-chip-doc-slides)]", @@ -43,7 +45,7 @@ const contextChipVariants = cva( state: { unresolved: "data-[state=unresolved]:[--context-chip-accent:currentColor]", invalid: - "data-[state=invalid]:[--context-chip-accent:var(--context-chip-invalid,var(--destructive-foreground))]", + "data-[state=invalid]:[--context-chip-accent:var(--context-chip-invalid,var(--destructive-foreground))] data-[state=invalid]:[--context-chip-ink:var(--context-chip-message-ink,var(--context-chip-accent))]", }, }, }, diff --git a/apps/web/src/components/chat/TimelineUserMessageRow.tsx b/apps/web/src/components/chat/TimelineUserMessageRow.tsx index 66bb9b586c679..ec54e1af2bfdb 100644 --- a/apps/web/src/components/chat/TimelineUserMessageRow.tsx +++ b/apps/web/src/components/chat/TimelineUserMessageRow.tsx @@ -96,7 +96,7 @@ const MEDIA_EDGE_CLASS_NAME = "relative after:pointer-events-none after:absolute after:inset-0 after:z-10 after:rounded-[inherit] after:ring-1 after:ring-inset after:ring-black/9 dark:after:ring-white/12"; const BUBBLE_CHIP_CLASS_NAME = - "[&_[data-slot=context-chip]]:[--context-chip-ink:var(--context-chip-message,var(--context-chip-accent))]"; + "[&_[data-slot=context-chip]]:[--context-chip-message-ink:var(--context-chip-message)]"; function UserFileCard({ file,