From 3a69dfc4d5d37b7a37313c7f0381948e7c0eb30e Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Tue, 29 Sep 2026 00:55:50 +0200 Subject: [PATCH] refactor(ui): remove the agent chat primitives and sidebar Attachment, bubble, empty, marker, message, message scroller, questionnaire, resizable and sidebar had no users after the assistant moved into the editor, and neither did react-resizable-panels or @shadcn/react. --- packages/ui/package.json | 2 - packages/ui/src/components/attachment.tsx | 116 ---- packages/ui/src/components/bubble.tsx | 71 --- packages/ui/src/components/empty.tsx | 93 ---- packages/ui/src/components/marker.tsx | 64 --- .../ui/src/components/message-scroller.tsx | 116 ---- packages/ui/src/components/message.tsx | 31 -- packages/ui/src/components/questionnaire.tsx | 174 ------ packages/ui/src/components/resizable.test.tsx | 64 --- packages/ui/src/components/resizable.tsx | 39 -- packages/ui/src/components/sidebar.test.tsx | 286 ---------- packages/ui/src/components/sidebar.tsx | 498 ------------------ pnpm-lock.yaml | 33 -- 13 files changed, 1587 deletions(-) delete mode 100644 packages/ui/src/components/attachment.tsx delete mode 100644 packages/ui/src/components/bubble.tsx delete mode 100644 packages/ui/src/components/empty.tsx delete mode 100644 packages/ui/src/components/marker.tsx delete mode 100644 packages/ui/src/components/message-scroller.tsx delete mode 100644 packages/ui/src/components/message.tsx delete mode 100644 packages/ui/src/components/questionnaire.tsx delete mode 100644 packages/ui/src/components/resizable.test.tsx delete mode 100644 packages/ui/src/components/resizable.tsx delete mode 100644 packages/ui/src/components/sidebar.test.tsx delete mode 100644 packages/ui/src/components/sidebar.tsx diff --git a/packages/ui/package.json b/packages/ui/package.json index 980a3af87..b2d052a43 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -24,12 +24,10 @@ "@fontsource-variable/newsreader": "^5.3.0", "@phosphor-icons/web": "^2.1.2", "@reactive-resume/utils": "workspace:*", - "@shadcn/react": "^0.3.1", "class-variance-authority": "^0.7.1", "cmdk": "^1.1.1", "react": "^19.3.0", "react-dom": "^19.3.0", - "react-resizable-panels": "^4.14.1", "shadcn": "^4.21.0", "tw-animate-css": "^1.4.0" }, diff --git a/packages/ui/src/components/attachment.tsx b/packages/ui/src/components/attachment.tsx deleted file mode 100644 index 269206887..000000000 --- a/packages/ui/src/components/attachment.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import type { VariantProps } from "class-variance-authority"; -import type * as React from "react"; -import { cva } from "class-variance-authority"; -import { cn } from "@reactive-resume/utils/style"; - -const attachmentVariants = cva( - "group/attachment relative flex w-fit min-w-0 max-w-full shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", - { - variants: { - size: { - default: - "gap-2 text-sm has-data-[slot=attachment-media]:p-2 has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2", - sm: "gap-2.5 text-xs has-data-[slot=attachment-media]:p-1.5 has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5", - xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-media]:p-1 has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1", - }, - orientation: { - horizontal: "min-w-40 items-center", - vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30", - }, - }, - }, -); - -function Attachment({ - className, - state = "done", - size = "default", - orientation = "horizontal", - ...props -}: React.ComponentProps<"div"> & - VariantProps & { - state?: "idle" | "uploading" | "processing" | "error" | "done"; - }) { - return ( -
- ); -} - -const attachmentMediaVariants = cva( - "relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5 [&_svg]:pointer-events-none", - { - variants: { - variant: { - icon: "", - image: - "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover", - }, - }, - defaultVariants: { - variant: "icon", - }, - }, -); - -function AttachmentMedia({ - className, - variant = "icon", - ...props -}: React.ComponentProps<"div"> & VariantProps) { - return ( -
- ); -} - -function AttachmentContent({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function AttachmentTitle({ className, ...props }: React.ComponentProps<"span">) { - return ( - - ); -} - -function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -export { Attachment, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle }; diff --git a/packages/ui/src/components/bubble.tsx b/packages/ui/src/components/bubble.tsx deleted file mode 100644 index 8a901019c..000000000 --- a/packages/ui/src/components/bubble.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import type { VariantProps } from "class-variance-authority"; -import type * as React from "react"; -import { mergeProps } from "@base-ui/react/merge-props"; -import { useRender } from "@base-ui/react/use-render"; -import { cva } from "class-variance-authority"; -import { cn } from "@reactive-resume/utils/style"; - -const bubbleVariants = cva( - "group/bubble relative flex w-fit min-w-0 max-w-[80%] flex-col gap-1 data-[variant=ghost]:max-w-full data-[align=end]:self-end group-data-[align=end]/message:self-end", - { - variants: { - variant: { - default: - "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80", - secondary: - "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-secondary/80", - muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/80", - tinted: - "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)]", - outline: - "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground", - ghost: - "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground", - destructive: - "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - -function Bubble({ - variant = "default", - align = "start", - className, - ...props -}: React.ComponentProps<"div"> & - VariantProps & { - align?: "start" | "end"; - }) { - return ( -
- ); -} - -function BubbleContent({ className, render, ...props }: useRender.ComponentProps<"div">) { - return useRender({ - defaultTagName: "div", - props: mergeProps<"div">( - { - className: cn( - "w-fit min-w-0 max-w-full overflow-hidden break-words rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed group-data-[align=end]/bubble:self-end [button,a]:outline-none [button,a]:transition-colors [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50 [button]:text-left", - className, - ), - }, - props, - ), - render, - state: { slot: "bubble-content" }, - }); -} - -export { Bubble, BubbleContent }; diff --git a/packages/ui/src/components/empty.tsx b/packages/ui/src/components/empty.tsx deleted file mode 100644 index 1f3391830..000000000 --- a/packages/ui/src/components/empty.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import type { VariantProps } from "class-variance-authority"; -import type * as React from "react"; -import { cva } from "class-variance-authority"; -import { cn } from "@reactive-resume/utils/style"; - -function Empty({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -const emptyMediaVariants = cva( - "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", - { - variants: { - variant: { - default: "bg-transparent", - icon: "flex size-10 shrink-0 items-center justify-center rounded-full bg-sunken text-ink-2 [&_svg:not([class*='size-'])]:size-5", - success: "flex size-10 shrink-0 items-center justify-center rounded-full bg-accent-soft text-accent-text", - error: "flex size-10 shrink-0 items-center justify-center rounded-full bg-danger-soft text-danger-text", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - -function EmptyMedia({ - className, - variant = "default", - ...props -}: React.ComponentProps<"div"> & VariantProps) { - return ( -
- ); -} - -function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) { - return ( -
a]:text-accent-text [&>a]:underline [&>a]:underline-offset-4", - className, - )} - {...props} - /> - ); -} - -function EmptyContent({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle }; diff --git a/packages/ui/src/components/marker.tsx b/packages/ui/src/components/marker.tsx deleted file mode 100644 index 9053c1723..000000000 --- a/packages/ui/src/components/marker.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import type { VariantProps } from "class-variance-authority"; -import { mergeProps } from "@base-ui/react/merge-props"; -import { useRender } from "@base-ui/react/use-render"; -import { cva } from "class-variance-authority"; -import { cn } from "@reactive-resume/utils/style"; - -const markerVariants = cva( - "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-muted-foreground text-sm [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground", - { - variants: { - variant: { - default: "", - separator: - "before:me-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ms-1 after:h-px after:min-w-0 after:flex-1 after:bg-border", - border: "border-border border-b pb-2", - }, - }, - }, -); - -function Marker({ - className, - variant = "default", - render, - ...props -}: useRender.ComponentProps<"div"> & VariantProps) { - return useRender({ - defaultTagName: "div", - props: mergeProps<"div">( - { - className: cn(markerVariants({ variant }), className), - }, - props, - ), - render, - state: { slot: "marker", variant }, - }); -} - -function MarkerIcon({ className, ...props }: React.ComponentProps<"span">) { - return ( -