Spaces:
Running

axeronis commited on
Commit
e4e4689
·
1 Parent(s): c6e35bb

fix: AI Brain cards now use Link with real hrefs, removed mock stats

Browse files
frontend/app/settings/brain/catalog/page.tsx DELETED
@@ -1,7 +0,0 @@
1
- 'use client'
2
-
3
- import { redirect } from 'next/navigation'
4
-
5
- export default function CatalogPage() {
6
- redirect('/settings/brain?tab=catalog')
7
- }
 
 
 
 
 
 
 
 
frontend/app/settings/brain/config/page.tsx DELETED
@@ -1,7 +0,0 @@
1
- 'use client'
2
-
3
- import { redirect } from 'next/navigation'
4
-
5
- export default function ConfigPage() {
6
- redirect('/settings/brain?tab=config')
7
- }
 
 
 
 
 
 
 
 
frontend/app/settings/brain/knowledge/page.tsx DELETED
@@ -1,8 +0,0 @@
1
- 'use client'
2
-
3
- import { redirect } from 'next/navigation'
4
-
5
- // Knowledge sub-page - redirect to main brain page with knowledge tab
6
- export default function KnowledgePage() {
7
- redirect('/settings/brain?tab=knowledge')
8
- }
 
 
 
 
 
 
 
 
 
frontend/app/settings/brain/page.tsx CHANGED
@@ -2,60 +2,56 @@
2
 
3
  import { useState, useEffect } from 'react'
4
  import { useAuth } from '@/contexts/AuthContext'
5
- import { useRouter } from 'next/navigation'
6
  import {
7
  Brain, BookOpen, Users, Shield, Settings, Calendar, ShoppingBag,
8
- Loader2, ChevronRight, BarChart3
9
  } from 'lucide-react'
10
  import { motion } from 'framer-motion'
11
  import { cn } from '@/lib/utils'
12
- import { api } from '@/lib/api'
13
- import {
14
- AreaChart, Area, BarChart, Bar, ResponsiveContainer, XAxis, YAxis, Tooltip
15
- } from 'recharts'
16
 
17
- // Card data for the grid
18
  const BRAIN_CARDS = [
19
  {
20
  id: 'knowledge',
21
  title: 'База знаний',
22
- description: 'База знаний патник для личества не тисуператиня.',
23
  icon: BookOpen,
24
  gradient: 'from-pink-500 via-rose-500 to-purple-600',
25
  action: 'Открыть',
26
- href: '/settings/brain/knowledge'
27
  },
28
  {
29
  id: 'persona',
30
  title: 'Личность',
31
- description: 'Персона (рекипект): комонсжыве личности персона.',
32
  icon: Users,
33
  gradient: 'from-violet-500 via-purple-500 to-indigo-600',
34
  action: 'Открыть',
35
- href: '/settings/brain/persona'
36
  },
37
  {
38
  id: 'rules',
39
  title: 'Правила',
40
- description: 'Правила свеполиты и аставшим зефилюция.',
41
  icon: Shield,
42
  gradient: 'from-slate-600 via-slate-500 to-zinc-600',
43
  action: 'Настроить',
44
- href: '/settings/brain/rules'
45
  },
46
  {
47
  id: 'settings',
48
  title: 'Настройка',
49
- description: 'Настройка и опюожка для поскочных ивентов.',
50
  icon: Settings,
51
  gradient: 'from-amber-400 via-orange-400 to-yellow-500',
52
  action: 'Настроить',
53
- href: '/settings/brain/config'
54
  },
55
  {
56
  id: 'booking',
57
  title: 'Записи',
58
- description: 'Записи и записе ликации и долмении ресогов.',
59
  icon: Calendar,
60
  gradient: 'from-emerald-400 via-green-400 to-teal-500',
61
  action: 'Открыть',
@@ -64,38 +60,16 @@ const BRAIN_CARDS = [
64
  {
65
  id: 'catalog',
66
  title: 'Каталог',
67
- description: 'Каталог истконс-олочестии киртных пощенох каталога.',
68
  icon: ShoppingBag,
69
  gradient: 'from-cyan-400 via-sky-400 to-blue-500',
70
  action: 'Открыть',
71
- href: '/settings/brain/catalog'
72
  }
73
  ]
74
 
75
- // Mock data for charts
76
- const activityData = [
77
- { name: 'Пн', value: 40 },
78
- { name: 'Вт', value: 65 },
79
- { name: 'Ср', value: 55 },
80
- { name: 'Чт', value: 80 },
81
- { name: 'Пт', value: 70 },
82
- { name: 'Сб', value: 45 },
83
- { name: 'Вс', value: 30 }
84
- ]
85
-
86
- const usageData = [
87
- { name: 'Пн', value: 120 },
88
- { name: 'Вт', value: 180 },
89
- { name: 'Ср', value: 150 },
90
- { name: 'Чт', value: 200 },
91
- { name: 'Пт', value: 170 },
92
- { name: 'Сб', value: 90 },
93
- { name: 'Вс', value: 60 }
94
- ]
95
-
96
  export default function BrainSettingsPage() {
97
  const { user } = useAuth()
98
- const router = useRouter()
99
  const [loading, setLoading] = useState(true)
100
 
101
  useEffect(() => {
@@ -122,6 +96,7 @@ export default function BrainSettingsPage() {
122
  className="mb-8"
123
  >
124
  <h1 className="text-3xl font-bold text-white mb-2">ИИ Мозг</h1>
 
125
  </motion.div>
126
 
127
  {/* Main Grid */}
@@ -136,57 +111,47 @@ export default function BrainSettingsPage() {
136
  initial={{ opacity: 0, y: 20 }}
137
  animate={{ opacity: 1, y: 0 }}
138
  transition={{ delay: index * 0.1 }}
139
- className={cn(
140
- "group relative rounded-3xl overflow-hidden cursor-pointer",
141
- "bg-gradient-to-br",
142
- card.gradient
143
- )}
144
- onClick={() => router.push(card.href)}
145
  >
146
- {/* Card overlay for depth */}
147
- <div className="absolute inset-0 bg-black/10" />
148
-
149
- {/* Menu dots */}
150
- <button
151
- className="absolute top-4 right-4 z-10 text-white/60 hover:text-white transition-colors"
152
- onClick={(e) => e.stopPropagation()}
153
  >
154
- <div className="flex flex-col gap-0.5">
155
- <div className="w-1 h-1 bg-current rounded-full" />
156
- <div className="w-1 h-1 bg-current rounded-full" />
157
- <div className="w-1 h-1 bg-current rounded-full" />
158
- </div>
159
- </button>
160
-
161
- {/* Content */}
162
- <div className="relative z-10 p-6 flex flex-col h-[220px]">
163
- {/* Icon */}
164
- <div className="w-14 h-14 rounded-2xl bg-white/20 backdrop-blur-sm flex items-center justify-center mb-4">
165
- <Icon className="w-7 h-7 text-white" />
 
 
 
 
 
 
 
 
 
 
 
166
  </div>
167
-
168
- {/* Text */}
169
- <h3 className="text-xl font-bold text-white mb-2">
170
- {card.title}
171
- </h3>
172
- <p className="text-sm text-white/70 line-clamp-2 flex-1">
173
- {card.description}
174
- </p>
175
-
176
- {/* Action Button */}
177
- <button className="mt-4 w-full py-2.5 rounded-xl bg-white/20 hover:bg-white/30 backdrop-blur-sm text-white font-semibold text-sm transition-all flex items-center justify-center gap-2 border border-white/10">
178
- {card.action}
179
- <ChevronRight className="w-4 h-4 opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0 transition-all" />
180
- </button>
181
- </div>
182
  </motion.div>
183
  )
184
  })}
185
  </div>
186
 
187
- {/* Statistics Panel */}
188
  <div className="space-y-6">
189
- {/* AI Stats Card */}
190
  <motion.div
191
  initial={{ opacity: 0, x: 20 }}
192
  animate={{ opacity: 1, x: 0 }}
@@ -194,78 +159,57 @@ export default function BrainSettingsPage() {
194
  className="bg-surface-elevated rounded-2xl border border-white/10 p-6"
195
  >
196
  <h3 className="text-sm font-bold text-slate-400 uppercase tracking-wider mb-6">
197
- Статистика ИИ
198
  </h3>
199
 
200
- {/* Activity Chart */}
201
- <div className="mb-6">
202
- <p className="text-xs text-slate-500 mb-3">Активность</p>
203
- <div className="h-[100px]">
204
- <ResponsiveContainer width="100%" height="100%">
205
- <AreaChart data={activityData}>
206
- <defs>
207
- <linearGradient id="colorActivity" x1="0" y1="0" x2="0" y2="1">
208
- <stop offset="5%" stopColor="#8b5cf6" stopOpacity={0.3} />
209
- <stop offset="95%" stopColor="#8b5cf6" stopOpacity={0} />
210
- </linearGradient>
211
- </defs>
212
- <Area
213
- type="monotone"
214
- dataKey="value"
215
- stroke="#8b5cf6"
216
- strokeWidth={2}
217
- fill="url(#colorActivity)"
218
- />
219
- <XAxis
220
- dataKey="name"
221
- axisLine={false}
222
- tickLine={false}
223
- tick={{ fill: '#64748b', fontSize: 10 }}
224
- />
225
- </AreaChart>
226
- </ResponsiveContainer>
227
- </div>
228
- </div>
229
 
230
- {/* Usage Bar Chart */}
231
- <div className="mb-6">
232
- <p className="text-xs text-slate-500 mb-3">Статистика ИИ ИИ</p>
233
- <div className="h-[100px]">
234
- <ResponsiveContainer width="100%" height="100%">
235
- <BarChart data={usageData}>
236
- <Bar
237
- dataKey="value"
238
- fill="url(#barGradient)"
239
- radius={[2, 2, 0, 0]}
240
- />
241
- <defs>
242
- <linearGradient id="barGradient" x1="0" y1="0" x2="0" y2="1">
243
- <stop offset="0%" stopColor="#10b981" />
244
- <stop offset="100%" stopColor="#6366f1" />
245
- </linearGradient>
246
- </defs>
247
- <XAxis
248
- dataKey="name"
249
- axisLine={false}
250
- tickLine={false}
251
- tick={{ fill: '#64748b', fontSize: 10 }}
252
- />
253
- </BarChart>
254
- </ResponsiveContainer>
255
- </div>
256
- </div>
257
 
258
- {/* Usage Log */}
259
- <div className="pt-4 border-t border-white/10">
260
- <p className="text-xs text-slate-500 mb-3">Использование лог</p>
261
- <div className="space-y-2">
262
- {[1, 2, 3].map((i) => (
263
- <div key={i} className="flex items-center justify-between text-sm">
264
- <span className="text-slate-400">Использование {i}</span>
265
- <span className="text-slate-300 font-medium">3 часла</span>
266
- </div>
267
- ))}
268
- </div>
 
 
 
 
269
  </div>
270
  </motion.div>
271
  </div>
 
2
 
3
  import { useState, useEffect } from 'react'
4
  import { useAuth } from '@/contexts/AuthContext'
5
+ import Link from 'next/link'
6
  import {
7
  Brain, BookOpen, Users, Shield, Settings, Calendar, ShoppingBag,
8
+ Loader2, ChevronRight, MessageSquare, Zap
9
  } from 'lucide-react'
10
  import { motion } from 'framer-motion'
11
  import { cn } from '@/lib/utils'
 
 
 
 
12
 
13
+ // Card data for the grid - теперь с реальными ссылками
14
  const BRAIN_CARDS = [
15
  {
16
  id: 'knowledge',
17
  title: 'База знаний',
18
+ description: 'Загружайте документы, FAQ, скрипты продаж — AI изучит и будет использовать.',
19
  icon: BookOpen,
20
  gradient: 'from-pink-500 via-rose-500 to-purple-600',
21
  action: 'Открыть',
22
+ href: '/knowledge'
23
  },
24
  {
25
  id: 'persona',
26
  title: 'Личность',
27
+ description: 'Настройте персону AI: имя, тон общения, стиль продаж.',
28
  icon: Users,
29
  gradient: 'from-violet-500 via-purple-500 to-indigo-600',
30
  action: 'Открыть',
31
+ href: '/settings/playbook'
32
  },
33
  {
34
  id: 'rules',
35
  title: 'Правила',
36
+ description: 'Запрещённые слова, ограничения, политики общения AI.',
37
  icon: Shield,
38
  gradient: 'from-slate-600 via-slate-500 to-zinc-600',
39
  action: 'Настроить',
40
+ href: '/settings/playbook'
41
  },
42
  {
43
  id: 'settings',
44
  title: 'Настройка',
45
+ description: 'Общие настройки AI: методология продаж, бизнес-модель.',
46
  icon: Settings,
47
  gradient: 'from-amber-400 via-orange-400 to-yellow-500',
48
  action: 'Настроить',
49
+ href: '/settings'
50
  },
51
  {
52
  id: 'booking',
53
  title: 'Записи',
54
+ description: 'Календарь записей и встреч с клиентами.',
55
  icon: Calendar,
56
  gradient: 'from-emerald-400 via-green-400 to-teal-500',
57
  action: 'Открыть',
 
60
  {
61
  id: 'catalog',
62
  title: 'Каталог',
63
+ description: 'Товары и услуги — AI будет предлагать их клиентам.',
64
  icon: ShoppingBag,
65
  gradient: 'from-cyan-400 via-sky-400 to-blue-500',
66
  action: 'Открыть',
67
+ href: '/settings/products'
68
  }
69
  ]
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  export default function BrainSettingsPage() {
72
  const { user } = useAuth()
 
73
  const [loading, setLoading] = useState(true)
74
 
75
  useEffect(() => {
 
96
  className="mb-8"
97
  >
98
  <h1 className="text-3xl font-bold text-white mb-2">ИИ Мозг</h1>
99
+ <p className="text-slate-400">Центр управления интеллектом вашего AI-ассистента</p>
100
  </motion.div>
101
 
102
  {/* Main Grid */}
 
111
  initial={{ opacity: 0, y: 20 }}
112
  animate={{ opacity: 1, y: 0 }}
113
  transition={{ delay: index * 0.1 }}
 
 
 
 
 
 
114
  >
115
+ <Link
116
+ href={card.href}
117
+ className={cn(
118
+ "group relative rounded-3xl overflow-hidden block",
119
+ "bg-gradient-to-br",
120
+ card.gradient
121
+ )}
122
  >
123
+ {/* Card overlay for depth */}
124
+ <div className="absolute inset-0 bg-black/10" />
125
+
126
+ {/* Content */}
127
+ <div className="relative z-10 p-6 flex flex-col h-[220px]">
128
+ {/* Icon */}
129
+ <div className="w-14 h-14 rounded-2xl bg-white/20 backdrop-blur-sm flex items-center justify-center mb-4">
130
+ <Icon className="w-7 h-7 text-white" />
131
+ </div>
132
+
133
+ {/* Text */}
134
+ <h3 className="text-xl font-bold text-white mb-2">
135
+ {card.title}
136
+ </h3>
137
+ <p className="text-sm text-white/70 line-clamp-2 flex-1">
138
+ {card.description}
139
+ </p>
140
+
141
+ {/* Action Button */}
142
+ <div className="mt-4 w-full py-2.5 rounded-xl bg-white/20 hover:bg-white/30 backdrop-blur-sm text-white font-semibold text-sm transition-all flex items-center justify-center gap-2 border border-white/10 group-hover:bg-white/30">
143
+ {card.action}
144
+ <ChevronRight className="w-4 h-4 opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0 transition-all" />
145
+ </div>
146
  </div>
147
+ </Link>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  </motion.div>
149
  )
150
  })}
151
  </div>
152
 
153
+ {/* Quick Stats Panel */}
154
  <div className="space-y-6">
 
155
  <motion.div
156
  initial={{ opacity: 0, x: 20 }}
157
  animate={{ opacity: 1, x: 0 }}
 
159
  className="bg-surface-elevated rounded-2xl border border-white/10 p-6"
160
  >
161
  <h3 className="text-sm font-bold text-slate-400 uppercase tracking-wider mb-6">
162
+ Быстрые действия
163
  </h3>
164
 
165
+ <div className="space-y-3">
166
+ <Link
167
+ href="/chats"
168
+ className="flex items-center gap-3 p-3 rounded-xl bg-white/5 hover:bg-white/10 border border-white/5 transition-all group"
169
+ >
170
+ <div className="w-10 h-10 rounded-lg bg-indigo-500/20 flex items-center justify-center">
171
+ <MessageSquare className="w-5 h-5 text-indigo-400" />
172
+ </div>
173
+ <div className="flex-1">
174
+ <p className="text-sm font-medium text-white group-hover:text-indigo-300 transition-colors">
175
+ Открыть диалоги
176
+ </p>
177
+ <p className="text-xs text-slate-500">Чаты с клиентами</p>
178
+ </div>
179
+ <ChevronRight className="w-4 h-4 text-slate-500 group-hover:text-white transition-colors" />
180
+ </Link>
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
+ <Link
183
+ href="/dashboard"
184
+ className="flex items-center gap-3 p-3 rounded-xl bg-white/5 hover:bg-white/10 border border-white/5 transition-all group"
185
+ >
186
+ <div className="w-10 h-10 rounded-lg bg-emerald-500/20 flex items-center justify-center">
187
+ <Zap className="w-5 h-5 text-emerald-400" />
188
+ </div>
189
+ <div className="flex-1">
190
+ <p className="text-sm font-medium text-white group-hover:text-emerald-300 transition-colors">
191
+ Аналитика
192
+ </p>
193
+ <p className="text-xs text-slate-500">Статистика AI</p>
194
+ </div>
195
+ <ChevronRight className="w-4 h-4 text-slate-500 group-hover:text-white transition-colors" />
196
+ </Link>
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
+ <Link
199
+ href="/channels"
200
+ className="flex items-center gap-3 p-3 rounded-xl bg-white/5 hover:bg-white/10 border border-white/5 transition-all group"
201
+ >
202
+ <div className="w-10 h-10 rounded-lg bg-purple-500/20 flex items-center justify-center">
203
+ <Brain className="w-5 h-5 text-purple-400" />
204
+ </div>
205
+ <div className="flex-1">
206
+ <p className="text-sm font-medium text-white group-hover:text-purple-300 transition-colors">
207
+ Подключения
208
+ </p>
209
+ <p className="text-xs text-slate-500">WhatsApp, Telegram</p>
210
+ </div>
211
+ <ChevronRight className="w-4 h-4 text-slate-500 group-hover:text-white transition-colors" />
212
+ </Link>
213
  </div>
214
  </motion.div>
215
  </div>
frontend/app/settings/brain/persona/page.tsx DELETED
@@ -1,7 +0,0 @@
1
- 'use client'
2
-
3
- import { redirect } from 'next/navigation'
4
-
5
- export default function PersonaPage() {
6
- redirect('/settings/brain?tab=persona')
7
- }
 
 
 
 
 
 
 
 
frontend/app/settings/brain/rules/page.tsx DELETED
@@ -1,7 +0,0 @@
1
- 'use client'
2
-
3
- import { redirect } from 'next/navigation'
4
-
5
- export default function RulesPage() {
6
- redirect('/settings/brain?tab=rules')
7
- }