Open source CapCut alternative.
TypeScript
feat(site): the past-threads button carries the unread mark
David Lee28deb7dd23d
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsxindex ac93b4d1..bb4c5496 100644--- a/site/src/cut/components/AiPanel.tsx+++ b/site/src/cut/components/AiPanel.tsx@@ -1,6 +1,6 @@"use client";-import type { ChatStatus } from "./ChatStatusBadge";+import { ChatStatusBadge, type ChatStatus } from "./ChatStatusBadge";import { chatRuntime, cutJudge } from "@/cut/lib/chatRuntime";import { ChatRequests } from "@/cut/lib/chatRequests";@@ -689,7 +689,12 @@ export function AiPanel({aria-pressed={historyOpen}onClick={toggleHistory}>- <History />+ {/* A finished reply waiting in another thread marks the button that+ opens the list, the same blue dot the thread itself carries. */}+ <span className="relative grid place-items-center">+ <History />+ {hasUnread && <ChatStatusBadge status="unread" className="bg-card" />}+ </span></Button>{!readOnly && (<Buttondiff --git a/site/src/cut/components/ChatStatusBadge.tsx b/site/src/cut/components/ChatStatusBadge.tsxindex 0060b040..6bccc710 100644--- a/site/src/cut/components/ChatStatusBadge.tsx+++ b/site/src/cut/components/ChatStatusBadge.tsx@@ -1,11 +1,20 @@import { CircleDashed } from "lucide-react";+import { cn } from "@/lib/utils";+export type ChatStatus = "working" | "unread" | null;-export function ChatStatusBadge({ status }: { status: ChatStatus }) {+/** The corner mark on whatever opens the chat. `className` carries the surface+ * it sits on, so the halo behind the dot matches the button's background. */+export function ChatStatusBadge({ status, className }: { status: ChatStatus; className?: string }) {if (!status) return null;return (- <span className="pointer-events-none absolute -top-1 -right-1 grid size-3.5 place-items-center rounded-full bg-background">+ <span+ className={cn(+ "pointer-events-none absolute -top-1 -right-1 grid size-3.5 place-items-center rounded-full bg-background",+ className,+ )}+ >{status === "working" ? (<CircleDashed role="img" aria-label="Chat working" className="size-3! animate-spin text-muted-foreground" />) : (