diff --git a/src/components/features/snippet-viewer/SnippetViewer.tsx b/src/components/features/snippet-viewer/SnippetViewer.tsx
index 70d03b2..3815fe9 100644
--- a/src/components/features/snippet-viewer/SnippetViewer.tsx
+++ b/src/components/features/snippet-viewer/SnippetViewer.tsx
@@ -2,18 +2,12 @@ import {
Dialog,
DialogContent,
DialogHeader,
- DialogTitle,
} from '@/components/ui/dialog'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Copy, Pencil, Check, SplitVertical } from '@phosphor-icons/react'
import { Snippet } from '@/lib/types'
-import { MonacoEditor } from '@/components/features/snippet-editor/MonacoEditor'
-import { ReactPreview } from '@/components/features/snippet-editor/ReactPreview'
-import { PythonOutput } from '@/components/features/python-runner/PythonOutput'
-import { cn } from '@/lib/utils'
import { useState } from 'react'
-import { strings, appConfig, LANGUAGE_COLORS } from '@/lib/config'
+import { appConfig } from '@/lib/config'
+import { SnippetViewerHeader } from './SnippetViewerHeader'
+import { SnippetViewerContent } from './SnippetViewerContent'
interface SnippetViewerProps {
snippet: Snippet | null
@@ -47,110 +41,24 @@ export function SnippetViewer({ snippet, open, onOpenChange, onEdit, onCopy }: S
diff --git a/src/components/features/snippet-viewer/SnippetViewerContent.tsx b/src/components/features/snippet-viewer/SnippetViewerContent.tsx
new file mode 100644
index 0000000..5524219
--- /dev/null
+++ b/src/components/features/snippet-viewer/SnippetViewerContent.tsx
@@ -0,0 +1,58 @@
+import { Snippet } from '@/lib/types'
+import { MonacoEditor } from '@/components/features/snippet-editor/MonacoEditor'
+import { ReactPreview } from '@/components/features/snippet-editor/ReactPreview'
+import { PythonOutput } from '@/components/features/python-runner/PythonOutput'
+
+interface SnippetViewerContentProps {
+ snippet: Snippet
+ canPreview: boolean
+ showPreview: boolean
+ isPython: boolean
+}
+
+export function SnippetViewerContent({
+ snippet,
+ canPreview,
+ showPreview,
+ isPython,
+}: SnippetViewerContentProps) {
+ if (canPreview && showPreview) {
+ return (
+ <>
+
+ {}}
+ language={snippet.language}
+ height="100%"
+ readOnly={true}
+ />
+
+
+ {isPython ? (
+
+ ) : (
+
+ )}
+
+ >
+ )
+ }
+
+ return (
+
+ {}}
+ language={snippet.language}
+ height="100%"
+ readOnly={true}
+ />
+
+ )
+}
diff --git a/src/components/features/snippet-viewer/SnippetViewerHeader.tsx b/src/components/features/snippet-viewer/SnippetViewerHeader.tsx
new file mode 100644
index 0000000..3ba2888
--- /dev/null
+++ b/src/components/features/snippet-viewer/SnippetViewerHeader.tsx
@@ -0,0 +1,95 @@
+import { Button } from '@/components/ui/button'
+import { Badge } from '@/components/ui/badge'
+import { Copy, Pencil, Check, SplitVertical } from '@phosphor-icons/react'
+import { Snippet } from '@/lib/types'
+import { cn } from '@/lib/utils'
+import { strings, LANGUAGE_COLORS } from '@/lib/config'
+
+interface SnippetViewerHeaderProps {
+ snippet: Snippet
+ isCopied: boolean
+ canPreview: boolean
+ showPreview: boolean
+ onCopy: () => void
+ onEdit: () => void
+ onTogglePreview: () => void
+}
+
+export function SnippetViewerHeader({
+ snippet,
+ isCopied,
+ canPreview,
+ showPreview,
+ onCopy,
+ onEdit,
+ onTogglePreview,
+}: SnippetViewerHeaderProps) {
+ return (
+
+
+
+
+ {snippet.title}
+
+
+ {snippet.language}
+
+
+ {snippet.description && (
+
+ {snippet.description}
+
+ )}
+
+ {strings.snippetViewer.lastUpdated}: {new Date(snippet.updatedAt).toLocaleString()}
+
+
+
+ {canPreview && (
+
+ )}
+
+
+
+
+ )
+}