Spaces:
Running

axeronis commited on
Commit
e0d5e1e
·
1 Parent(s): 795384e

fix: settings visibility, demo chat in bottom nav, removed TEST badge

Browse files
frontend/components/DemoChat.tsx CHANGED
@@ -8,6 +8,7 @@ import { X, Send, Bot, User, Loader2, Sparkles, MessageSquare, Wand2, Mic, FileT
8
  import { api } from '@/lib/api'
9
  import { useToast } from '@/contexts/ToastContext'
10
  import { cn } from '@/lib/utils'
 
11
 
12
  interface DemoMessage {
13
  id: string
@@ -115,7 +116,9 @@ function formatAIMessage(content: string) {
115
 
116
  export function DemoChat({ isOpen, onClose }: DemoChatProps) {
117
  const toast = useToast()
 
118
  const [messages, setMessages] = useState<DemoMessage[]>([])
 
119
  const [input, setInput] = useState('')
120
  const [isLoading, setIsLoading] = useState(false)
121
  const [corrections, setCorrections] = useState<string[]>([])
@@ -273,6 +276,11 @@ export function DemoChat({ isOpen, onClose }: DemoChatProps) {
273
 
274
  if (response.data.success) {
275
  toast.success(`✅ ${response.data.message}`)
 
 
 
 
 
276
  // Add confirmation message to chat
277
  setMessages(prev => [...prev, {
278
  id: crypto.randomUUID(),
@@ -283,6 +291,7 @@ export function DemoChat({ isOpen, onClose }: DemoChatProps) {
283
  } else {
284
  toast.error(response.data.message)
285
  }
 
286
  } catch (error) {
287
  console.error('Confirm action error:', error)
288
  toast.error('Ошибка применения настройки')
 
8
  import { api } from '@/lib/api'
9
  import { useToast } from '@/contexts/ToastContext'
10
  import { cn } from '@/lib/utils'
11
+ import { useQueryClient } from '@tanstack/react-query'
12
 
13
  interface DemoMessage {
14
  id: string
 
116
 
117
  export function DemoChat({ isOpen, onClose }: DemoChatProps) {
118
  const toast = useToast()
119
+ const queryClient = useQueryClient()
120
  const [messages, setMessages] = useState<DemoMessage[]>([])
121
+
122
  const [input, setInput] = useState('')
123
  const [isLoading, setIsLoading] = useState(false)
124
  const [corrections, setCorrections] = useState<string[]>([])
 
276
 
277
  if (response.data.success) {
278
  toast.success(`✅ ${response.data.message}`)
279
+
280
+ // Invalidate tenant cache so settings page shows new values
281
+ queryClient.invalidateQueries({ queryKey: ['tenant'] })
282
+ queryClient.invalidateQueries({ queryKey: ['ai-settings'] })
283
+
284
  // Add confirmation message to chat
285
  setMessages(prev => [...prev, {
286
  id: crypto.randomUUID(),
 
291
  } else {
292
  toast.error(response.data.message)
293
  }
294
+
295
  } catch (error) {
296
  console.error('Confirm action error:', error)
297
  toast.error('Ошибка применения настройки')
frontend/components/MobileBottomNav.tsx CHANGED
@@ -6,8 +6,10 @@ import {
6
  LayoutDashboard,
7
  MessageSquare,
8
  Calendar,
9
- Menu
 
10
  } from 'lucide-react'
 
11
  import { cn } from '@/lib/utils'
12
  import { motion, AnimatePresence } from 'framer-motion'
13
  import { useState, useEffect } from 'react'
@@ -93,6 +95,19 @@ export function MobileBottomNav() {
93
  <Calendar className="w-5 h-5" />
94
  </Link>
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  {/* Menu */}
97
  <button
98
  onClick={() => document.dispatchEvent(new CustomEvent('toggle-mobile-sidebar'))}
@@ -100,6 +115,7 @@ export function MobileBottomNav() {
100
  >
101
  <Menu className="w-5 h-5" />
102
  </button>
 
103
  </div>
104
  </motion.nav>
105
  )}
 
6
  LayoutDashboard,
7
  MessageSquare,
8
  Calendar,
9
+ Menu,
10
+ Bot
11
  } from 'lucide-react'
12
+
13
  import { cn } from '@/lib/utils'
14
  import { motion, AnimatePresence } from 'framer-motion'
15
  import { useState, useEffect } from 'react'
 
95
  <Calendar className="w-5 h-5" />
96
  </Link>
97
 
98
+ {/* Demo Chat */}
99
+ <Link
100
+ href="/demo-chat"
101
+ className={cn(
102
+ "flex flex-col items-center justify-center p-2 rounded-xl transition-all",
103
+ isActive('/demo-chat')
104
+ ? "text-purple-400 bg-purple-500/10"
105
+ : "text-slate-500 active:bg-white/5"
106
+ )}
107
+ >
108
+ <Bot className="w-5 h-5" />
109
+ </Link>
110
+
111
  {/* Menu */}
112
  <button
113
  onClick={() => document.dispatchEvent(new CustomEvent('toggle-mobile-sidebar'))}
 
115
  >
116
  <Menu className="w-5 h-5" />
117
  </button>
118
+
119
  </div>
120
  </motion.nav>
121
  )}
frontend/components/Sidebar.tsx CHANGED
@@ -216,8 +216,8 @@ export function Sidebar() {
216
  >
217
  <Bot className="w-5 h-5" />
218
  <span>Демо-чат с AI</span>
219
- <span className="ml-auto text-[10px] bg-purple-500/30 px-2 py-0.5 rounded-full">TEST</span>
220
  </Link>
 
221
  </motion.div>
222
  )}
223
 
 
216
  >
217
  <Bot className="w-5 h-5" />
218
  <span>Демо-чат с AI</span>
 
219
  </Link>
220
+
221
  </motion.div>
222
  )}
223