refactor: rename components/ui to components/primitives (#3064)
Move Radix/shadcn-based UI primitives into a dedicated `components/primitives` directory to better reflect their low-level, composable nature. Imports remain ergonomic via an alias to `components/ui`. App-level components should continue to use PascalCase filenames.
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
"iconLibrary": "lucide",
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"utils": "@/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"lib": "@/libs",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"registries": {}
|
||||
|
||||
+1
-1
@@ -26,9 +26,9 @@ import {
|
||||
import type { EmbeddingProgress, AISettings, AIMessage } from '@/services/ai/types';
|
||||
import { useEnv } from '@/context/EnvContext';
|
||||
|
||||
import { Thread } from '@/components/assistant-ui/thread';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Loader2Icon, BookOpenIcon } from 'lucide-react';
|
||||
import { Thread } from '@/components/assistant/Thread';
|
||||
|
||||
// Helper function to convert AIMessage array to ExportedMessageRepository format
|
||||
// Each message needs to be wrapped with { message, parentId } structure
|
||||
@@ -21,7 +21,7 @@ import { saveSysSettings } from '@/helpers/settings';
|
||||
import { NOTE_PREFIX } from '@/types/view';
|
||||
import useShortcuts from '@/hooks/useShortcuts';
|
||||
import BooknoteItem from '../sidebar/BooknoteItem';
|
||||
import AIAssistant from '../sidebar/AIAssistant';
|
||||
import AIAssistant from './AIAssistant';
|
||||
import NotebookHeader from './Header';
|
||||
import NoteEditor from './NoteEditor';
|
||||
import SearchBar from './SearchBar';
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import remarkGfm from 'remark-gfm';
|
||||
import { type FC, memo, useState } from 'react';
|
||||
import { CheckIcon, CopyIcon } from 'lucide-react';
|
||||
|
||||
import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { TooltipIconButton } from './TooltipIconButton';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const MarkdownTextImpl = () => {
|
||||
return (
|
||||
+2
-2
@@ -26,14 +26,14 @@ import {
|
||||
Trash2Icon,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { MarkdownText } from '@/components/assistant-ui/markdown-text';
|
||||
import { MarkdownText } from './MarkdownText';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
import type { ScoredChunk } from '@/services/ai/types';
|
||||
|
||||
interface ThreadProps {
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { forwardRef, type ComponentPropsWithRef } from 'react';
|
||||
import { Slottable } from '@radix-ui/react-slot';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
||||
tooltip: string;
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
|
||||
const buttonGroupVariants = cva(
|
||||
+1
-1
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { type DialogProps } from '@radix-ui/react-dialog';
|
||||
import { Command as CommandPrimitive } from 'cmdk';
|
||||
import { Search } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
||||
|
||||
const Command = React.forwardRef<
|
||||
+1
-1
@@ -4,7 +4,7 @@ import * as React from 'react';
|
||||
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const Dialog = DialogPrimitive.Root;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import * as React from 'react';
|
||||
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||||
import { Check, ChevronRight, Circle } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import * as React from 'react';
|
||||
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const HoverCard = HoverCardPrimitive.Root;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import * as React from 'react';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(
|
||||
({ className, type, ...props }, ref) => {
|
||||
+1
-1
@@ -4,7 +4,7 @@ import * as React from 'react';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const Select = SelectPrimitive.Root;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import * as React from 'react';
|
||||
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const Separator = React.forwardRef<
|
||||
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<'textarea'>>(
|
||||
({ className, ...props }, ref) => {
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import * as React from 'react';
|
||||
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/utils/tailwind';
|
||||
|
||||
const TooltipProvider = ({
|
||||
children,
|
||||
@@ -21,6 +21,7 @@
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@/components/ui/*": ["./src/components/primitives/*"],
|
||||
"@pdfjs/*": ["./public/vendor/pdfjs/*"],
|
||||
"@simplecc/*": ["./public/vendor/simplecc/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user