forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsightsSection.tsx
More file actions
164 lines (152 loc) · 4.3 KB
/
Copy pathInsightsSection.tsx
File metadata and controls
164 lines (152 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
'use client';
import { useState } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import {
HelpCircle,
Lightbulb,
ArrowRight,
MessageSquare,
ChevronDown,
} from 'lucide-react';
import { cn } from '@/lib/utils';
import type { UnresolvedQuestion, DecisionMade, KnowledgeNugget } from '@/types/recap';
const MAX_VISIBLE_ITEMS = 3;
interface InsightsSectionProps {
questions: UnresolvedQuestion[];
decisions: DecisionMade[];
learnings: KnowledgeNugget[];
onConversationClick?: (conversationId: string) => void;
}
export function InsightsSection({
questions,
decisions,
learnings,
onConversationClick,
}: InsightsSectionProps) {
const hasContent =
questions?.length > 0 || decisions?.length > 0 || learnings?.length > 0;
if (!hasContent) {
return null;
}
return (
<div className="flex gap-4">
{/* Unresolved Questions */}
<InsightColumn
title="Questions"
icon={HelpCircle}
iconColor="text-warning"
bgColor="bg-warning/5"
borderColor="border-warning/20"
items={
questions?.map((q) => ({
content: q.question,
conversationId: q.conversation_id,
})) || []
}
onConversationClick={onConversationClick}
/>
{/* Decisions Made */}
<InsightColumn
title="Decisions"
icon={ArrowRight}
iconColor="text-success"
bgColor="bg-success/5"
borderColor="border-success/20"
items={
decisions?.map((d) => ({
content: d.decision,
conversationId: d.conversation_id,
})) || []
}
onConversationClick={onConversationClick}
/>
{/* Learnings */}
<InsightColumn
title="Learnings"
icon={Lightbulb}
iconColor="text-text-primary"
bgColor="bg-white/[0.08]"
borderColor="border-white/25"
items={
learnings?.map((l) => ({
content: l.insight,
conversationId: l.conversation_id,
})) || []
}
onConversationClick={onConversationClick}
/>
</div>
);
}
interface InsightColumnProps {
title: string;
icon: React.ComponentType<{ className?: string }>;
iconColor: string;
bgColor: string;
borderColor: string;
items: Array<{ content: string; conversationId?: string }>;
onConversationClick?: (conversationId: string) => void;
}
function InsightColumn({
title,
icon: Icon,
iconColor,
bgColor,
borderColor,
items,
onConversationClick,
}: InsightColumnProps) {
// Hide empty columns
if (items.length === 0) {
return null;
}
return (
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.2 }}
className={cn(
'noise-overlay rounded-xl p-4 flex-1',
'bg-gradient-to-b from-white/[0.03] to-white/[0.01]',
'border border-white/[0.04]',
'flex flex-col min-h-[200px]',
)}
>
{/* Header */}
<div className="flex items-center gap-2 mb-3 pb-2 border-b border-white/[0.04]">
<Icon className={cn('w-4 h-4', iconColor)} />
<h4 className="text-xs font-medium text-text-secondary uppercase tracking-wider">
{title}
</h4>
</div>
{/* Items */}
<div className="space-y-2 flex-1 overflow-y-auto">
{items.map((item, idx) => (
<div
key={idx}
className={cn('p-2.5 rounded-lg', bgColor, 'border', borderColor)}
>
<div className="flex items-start justify-between gap-2">
<p className="text-sm text-text-secondary leading-relaxed flex-1">
{item.content}
</p>
{item.conversationId && (
<button
onClick={() => onConversationClick?.(item.conversationId!)}
className={cn(
'flex-shrink-0 p-1 rounded',
'text-text-tertiary hover:text-text-primary',
'hover:bg-white/[0.14] transition-colors',
)}
title="View source conversation"
>
<MessageSquare className="w-3 h-3" />
</button>
)}
</div>
</div>
))}
</div>
</motion.div>
);
}