diff --git a/src/components/features/snippet-display/SnippetCard.tsx b/src/components/features/snippet-display/SnippetCard.tsx
index b9d5382..a065df4 100644
--- a/src/components/features/snippet-display/SnippetCard.tsx
+++ b/src/components/features/snippet-display/SnippetCard.tsx
@@ -1,23 +1,12 @@
import { useState, useMemo, useEffect } from 'react'
-import { Badge } from '@/components/ui/badge'
-import { Button } from '@/components/ui/button'
import { Card } from '@/components/ui/card'
-import { Checkbox } from '@/components/ui/checkbox'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import { Copy, Pencil, Trash, Eye, DotsThree, FolderOpen } from '@phosphor-icons/react'
import { Snippet, Namespace } from '@/lib/types'
-import { strings, appConfig, LANGUAGE_COLORS } from '@/lib/config'
+import { strings, appConfig } from '@/lib/config'
import { getAllNamespaces, moveSnippetToNamespace } from '@/lib/db'
import { toast } from 'sonner'
+import { SnippetCardHeader } from './SnippetCardHeader'
+import { SnippetCodePreview } from './SnippetCodePreview'
+import { SnippetCardActions } from './SnippetCardActions'
interface SnippetCardProps {
snippet: Snippet
@@ -157,127 +146,30 @@ export function SnippetCard({
onClick={handleView}
>
-
-
- {selectionMode && (
-
e.stopPropagation()}
- className="mt-1"
- />
- )}
-
-
- {snippet.title}
-
- {snippetData.description && (
-
- {snippetData.description}
-
- )}
-
-
-
- {snippet.language}
-
-
+
-
-
- {snippetData.displayCode}
-
- {snippetData.isTruncated && (
-
- {strings.snippetCard.viewFullCode}
-
- )}
-
+
{!selectionMode && (
-
-
-
-
-
-
-
-
-
-
-
-
- e.stopPropagation()}>
-
-
-
- Move to...
-
-
- {availableNamespaces.length === 0 ? (
-
- No other namespaces
-
- ) : (
- availableNamespaces.map((namespace) => (
- handleMoveToNamespace(namespace.id)}
- >
- {namespace.name}
- {namespace.isDefault && (
- (Default)
- )}
-
- ))
- )}
-
-
-
-
-
- Delete
-
-
-
-
-
+
)}
diff --git a/src/components/features/snippet-display/SnippetCardActions.tsx b/src/components/features/snippet-display/SnippetCardActions.tsx
new file mode 100644
index 0000000..95becba
--- /dev/null
+++ b/src/components/features/snippet-display/SnippetCardActions.tsx
@@ -0,0 +1,120 @@
+import { Button } from '@/components/ui/button'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { Copy, Pencil, Trash, Eye, DotsThree, FolderOpen } from '@phosphor-icons/react'
+import { Namespace } from '@/lib/types'
+import { strings } from '@/lib/config'
+
+interface SnippetCardActionsProps {
+ isCopied: boolean
+ isMoving: boolean
+ availableNamespaces: Namespace[]
+ onView: (e: React.MouseEvent) => void
+ onCopy: (e: React.MouseEvent) => void
+ onEdit: (e: React.MouseEvent) => void
+ onDelete: (e: React.MouseEvent) => void
+ onMoveToNamespace: (namespaceId: string) => void
+}
+
+export function SnippetCardActions({
+ isCopied,
+ isMoving,
+ availableNamespaces,
+ onView,
+ onCopy,
+ onEdit,
+ onDelete,
+ onMoveToNamespace,
+}: SnippetCardActionsProps) {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ e.stopPropagation()}>
+
+
+
+ Move to...
+
+
+ {availableNamespaces.length === 0 ? (
+
+ No other namespaces
+
+ ) : (
+ availableNamespaces.map((namespace) => (
+ onMoveToNamespace(namespace.id)}
+ >
+ {namespace.name}
+ {namespace.isDefault && (
+ (Default)
+ )}
+
+ ))
+ )}
+
+
+
+
+
+ Delete
+
+
+
+
+
+ )
+}
diff --git a/src/components/features/snippet-display/SnippetCardHeader.tsx b/src/components/features/snippet-display/SnippetCardHeader.tsx
new file mode 100644
index 0000000..d36be64
--- /dev/null
+++ b/src/components/features/snippet-display/SnippetCardHeader.tsx
@@ -0,0 +1,50 @@
+import { Badge } from '@/components/ui/badge'
+import { Checkbox } from '@/components/ui/checkbox'
+import { Snippet } from '@/lib/types'
+import { LANGUAGE_COLORS } from '@/lib/config'
+
+interface SnippetCardHeaderProps {
+ snippet: Snippet
+ description: string
+ selectionMode: boolean
+ isSelected: boolean
+ onToggleSelect: () => void
+}
+
+export function SnippetCardHeader({
+ snippet,
+ description,
+ selectionMode,
+ isSelected,
+ onToggleSelect
+}: SnippetCardHeaderProps) {
+ return (
+
+
+ {selectionMode && (
+
e.stopPropagation()}
+ className="mt-1"
+ />
+ )}
+
+
+ {snippet.title}
+
+ {description && (
+
+ {description}
+
+ )}
+
+
+
+ {snippet.language}
+
+
+ )
+}
diff --git a/src/components/features/snippet-display/SnippetCodePreview.tsx b/src/components/features/snippet-display/SnippetCodePreview.tsx
new file mode 100644
index 0000000..ed7818d
--- /dev/null
+++ b/src/components/features/snippet-display/SnippetCodePreview.tsx
@@ -0,0 +1,21 @@
+import { strings } from '@/lib/config'
+
+interface SnippetCodePreviewProps {
+ displayCode: string
+ isTruncated: boolean
+}
+
+export function SnippetCodePreview({ displayCode, isTruncated }: SnippetCodePreviewProps) {
+ return (
+
+
+ {displayCode}
+
+ {isTruncated && (
+
+ {strings.snippetCard.viewFullCode}
+
+ )}
+
+ )
+}