diff --git a/apps/web/components/memories/memory-detail.tsx b/apps/web/components/memories/memory-detail.tsx index eeef6d89..dad2a8a3 100644 --- a/apps/web/components/memories/memory-detail.tsx +++ b/apps/web/components/memories/memory-detail.tsx @@ -11,11 +11,17 @@ import { SheetHeader, SheetTitle, } from '@repo/ui/components/sheet'; +import { + Tabs, + TabsList, + TabsTrigger, + TabsContent, +} from '@repo/ui/components/tabs'; import { colors } from '@repo/ui/memory-graph/constants'; import type { DocumentsWithMemoriesResponseSchema } from '@repo/validation/api'; import { Badge } from '@ui/components/badge'; -import { Brain, Calendar, ExternalLink, Sparkles } from 'lucide-react'; -import { memo, useState } from 'react'; +import { Brain, Calendar, CircleUserRound, ExternalLink, List, Sparkles } from 'lucide-react'; +import { memo } from 'react'; import type { z } from 'zod'; import { formatDate, getSourceUrl } from '.'; import { Label1Regular } from '@ui/text/label/label-1-regular'; @@ -159,7 +165,6 @@ export const MemoryDetail = memo( }) => { if (!document) return null; - const [isSummaryExpanded, setIsSummaryExpanded] = useState(false); const activeMemories = document.memoryEntries.filter((m) => !m.isForgotten); const forgottenMemories = document.memoryEntries.filter( (m) => m.isForgotten @@ -214,35 +219,70 @@ export const MemoryDetail = memo( ); - const SummarySection = () => { - if (!document.summary) return null; + const ContentAndSummarySection = () => { + const hasContent = document.content && document.content.trim().length > 0; + const hasSummary = document.summary && document.summary.trim().length > 0; + + if (!hasContent && !hasSummary) return null; - const shouldShowToggle = document.summary.length > 200; // Show toggle for longer summaries + const defaultTab = hasContent ? 'content' : 'summary'; return ( -
-

- {document.content} -

- {shouldShowToggle && ( - - )} + {hasContent && ( + + + Original Content + + )} + {hasSummary && ( + + + Summary + + )} + + + {hasContent && ( + +
+

+ {document.content} +

+
+
+ )} + + {hasSummary && ( + +
+

+ {document.summary} +

+
+
+ )} +
); }; @@ -260,7 +300,7 @@ export const MemoryDetail = memo( Active Memories ({activeMemories.length})
- {activeMemories.map((memory, index) => ( + {activeMemories.map((memory) => (
@@ -333,7 +373,7 @@ export const MemoryDetail = memo( - +
@@ -362,7 +402,7 @@ export const MemoryDetail = memo( - +