Spaces:
Running

axeronis commited on
Commit
149efd3
·
1 Parent(s): 8119652

feat: Visual Polish and Client Profile Info

Browse files
frontend/app/chats/page.tsx CHANGED
@@ -74,7 +74,7 @@ export default function ChatsPage() {
74
  }
75
 
76
  return (
77
- <div className="flex h-screen overflow-hidden bg-white">
78
  {/* Left Column: Leads List (Collapsible) */}
79
  <div className={`h-full border-r border-slate-200 z-20 transition-all duration-300 ease-in-out overflow-hidden ${isLeadsListOpen ? 'w-1/4 min-w-[300px] max-w-[400px]' : 'w-0 border-none'}`}>
80
  <LeadsList
 
74
  }
75
 
76
  return (
77
+ <div className="flex h-screen overflow-hidden bg-slate-100">
78
  {/* Left Column: Leads List (Collapsible) */}
79
  <div className={`h-full border-r border-slate-200 z-20 transition-all duration-300 ease-in-out overflow-hidden ${isLeadsListOpen ? 'w-1/4 min-w-[300px] max-w-[400px]' : 'w-0 border-none'}`}>
80
  <LeadsList
frontend/components/ClientCard.tsx CHANGED
@@ -8,7 +8,7 @@ import {
8
  Lightbulb, User as UserIcon, CheckCircle2, Phone, Check,
9
  Loader2, RefreshCw, Bot, Zap, Database, Shield, MessageSquare,
10
  AlertTriangle, ThumbsUp, PenTool, Copy, ChevronDown, ChevronUp,
11
- Mail, Archive, PhoneCall
12
  } from 'lucide-react'
13
  import { useToast } from '@/contexts/ToastContext'
14
  import { motion, AnimatePresence } from 'framer-motion'
@@ -80,7 +80,7 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
80
  }
81
 
82
  return (
83
- <div className="h-full flex flex-col bg-slate-50/50 font-['Inter'] border-l border-slate-200">
84
  {/* Header */}
85
  <div className="p-5 border-b border-slate-200 flex items-center justify-between bg-white sticky top-0 z-10 shadow-sm">
86
  <div className="flex items-center gap-3">
@@ -88,44 +88,47 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
88
  <Brain className="w-5 h-5" />
89
  </div>
90
  <div>
91
- <h2 className="font-bold text-slate-900 text-sm flex items-center gap-2">
92
- AI Summary
93
- <button
94
- onClick={onRefresh}
95
- className="p-1.5 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-full transition-all"
96
- title="Обновить анализ"
97
- >
98
- <RefreshCw className={cn("w-3.5 h-3.5", isAnalyzing && "animate-spin")} />
99
- </button>
100
- </h2>
101
  <p className="text-[10px] text-slate-500 font-medium">Анализ диалога</p>
102
  </div>
103
  </div>
104
 
105
- {/* Score Ring */}
106
- <div className="relative w-12 h-12 flex items-center justify-center group cursor-help">
107
- <svg className="w-full h-full transform -rotate-90">
108
- <defs>
109
- <linearGradient id="scoreGradient" x1="0%" y1="0%" x2="100%" y2="0%">
110
- <stop offset="0%" stopColor={data.heat_score >= 80 ? '#ef4444' : data.heat_score >= 50 ? '#f59e0b' : '#3b82f6'} />
111
- <stop offset="100%" stopColor={data.heat_score >= 80 ? '#f87171' : data.heat_score >= 50 ? '#fbbf24' : '#60a5fa'} />
112
- </linearGradient>
113
- </defs>
114
- <circle cx="24" cy="24" r="20" stroke="#e2e8f0" strokeWidth="4" fill="none" />
115
- <circle
116
- cx="24" cy="24" r="20"
117
- stroke="url(#scoreGradient)"
118
- strokeWidth="4"
119
- fill="none"
120
- strokeDasharray={126}
121
- strokeDashoffset={126 - (data.heat_score / 100) * 126}
122
- className="transition-all duration-1000 ease-out"
123
- strokeLinecap="round"
124
- />
125
- </svg>
126
- <span className={cn("absolute text-xs font-bold", getScoreColor(data.heat_score))}>
127
- {data.heat_score}
128
- </span>
 
 
 
 
 
 
 
 
 
 
 
 
129
  </div>
130
  </div>
131
 
@@ -148,6 +151,36 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
148
  </button>
149
  </div>
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  {/* Key Metrics Grid */}
152
  <div className="bg-white rounded-xl border border-slate-200 shadow-sm p-4 space-y-3">
153
  <h3 className="text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2">Ключевые данные</h3>
 
8
  Lightbulb, User as UserIcon, CheckCircle2, Phone, Check,
9
  Loader2, RefreshCw, Bot, Zap, Database, Shield, MessageSquare,
10
  AlertTriangle, ThumbsUp, PenTool, Copy, ChevronDown, ChevronUp,
11
+ Mail, Archive, PhoneCall, MapPin, Briefcase
12
  } from 'lucide-react'
13
  import { useToast } from '@/contexts/ToastContext'
14
  import { motion, AnimatePresence } from 'framer-motion'
 
80
  }
81
 
82
  return (
83
+ <div className="h-full flex flex-col bg-slate-100 font-['Inter'] border-l border-slate-200">
84
  {/* Header */}
85
  <div className="p-5 border-b border-slate-200 flex items-center justify-between bg-white sticky top-0 z-10 shadow-sm">
86
  <div className="flex items-center gap-3">
 
88
  <Brain className="w-5 h-5" />
89
  </div>
90
  <div>
91
+ <h2 className="font-bold text-slate-900 text-sm">AI Summary</h2>
 
 
 
 
 
 
 
 
 
92
  <p className="text-[10px] text-slate-500 font-medium">Анализ диалога</p>
93
  </div>
94
  </div>
95
 
96
+ <div className="flex items-center gap-3">
97
+ {/* Refresh Button */}
98
+ <button
99
+ onClick={onRefresh}
100
+ disabled={isAnalyzing}
101
+ className="flex items-center gap-1.5 px-3 py-1.5 bg-white border border-slate-200 rounded-lg text-[10px] font-bold text-slate-600 hover:text-indigo-600 hover:border-indigo-200 hover:bg-indigo-50 transition-all shadow-sm active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed"
102
+ >
103
+ <RefreshCw className={cn("w-3 h-3", isAnalyzing && "animate-spin")} />
104
+ <span>Обновить</span>
105
+ </button>
106
+
107
+ {/* Score Ring */}
108
+ <div className="relative w-12 h-12 flex items-center justify-center group cursor-help">
109
+ <svg className="w-full h-full transform -rotate-90">
110
+ <defs>
111
+ <linearGradient id="scoreGradient" x1="0%" y1="0%" x2="100%" y2="0%">
112
+ <stop offset="0%" stopColor={data.heat_score >= 80 ? '#ef4444' : data.heat_score >= 50 ? '#f59e0b' : '#3b82f6'} />
113
+ <stop offset="100%" stopColor={data.heat_score >= 80 ? '#f87171' : data.heat_score >= 50 ? '#fbbf24' : '#60a5fa'} />
114
+ </linearGradient>
115
+ </defs>
116
+ <circle cx="24" cy="24" r="20" stroke="#e2e8f0" strokeWidth="4" fill="none" />
117
+ <circle
118
+ cx="24" cy="24" r="20"
119
+ stroke="url(#scoreGradient)"
120
+ strokeWidth="4"
121
+ fill="none"
122
+ strokeDasharray={126}
123
+ strokeDashoffset={126 - (data.heat_score / 100) * 126}
124
+ className="transition-all duration-1000 ease-out"
125
+ strokeLinecap="round"
126
+ />
127
+ </svg>
128
+ <span className={cn("absolute text-xs font-bold", getScoreColor(data.heat_score))}>
129
+ {data.heat_score}
130
+ </span>
131
+ </div>
132
  </div>
133
  </div>
134
 
 
151
  </button>
152
  </div>
153
 
154
+ {/* Profile Info */}
155
+ <div className="bg-white rounded-xl border border-slate-200 shadow-sm p-4 space-y-3">
156
+ <h3 className="text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2">Профиль клиента</h3>
157
+ <div className="space-y-2">
158
+ <div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
159
+ <div className="flex items-center gap-2">
160
+ <UserIcon className="w-3.5 h-3.5 text-slate-400" />
161
+ <span className="text-xs font-medium text-slate-600">Имя</span>
162
+ </div>
163
+ <span className="text-xs font-bold text-slate-900">{lead.name || 'Не указано'}</span>
164
+ </div>
165
+
166
+ <div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
167
+ <div className="flex items-center gap-2">
168
+ <MapPin className="w-3.5 h-3.5 text-slate-400" />
169
+ <span className="text-xs font-medium text-slate-600">Локация</span>
170
+ </div>
171
+ <span className="text-xs font-bold text-slate-900">{cleanValue(summary.location, 'Не определено')}</span>
172
+ </div>
173
+
174
+ <div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
175
+ <div className="flex items-center gap-2">
176
+ <Briefcase className="w-3.5 h-3.5 text-slate-400" />
177
+ <span className="text-xs font-medium text-slate-600">Сфера</span>
178
+ </div>
179
+ <span className="text-xs font-bold text-slate-900">{cleanValue(summary.industry, 'Не определено')}</span>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
  {/* Key Metrics Grid */}
185
  <div className="bg-white rounded-xl border border-slate-200 shadow-sm p-4 space-y-3">
186
  <h3 className="text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2">Ключевые данные</h3>
frontend/lib/api.ts CHANGED
@@ -60,6 +60,8 @@ export interface Lead {
60
  budget?: string
61
  timeline?: string
62
  authority?: string
 
 
63
  // Soft Data
64
  pain_points?: string[]
65
  psychotype?: string
@@ -262,20 +264,20 @@ export const channelsApi = {
262
  const response = await api.delete('/api/v1/channels/linkedin/disconnect')
263
  return response.data
264
  },
265
-
266
  // WhatsApp QR (Grey API)
267
  generateWhatsAppQR: async () => {
268
  console.log('🔍 Sending WhatsApp QR request...')
269
  const response = await api.post('/api/v1/channels/whatsapp/qr/generate')
270
- console.log('✅ WhatsApp QR response:', response.data)
271
  return response.data
272
  },
273
-
274
  getWhatsAppQRStatus: async () => {
275
  const response = await api.get('/api/v1/channels/whatsapp/qr/status')
276
  return response.data
277
  },
278
-
279
  disconnectWhatsAppQR: async () => {
280
  const response = await api.post('/api/v1/channels/whatsapp/qr/disconnect')
281
  return response.data
 
60
  budget?: string
61
  timeline?: string
62
  authority?: string
63
+ location?: string
64
+ industry?: string
65
  // Soft Data
66
  pain_points?: string[]
67
  psychotype?: string
 
264
  const response = await api.delete('/api/v1/channels/linkedin/disconnect')
265
  return response.data
266
  },
267
+
268
  // WhatsApp QR (Grey API)
269
  generateWhatsAppQR: async () => {
270
  console.log('🔍 Sending WhatsApp QR request...')
271
  const response = await api.post('/api/v1/channels/whatsapp/qr/generate')
272
+ console.log('✅ WhatsApp QR response:', response.data)
273
  return response.data
274
  },
275
+
276
  getWhatsAppQRStatus: async () => {
277
  const response = await api.get('/api/v1/channels/whatsapp/qr/status')
278
  return response.data
279
  },
280
+
281
  disconnectWhatsAppQR: async () => {
282
  const response = await api.post('/api/v1/channels/whatsapp/qr/disconnect')
283
  return response.data