Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

feat(ui): give the three chat panels a shared shape and the tokens to match

codingFeng101bb88b8599264
diff --git a/client/index.css b/client/index.css
index 9a24790..e6d2118 100644
--- a/client/index.css
+++ b/client/index.css
@@ -39,6 +39,15 @@
--destructive: 5 58% 50%;
--destructive-foreground: 48 33% 98%;
+ /* Status colours. Clay is the accent, not a status, so "added" and
+ "warning" need their own hues -- folding them into the accent would
+ lose the meaning. Both are pulled well down in chroma to sit beside it. */
+ --success: 145 30% 34%;
+ --success-foreground: 48 33% 98%;
+
+ --warning: 38 58% 40%;
+ --warning-foreground: 48 33% 98%;
+
--border: 42 15% 88%;
--input: 42 15% 86%;
--ring: 15 63% 60%;
@@ -88,6 +97,12 @@
--destructive: 5 52% 52%;
--destructive-foreground: 45 15% 94%;
+ --success: 145 32% 55%;
+ --success-foreground: 30 5% 10%;
+
+ --warning: 38 60% 58%;
+ --warning-foreground: 30 5% 10%;
+
--border: 45 4% 24%;
--input: 45 4% 26%;
--ring: 15 63% 62%;
diff --git a/client/workspaces/cad/chat/ChatMessageDisplay.tsx b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
index 856dbeb..1854f78 100644
--- a/client/workspaces/cad/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
@@ -192,23 +192,23 @@ function CadPatchEditsDisplay({ edits, uiLang }: { edits: CadPatchEdit[]; uiLang
<div className="divide-y divide-border/30">
<div className="px-3 py-2">
<div className="flex items-center gap-1.5 mb-1.5">
- <Minus className="w-3 h-3 text-red-500" />
- <span className="text-[10px] font-medium text-red-600 uppercase tracking-wide">
+ <Minus className="w-3 h-3 text-destructive" />
+ <span className="text-[10px] font-medium text-destructive uppercase tracking-wide">
{tr("删除", "Remove")}
</span>
</div>
- <pre className="text-[11px] font-mono text-red-700 bg-red-50 rounded px-2 py-1.5 overflow-x-auto whitespace-pre-wrap break-all">
+ <pre className="text-[11px] font-mono text-destructive bg-destructive/[0.08] rounded px-2 py-1.5 overflow-x-auto whitespace-pre-wrap break-all">
{edit.search}
</pre>
</div>
<div className="px-3 py-2">
<div className="flex items-center gap-1.5 mb-1.5">
- <Plus className="w-3 h-3 text-green-500" />
- <span className="text-[10px] font-medium text-green-600 uppercase tracking-wide">
+ <Plus className="w-3 h-3 text-success" />
+ <span className="text-[10px] font-medium text-success uppercase tracking-wide">
{tr("新增", "Add")}
</span>
</div>
- <pre className="text-[11px] font-mono text-green-700 bg-green-50 rounded px-2 py-1.5 overflow-x-auto whitespace-pre-wrap break-all">
+ <pre className="text-[11px] font-mono text-success bg-success/[0.08] rounded px-2 py-1.5 overflow-x-auto whitespace-pre-wrap break-all">
{edit.replace}
</pre>
</div>
@@ -444,7 +444,7 @@ export function ChatMessageDisplay({
return (
<React.Fragment key={message.id}>
<div
- className={`flex w-full ${message.role === "user" ? "justify-end" : "justify-start"}`}
+ className={`flex w-full animate-message-in ${message.role === "user" ? "justify-end" : "justify-start"}`}
>
<div
className={cn(
@@ -458,10 +458,10 @@ export function ChatMessageDisplay({
message.role === "assistant"
? ""
: message.role === "user"
- ? "px-4 py-3 bg-background text-foreground rounded-2xl rounded-br-md border border-border/50 shadow-sm"
+ ? "px-4 py-3 bg-muted text-foreground rounded-2xl rounded-br-md border border-border/60 transition-[background-color] duration-fast ease-out-soft"
: "px-4 py-3 bg-destructive/10 text-destructive border border-destructive/20 rounded-2xl rounded-bl-md",
message.role === "user" && isLastUserMessage && onEditMessage
- ? "cursor-pointer hover:opacity-90 transition-opacity"
+ ? "cursor-pointer hover:bg-accent"
: ""
)}
role={message.role === "user" && isLastUserMessage && onEditMessage ? "button" : undefined}
@@ -533,14 +533,14 @@ export function ChatMessageDisplay({
className={cn(
"mx-0.5 inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium align-middle",
kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
)}
>
<span
className={cn(
- "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{kind === "outline" ? "T" : "P"}
@@ -588,14 +588,14 @@ export function ChatMessageDisplay({
<div
key={`${message.id}-img-${i}`}
className={cn(
- "overflow-hidden rounded-lg border border-border/60 bg-black/5 dark:bg-white/5",
+ "overflow-hidden rounded-lg border border-border/60 bg-muted",
"max-w-[420px] mx-auto"
)}
>
<img
src={img.url}
alt={img.name || "image"}
- className="w-full max-h-[240px] object-contain bg-black/5"
+ className="w-full max-h-[240px] object-contain bg-muted"
/>
</div>
))}
@@ -610,15 +610,15 @@ export function ChatMessageDisplay({
"inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] leading-4",
message.role === "user"
? t.kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
: "border-border bg-muted/40 text-foreground"
)}
>
<span
className={cn(
- "mr-1 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- t.kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "mr-1 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ t.kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{t.kind === "outline" ? "T" : "P"}
@@ -641,9 +641,9 @@ export function ChatMessageDisplay({
>
<div className="flex items-center gap-2">
{section.fileType === 'pdf' ? (
- <FileText className="h-4 w-4 text-red-500" />
+ <FileText className="h-4 w-4 text-destructive" />
) : (
- <FileCode className="h-4 w-4 text-blue-500" />
+ <FileCode className="h-4 w-4 text-primary" />
)}
<span className="text-xs font-medium truncate max-w-[150px] text-foreground">{section.filename}</span>
<span className="text-[10px] text-muted-foreground">({section.charCount} chars)</span>
@@ -679,15 +679,15 @@ export function ChatMessageDisplay({
className={cn(
"mx-1 inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium align-middle",
kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
)}
title={tr(`幻灯片 · ${label}`, `Slide · ${label}`)}
>
<span
className={cn(
- "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{kind === "outline" ? "T" : "P"}
@@ -721,7 +721,7 @@ export function ChatMessageDisplay({
className="flex w-full items-center justify-between px-3 py-2 text-left hover:bg-muted/40"
>
<span className="inline-flex items-center gap-2 text-sm font-medium text-foreground">
- <span className="h-2.5 w-2.5 rounded-full bg-emerald-500" />
+ <span className="h-2.5 w-2.5 rounded-full bg-success" />
{tr(`第 ${slideNumber} 张幻灯片`, `Slide ${slideNumber}`)}
</span>
{expanded ? <ChevronUp className="h-4 w-4 text-muted-foreground" /> : <ChevronDown className="h-4 w-4 text-muted-foreground" />}
@@ -883,7 +883,7 @@ export function ChatMessageDisplay({
{isStreamingPatch ? (
<div className="h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin" />
) : (
- <span className="text-xs font-medium text-green-600 bg-green-50 px-2 py-0.5 rounded-full">
+ <span className="text-xs font-medium text-success bg-success/[0.08] px-2 py-0.5 rounded-full">
{tr("完成", "Complete")}
</span>
)}
@@ -995,7 +995,7 @@ export function ChatMessageDisplay({
className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
title={tr("复制", "Copy")}
>
- {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-green-500" /> : <Copy className="h-3.5 w-3.5" />}
+ {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
</button>
</>
)}
@@ -1006,7 +1006,7 @@ export function ChatMessageDisplay({
onClick={() => copyMessageToClipboard(message.id, getMessageTextContent(message))}
className={`p-1.5 rounded-lg transition-colors ${
copiedMessageId === message.id
- ? "text-green-600 bg-green-100 dark:bg-green-950/30"
+ ? "text-success bg-success/15"
: "text-muted-foreground/60 hover:text-foreground hover:bg-muted"
}`}
title={tr("复制", "Copy")}
diff --git a/client/workspaces/cad/chat/code-block.tsx b/client/workspaces/cad/chat/code-block.tsx
index 05f32b2..b010ddb 100644
--- a/client/workspaces/cad/chat/code-block.tsx
+++ b/client/workspaces/cad/chat/code-block.tsx
@@ -156,7 +156,7 @@ export function CodeBlock({
{_isStreaming ? (
<div className="h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin" />
) : (
- <span className="text-xs font-medium text-green-600 bg-green-50 px-2 py-0.5 rounded-full">
+ <span className="text-xs font-medium text-success bg-success/[0.08] px-2 py-0.5 rounded-full">
{tr("完成", "Complete")}
</span>
)}
@@ -172,9 +172,9 @@ export function CodeBlock({
{applying ? (
<div className="h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin" />
) : applied ? (
- <Check className="h-3 w-3 text-green-500" />
+ <Check className="h-3 w-3 text-success" />
) : applyFailed ? (
- <X className="h-3 w-3 text-red-500" />
+ <X className="h-3 w-3 text-destructive" />
) : (
<Play className="h-3 w-3" />
)}
@@ -212,9 +212,9 @@ export function CodeBlock({
}
>
{copied ? (
- <Check className="h-3 w-3 text-green-500" />
+ <Check className="h-3 w-3 text-success" />
) : copyFailed ? (
- <X className="h-3 w-3 text-red-500" />
+ <X className="h-3 w-3 text-destructive" />
) : (
<Copy className="h-3 w-3" />
)}
diff --git a/client/workspaces/flow/chat/ChatInput.tsx b/client/workspaces/flow/chat/ChatInput.tsx
index 05f8ffa..aebe459 100644
--- a/client/workspaces/flow/chat/ChatInput.tsx
+++ b/client/workspaces/flow/chat/ChatInput.tsx
@@ -434,7 +434,7 @@ export function ChatInput({
<Brain
className={`h-3.5 w-3.5 ${
deepThinkingEnabled
- ? "text-blue-600"
+ ? "text-primary"
: "text-muted-foreground"
}`}
/>
diff --git a/client/workspaces/flow/chat/ChatMessageDisplay.tsx b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
index f5df7ca..481f58e 100644
--- a/client/workspaces/flow/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
@@ -361,12 +361,12 @@ export function ChatMessageDisplay({
<div className="h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin" />
)}
{state === "output-available" && (
- <span className="text-xs font-medium text-green-600 bg-green-50 px-2 py-0.5 rounded-full">
+ <span className="text-xs font-medium text-success bg-success/[0.08] px-2 py-0.5 rounded-full">
Complete
</span>
)}
{state === "output-error" && (
- <span className={`text-xs font-medium px-2 py-0.5 rounded-full ${((toolName === "display_diagram" || toolName === "append_diagram") && !isMxCellXmlComplete(String(input?.xml || ""))) ? "text-yellow-700 bg-yellow-50" : "text-red-600 bg-red-50"}`}>
+ <span className={`text-xs font-medium px-2 py-0.5 rounded-full ${((toolName === "display_diagram" || toolName === "append_diagram") && !isMxCellXmlComplete(String(input?.xml || ""))) ? "text-yellow-700 bg-yellow-50" : "text-destructive bg-destructive/[0.08]"}`}>
{((toolName === "display_diagram" || toolName === "append_diagram") && !isMxCellXmlComplete(String(input?.xml || ""))) ? "Truncated" : "Error"}
</span>
)}
@@ -435,7 +435,7 @@ export function ChatMessageDisplay({
</div>
)}
{output && state === "output-error" && (
- <div className="px-4 py-3 border-t border-border/40 text-sm text-red-600">
+ <div className="px-4 py-3 border-t border-border/40 text-sm text-destructive">
{output}
</div>
)}
@@ -492,7 +492,10 @@ export function ChatMessageDisplay({
: "justify-start"
} animate-message-in`}
style={{
- animationDelay: `${messageIndex * 50}ms`,
+ // Capped: uncapped, the fortieth message
+ // in a thread waited two seconds before
+ // it appeared at all.
+ animationDelay: `${Math.min(messageIndex, 6) * 45}ms`,
}}
>
<div className="max-w-[95%] min-w-0">
@@ -826,7 +829,7 @@ export function ChatMessageDisplay({
width={96}
height={96}
alt="Uploaded image"
- className="rounded-md border border-white/20"
+ className="rounded-md border border-border"
style={{ objectFit: "cover" }}
/>
)
@@ -849,9 +852,9 @@ export function ChatMessageDisplay({
>
{section.fileType ===
"pdf" ? (
- <FileText className="h-4 w-4 text-red-500" />
+ <FileText className="h-4 w-4 text-destructive" />
) : (
- <FileCode className="h-4 w-4 text-blue-500" />
+ <FileCode className="h-4 w-4 text-primary" />
)}
<span className="text-xs font-medium leading-none">
{
@@ -931,10 +934,10 @@ export function ChatMessageDisplay({
>
{copiedMessageId ===
message.id ? (
- <Check className="h-3.5 w-3.5 text-green-500" />
+ <Check className="h-3.5 w-3.5 text-success" />
) : copyFailedMessageId ===
message.id ? (
- <X className="h-3.5 w-3.5 text-red-500" />
+ <X className="h-3.5 w-3.5 text-destructive" />
) : (
<Copy className="h-3.5 w-3.5" />
)}
@@ -942,15 +945,19 @@ export function ChatMessageDisplay({
</div>
)}
<div
- className={`order-1 w-full px-4 py-3 text-sm leading-relaxed ${
+ // Same split as the other two panels: only the user's
+ // turn is a card. This had it backwards -- the assistant
+ // carried the bubble while the user's `bg-background`
+ // matched the page ground and read as no bubble at all.
+ className={`order-1 w-full text-sm leading-relaxed ${
message.role ===
"user"
- ? "bg-background text-foreground rounded-2xl rounded-br-md border border-border/50 shadow-sm"
+ ? "px-4 py-3 bg-muted text-foreground rounded-2xl rounded-br-md border border-border/60 transition-[background-color] duration-fast ease-out-soft"
: message.role ===
"system"
- ? "bg-destructive/10 text-destructive border border-destructive/20 rounded-2xl rounded-bl-md"
- : "bg-muted/60 text-foreground rounded-2xl rounded-bl-md"
- } ${message.role === "user" && isLastUserMessage && onEditMessage ? "cursor-pointer hover:opacity-90 transition-opacity" : ""}`}
+ ? "px-4 py-3 bg-destructive/10 text-destructive border border-destructive/20 rounded-2xl rounded-bl-md"
+ : "py-1 text-foreground"
+ } ${message.role === "user" && isLastUserMessage && onEditMessage ? "cursor-pointer hover:bg-accent" : ""}`}
role={
message.role ===
"user" &&
@@ -1181,7 +1188,7 @@ export function ChatMessageDisplay({
className={`p-1.5 rounded-lg transition-colors ${
copiedMessageId ===
message.id
- ? "text-green-600 bg-green-100"
+ ? "text-success bg-success/15"
: "text-muted-foreground/60 hover:text-foreground hover:bg-muted"
}`}
title={
diff --git a/client/workspaces/flow/chat/code-block.tsx b/client/workspaces/flow/chat/code-block.tsx
index e403712..ee49922 100644
--- a/client/workspaces/flow/chat/code-block.tsx
+++ b/client/workspaces/flow/chat/code-block.tsx
@@ -67,9 +67,9 @@ export function CodeBlock({ code, language = "xml", onApply }: CodeBlockProps) {
{applying ? (
<div className="h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin" />
) : applied ? (
- <Check className="h-3 w-3 text-green-500" />
+ <Check className="h-3 w-3 text-success" />
) : applyFailed ? (
- <X className="h-3 w-3 text-red-500" />
+ <X className="h-3 w-3 text-destructive" />
) : (
<Play className="h-3 w-3" />
)}
@@ -89,9 +89,9 @@ export function CodeBlock({ code, language = "xml", onApply }: CodeBlockProps) {
}
>
{copied ? (
- <Check className="h-3 w-3 text-green-500" />
+ <Check className="h-3 w-3 text-success" />
) : copyFailed ? (
- <X className="h-3 w-3 text-red-500" />
+ <X className="h-3 w-3 text-destructive" />
) : (
<Copy className="h-3 w-3" />
)}
diff --git a/client/workspaces/flow/chat/history-dialog.tsx b/client/workspaces/flow/chat/history-dialog.tsx
index dcdc859..c012745 100644
--- a/client/workspaces/flow/chat/history-dialog.tsx
+++ b/client/workspaces/flow/chat/history-dialog.tsx
@@ -47,7 +47,7 @@ export function HistoryDialog({
</DialogHeader>
{diagramHistory.length === 0 ? (
- <div className="text-center p-4 text-gray-500">
+ <div className="text-center p-4 text-muted-foreground">
{t("history.empty")}
</div>
) : (
@@ -71,7 +71,7 @@ export function HistoryDialog({
className="object-contain w-full h-full p-1"
/>
</div>
- <div className="text-xs text-center mt-1 text-gray-500">
+ <div className="text-xs text-center mt-1 text-muted-foreground">
{t("history.version")} {index + 1}
</div>
</div>
diff --git a/client/workspaces/flow/chat/quota-limit-toast.tsx b/client/workspaces/flow/chat/quota-limit-toast.tsx
index 31d5bc1..32603b7 100644
--- a/client/workspaces/flow/chat/quota-limit-toast.tsx
+++ b/client/workspaces/flow/chat/quota-limit-toast.tsx
@@ -27,7 +27,7 @@ export function QuotaLimitToast({
{t("quota.limit.desc").replace("{limit}", limit.toString())}
</p>
</div>
- <div className="flex items-center justify-center w-8 h-8 rounded-full bg-amber-100 text-amber-600 shrink-0">
+ <div className="flex items-center justify-center w-8 h-8 rounded-full bg-warning/15 text-warning shrink-0">
<span className="text-xs font-bold">!</span>
</div>
</div>
@@ -35,7 +35,7 @@ export function QuotaLimitToast({
{/* Progress bar */}
<div className="w-full h-1.5 bg-secondary rounded-full overflow-hidden">
<div
- className="h-full bg-amber-500 rounded-full transition-all duration-500 ease-out"
+ className="h-full bg-warning rounded-full transition-all duration-500 ease-out"
style={{ width: `${percentage}%` }}
/>
</div>
diff --git a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
index d81d213..0ab52f2 100644
--- a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
@@ -258,20 +258,26 @@ export function ChatMessageDisplay({
return (
<React.Fragment key={message.id}>
<div
- className={`flex w-full ${message.role === "user" ? "justify-end" : "justify-start"}`}
+ className={`flex w-full animate-message-in ${message.role === "user" ? "justify-end" : "justify-start"}`}
>
<div
className={cn(
"min-w-0 flex flex-col",
- message.role === "assistant" ? "w-full max-w-[95%] items-start" : "max-w-[95%] items-end"
+ message.role === "assistant" ? "w-full max-w-full items-start" : "max-w-[85%] items-end"
)}
>
- {/* Content Bubble */}
+ {/* Content Bubble.
+
+ The assistant speaks onto the page: no card,
+ no border, full width. Only what the user
+ said is bounded. Giving both roles the same
+ bubble made the thread read as one
+ undifferentiated wall. */}
<div className={cn(
- "relative px-4 py-3 text-sm leading-relaxed break-words overflow-hidden border border-border/50 bg-background/70 backdrop-blur-md shadow-sm transition-shadow hover:shadow-md",
- message.role === "user"
- ? "text-foreground rounded-2xl rounded-tr-sm w-full cursor-pointer"
- : "text-foreground rounded-2xl rounded-tl-sm w-full"
+ "relative text-sm leading-relaxed break-words overflow-hidden w-full text-foreground",
+ message.role === "user"
+ ? "px-4 py-3 rounded-2xl rounded-tr-md border border-border/60 bg-muted cursor-pointer transition-[background-color,box-shadow] duration-fast ease-out-soft hover:bg-accent"
+ : "py-1"
)}
role={message.role === "user" && isLastUserMessage && onEditMessage ? "button" : undefined}
tabIndex={message.role === "user" && isLastUserMessage && onEditMessage ? 0 : undefined}
@@ -342,14 +348,14 @@ export function ChatMessageDisplay({
className={cn(
"mx-0.5 inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium align-middle",
kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
)}
>
<span
className={cn(
- "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{kind === "outline" ? "T" : "P"}
@@ -397,14 +403,14 @@ export function ChatMessageDisplay({
<div
key={`${message.id}-img-${i}`}
className={cn(
- "overflow-hidden rounded-lg border border-border/60 bg-black/5 dark:bg-white/5",
+ "overflow-hidden rounded-lg border border-border/60 bg-muted",
"max-w-[420px] mx-auto"
)}
>
<img
src={img.url}
alt={img.name || "image"}
- className="w-full max-h-[240px] object-contain bg-black/5"
+ className="w-full max-h-[240px] object-contain bg-muted"
/>
</div>
))}
@@ -419,15 +425,15 @@ export function ChatMessageDisplay({
"inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] leading-4",
message.role === "user"
? t.kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
: "border-border bg-muted/40 text-foreground"
)}
>
<span
className={cn(
- "mr-1 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- t.kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "mr-1 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ t.kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{t.kind === "outline" ? "T" : "P"}
@@ -450,9 +456,9 @@ export function ChatMessageDisplay({
>
<div className="flex items-center gap-2">
{section.fileType === 'pdf' ? (
- <FileText className="h-4 w-4 text-red-500" />
+ <FileText className="h-4 w-4 text-destructive" />
) : (
- <FileCode className="h-4 w-4 text-blue-500" />
+ <FileCode className="h-4 w-4 text-primary" />
)}
<span className="text-xs font-medium truncate max-w-[150px] text-foreground">{section.filename}</span>
<span className="text-[10px] text-muted-foreground">({section.charCount} chars)</span>
@@ -488,15 +494,15 @@ export function ChatMessageDisplay({
className={cn(
"mx-1 inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium align-middle",
kind === "outline"
- ? "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/30 dark:bg-blue-950/40 dark:text-blue-200"
- : "border-red-200 bg-red-50 text-red-700 dark:border-red-400/30 dark:bg-red-950/40 dark:text-red-200"
+ ? "border-primary/25 bg-primary/[0.08] text-primary"
+ : "border-border bg-muted text-foreground/80"
)}
title={tr(`幻灯片 · ${label}`, `Slide · ${label}`)}
>
<span
className={cn(
- "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold text-white",
- kind === "outline" ? "bg-blue-600" : "bg-red-600"
+ "inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-semibold",
+ kind === "outline" ? "bg-primary text-primary-foreground" : "bg-foreground/70 text-background"
)}
>
{kind === "outline" ? "T" : "P"}
@@ -530,7 +536,7 @@ export function ChatMessageDisplay({
className="flex w-full items-center justify-between px-3 py-2 text-left hover:bg-muted/40"
>
<span className="inline-flex items-center gap-2 text-sm font-medium text-foreground">
- <span className="h-2.5 w-2.5 rounded-full bg-emerald-500" />
+ <span className="h-2.5 w-2.5 rounded-full bg-success" />
{tr(`第 ${slideNumber} 张幻灯片`, `Slide ${slideNumber}`)}
</span>
{expanded ? <ChevronUp className="h-4 w-4 text-muted-foreground" /> : <ChevronDown className="h-4 w-4 text-muted-foreground" />}
@@ -651,7 +657,7 @@ export function ChatMessageDisplay({
className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
title={tr("复制", "Copy")}
>
- {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-green-500" /> : <Copy className="h-3.5 w-3.5" />}
+ {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
</button>
</>
)}
@@ -662,7 +668,7 @@ export function ChatMessageDisplay({
onClick={() => copyMessageToClipboard(message.id, getMessageTextContent(message))}
className={`p-1.5 rounded-lg transition-colors ${
copiedMessageId === message.id
- ? "text-green-600 bg-green-100 dark:bg-green-950/30"
+ ? "text-success bg-success/15"
: "text-muted-foreground/60 hover:text-foreground hover:bg-muted"
}`}
title={tr("复制", "Copy")}
diff --git a/client/workspaces/ppt/chat/code-block.tsx b/client/workspaces/ppt/chat/code-block.tsx
index 98b05d7..2698623 100644
--- a/client/workspaces/ppt/chat/code-block.tsx
+++ b/client/workspaces/ppt/chat/code-block.tsx
@@ -54,20 +54,20 @@ export function CodeBlock({ code, language = "xml", isStreaming = false, blockId
};
return (
- <div className="w-full my-2 border border-border/50 rounded-lg bg-zinc-50 dark:bg-zinc-900/40 overflow-hidden shadow-sm">
+ <div className="w-full my-2 border border-border/50 rounded-lg bg-sunken overflow-hidden shadow-sm">
<button
type="button"
onClick={() => setOpen(!isOpen)}
- className="flex items-center gap-2 w-full p-2.5 cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800/40 transition-colors text-xs font-medium text-zinc-600 dark:text-zinc-300 select-none bg-zinc-100/70 dark:bg-zinc-900/60"
+ className="flex items-center gap-2 w-full p-2.5 cursor-pointer hover:bg-accent transition-colors text-xs font-medium text-muted-foreground select-none bg-muted/70"
>
- <ChevronRight className={cn("w-4 h-4 transition-transform duration-200 text-zinc-600 dark:text-zinc-300", isOpen && "rotate-90")} />
+ <ChevronRight className={cn("w-4 h-4 transition-transform duration-200 text-muted-foreground", isOpen && "rotate-90")} />
- <span className="uppercase font-semibold tracking-wider text-zinc-700 dark:text-zinc-200">{normalizedLanguage}</span>
+ <span className="uppercase font-semibold tracking-wider text-foreground/80">{normalizedLanguage}</span>
{isStreaming ? (
<div className="flex items-center gap-2 ml-auto">
- <span className="text-[10px] text-blue-600 animate-pulse">Generating code...</span>
- <Loader2 className="w-3.5 h-3.5 animate-spin text-blue-600" />
+ <span className="text-[10px] text-primary animate-pulse">Generating code...</span>
+ <Loader2 className="w-3.5 h-3.5 animate-spin text-primary" />
</div>
) : (
<span className="ml-auto text-[10px] opacity-70 font-mono">{normalizedCode.length} chars</span>
@@ -76,7 +76,7 @@ export function CodeBlock({ code, language = "xml", isStreaming = false, blockId
{isOpen && (
<div className="p-0 border-t border-border/50">
- <div className="overflow-hidden w-full bg-zinc-50 dark:bg-zinc-900/40">
+ <div className="overflow-hidden w-full bg-sunken">
<Highlight theme={themes.github} code={normalizedCode} language={prismLanguage}>
{({
style,
@@ -111,7 +111,7 @@ export function CodeBlock({ code, language = "xml", isStreaming = false, blockId
{...lineProps}
className={cn("grid grid-cols-[3.25rem_1fr] gap-0", lineProps?.className)}
>
- <span className="select-none text-zinc-400 text-right pr-4">{i + 1}</span>
+ <span className="select-none text-muted-foreground/70 text-right pr-4">{i + 1}</span>
<span className="min-w-0 whitespace-pre-wrap break-words">
{line.map((token, key) => (
<span key={key} {...getTokenProps({ token })} />
diff --git a/eslint.config.js b/eslint.config.js
index 63075bb..afe3b41 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -5,7 +5,9 @@ import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
export default tseslint.config(
- { ignores: ['dist'] },
+ // `.claude/worktrees` holds full checkouts of this same repo, so without
+ // this every file gets linted once per live worktree.
+ { ignores: ['dist', '.claude'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
diff --git a/tailwind.config.js b/tailwind.config.js
index 04192e3..6d90cbd 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -39,6 +39,14 @@ export default {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
+ success: {
+ DEFAULT: "hsl(var(--success))",
+ foreground: "hsl(var(--success-foreground))",
+ },
+ warning: {
+ DEFAULT: "hsl(var(--warning))",
+ foreground: "hsl(var(--warning-foreground))",
+ },
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
@@ -100,6 +108,17 @@ export default {
"0%, 100%": { opacity: "0.55" },
"50%": { opacity: "1" },
},
+ // Both of these were already referenced from the chat components but
+ // had never been defined anywhere, so the panels and their messages
+ // arrived with no animation at all.
+ "message-in": {
+ from: { opacity: "0", transform: "translateY(6px)" },
+ to: { opacity: "1", transform: "none" },
+ },
+ "slide-in-right": {
+ from: { opacity: "0", transform: "translateX(14px)" },
+ to: { opacity: "1", transform: "none" },
+ },
},
animation: {
"rise-in": "rise-in var(--dur-base) var(--ease-out-soft) both",
@@ -107,6 +126,8 @@ export default {
"scale-in": "scale-in var(--dur-base) var(--ease-out-soft) both",
sheen: "sheen 2.2s linear infinite",
breathe: "breathe 4s var(--ease-in-out-soft) infinite",
+ "message-in": "message-in var(--dur-base) var(--ease-out-soft) both",
+ "slide-in-right": "slide-in-right var(--dur-slow) var(--ease-out-soft) both",
},
},
},