Spaces:
Running

axeronis commited on
Commit
dca4b49
·
1 Parent(s): ad5bcf6

feat(ui): refine mobile gradient transparency and voice message UX

Browse files
frontend/components/ChatWindow.tsx CHANGED
@@ -406,12 +406,10 @@ export function ChatWindow({
406
  onTrainAI={handleTrainAI}
407
  />
408
 
409
- {/* Messages Area - pt-16 to clear sticky header, pb-4 to add some air before input */}
410
  <div
411
- className="flex-1 overflow-y-auto px-4 md:px-6 space-y-6 scrollbar-thin scrollbar-thumb-white/10"
412
  style={{
413
- willChange: 'transform',
414
- transform: 'translateZ(0)',
415
  WebkitOverflowScrolling: 'touch'
416
  }}
417
  >
 
406
  onTrainAI={handleTrainAI}
407
  />
408
 
409
+ {/* Messages Area */}
410
  <div
411
+ className="flex-1 overflow-y-auto px-4 md:px-6 space-y-6 scrollbar-thin scrollbar-thumb-white/10 overscroll-contain"
412
  style={{
 
 
413
  WebkitOverflowScrolling: 'touch'
414
  }}
415
  >
frontend/components/ChatWindow/ChatHeader.tsx CHANGED
@@ -33,9 +33,9 @@ export function ChatHeader({
33
  onTrainAI,
34
  }: ChatHeaderProps) {
35
  return (
36
- <div className="h-[52px] md:h-16 shrink-0 flex items-center justify-between px-3 md:px-6 relative z-[50] border-b border-white/5 bg-[#0D0E18]/40 backdrop-blur-2xl backdrop-saturate-[2]">
37
  {/* Aurora Background Atmosphere - Synced */}
38
- <div className="absolute inset-0 pointer-events-none overflow-hidden -z-10 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 opacity-40" />
39
 
40
  {/* Left: Lead Info */}
41
  <div className="flex items-center gap-2 md:gap-3 overflow-hidden">
@@ -87,34 +87,34 @@ export function ChatHeader({
87
  </button>
88
 
89
  {/* AI Toggle Switch - PREMIUM REDESIGN */}
90
- <div className="flex items-center gap-2 scale-90 sm:scale-100">
91
  <button
92
  onClick={onToggleAI}
93
  disabled={isTogglingAI}
94
  className={cn(
95
- "relative w-9 h-5 rounded-full transition-all duration-500 flex-shrink-0 group overflow-hidden border",
96
  isAIActive
97
- ? "bg-indigo-600/20 border-indigo-500/40 shadow-[inset_0_0_8px_rgba(99,102,241,0.1)]"
98
- : "bg-white/5 border-white/10 shadow-[inner_0_1px_2px_rgba(0,0,0,0.3)]",
99
  isTogglingAI && "opacity-80"
100
  )}
101
  title={isAIActive ? 'AI Активен' : 'AI Отключен'}
102
  >
103
  <motion.div
104
  animate={{
105
- x: isAIActive ? 18 : 3,
106
  scale: isTogglingAI ? 0.85 : 1,
107
  }}
108
  transition={{ type: "spring", stiffness: 450, damping: 25 }}
109
  className={cn(
110
- "absolute top-0.5 w-3.5 h-3.5 rounded-full flex items-center justify-center transition-all duration-300 z-10",
111
  isAIActive
112
- ? "bg-white shadow-[0_0_8px_rgba(255,255,255,0.4)]"
113
- : "bg-slate-400"
114
  )}
115
  >
116
  {isTogglingAI && (
117
- <Loader2 className="w-2 h-2 animate-spin text-indigo-500" />
118
  )}
119
  </motion.div>
120
  </button>
 
33
  onTrainAI,
34
  }: ChatHeaderProps) {
35
  return (
36
+ <div className="h-[52px] md:h-16 shrink-0 flex items-center justify-between px-3 md:px-6 relative z-[50] bg-transparent">
37
  {/* Aurora Background Atmosphere - Synced */}
38
+ <div className="absolute inset-0 pointer-events-none overflow-hidden -z-10 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 opacity-40 blur-xl" />
39
 
40
  {/* Left: Lead Info */}
41
  <div className="flex items-center gap-2 md:gap-3 overflow-hidden">
 
87
  </button>
88
 
89
  {/* AI Toggle Switch - PREMIUM REDESIGN */}
90
+ <div className="flex items-center gap-2 scale-95 sm:scale-100">
91
  <button
92
  onClick={onToggleAI}
93
  disabled={isTogglingAI}
94
  className={cn(
95
+ "relative w-10 h-6 rounded-full transition-all duration-500 flex-shrink-0 group overflow-hidden border",
96
  isAIActive
97
+ ? "bg-indigo-600/30 border-indigo-500/50 shadow-[0_0_15px_rgba(99,102,241,0.2)]"
98
+ : "bg-white/5 border-white/10",
99
  isTogglingAI && "opacity-80"
100
  )}
101
  title={isAIActive ? 'AI Активен' : 'AI Отключен'}
102
  >
103
  <motion.div
104
  animate={{
105
+ x: isAIActive ? 20 : 4,
106
  scale: isTogglingAI ? 0.85 : 1,
107
  }}
108
  transition={{ type: "spring", stiffness: 450, damping: 25 }}
109
  className={cn(
110
+ "absolute top-1 w-4 h-4 rounded-full flex items-center justify-center transition-all duration-300 z-10",
111
  isAIActive
112
+ ? "bg-white shadow-[0_0_10px_rgba(255,255,255,0.5)]"
113
+ : "bg-slate-500"
114
  )}
115
  >
116
  {isTogglingAI && (
117
+ <Loader2 className="w-2.5 h-2.5 animate-spin text-indigo-500" />
118
  )}
119
  </motion.div>
120
  </button>
frontend/components/ChatWindow/MessageInput.tsx CHANGED
@@ -133,68 +133,83 @@ export function MessageInput({
133
  }
134
 
135
  return (
136
- <div className="px-2 sm:px-3 pb-2 pt-2 bg-[#0D0E18]/70 backdrop-blur-3xl flex-shrink-0 relative z-30">
137
  <div className="max-w-4xl mx-auto relative">
138
  {/* File Preview */}
139
  {selectedFile && (
140
- <div className="mb-2 p-2 bg-surface-elevated rounded-lg border border-white/10 flex items-center gap-2 w-fit max-w-[calc(100%-20px)]">
 
 
 
 
141
  <Paperclip className="w-4 h-4 text-indigo-400 shrink-0" />
142
  <span className="text-xs text-white truncate">{selectedFile.name}</span>
143
  <button onClick={() => setSelectedFile(null)} className="p-1 hover:bg-white/10 rounded-full">
144
  <X className="w-3 h-3 text-slate-400" />
145
  </button>
146
- </div>
147
  )}
148
 
149
  {/* Audio Preview */}
150
  {pendingAudio && !isRecording && (
151
- <div className="mb-2 p-2 bg-surface-elevated rounded-lg border border-indigo-500/30 flex items-center gap-2 w-fit">
 
 
 
 
152
  <button
153
  onClick={toggleAudioPreview}
154
  className="w-8 h-8 rounded-full bg-indigo-500/20 flex items-center justify-center text-indigo-400 hover:bg-indigo-500/30"
155
  >
156
  {isPlayingPreview ? <Pause className="w-4 h-4" /> : <Play className="w-4 h-4 ml-0.5" />}
157
  </button>
158
- <span className="text-xs text-indigo-300">🎤 Голосовое сообщение</span>
159
  <button onClick={clearPendingAudio} className="p-1 hover:bg-white/10 rounded-full">
160
  <X className="w-3 h-3 text-slate-400" />
161
  </button>
162
- </div>
163
  )}
164
 
165
  {/* Audio Recording UI */}
166
  {isRecording && (
167
- <div className="absolute inset-0 bg-surface-elevated rounded-2xl border border-red-500/50 flex items-center justify-between px-4 z-10">
168
- <div className="flex items-center gap-2 text-red-400">
169
- <div className="w-2 h-2 rounded-full bg-red-500 animate-pulse" />
170
- <span className="text-sm font-medium">Запись...</span>
 
 
 
 
 
 
 
 
 
171
  </div>
172
- <div className="flex items-center gap-2">
173
- {/* Cancel Button */}
174
  <button
175
  type="button"
176
  onClick={cancelRecording}
177
- className="p-2 bg-slate-500/20 text-slate-400 rounded-full hover:bg-slate-500/30 transition-colors"
178
- title="Отменить запись"
179
  >
180
  <X className="w-5 h-5" />
181
  </button>
182
- {/* Send Button */}
183
  <button
184
  type="button"
185
  onClick={stopRecording}
186
- className="p-2 bg-red-500/20 text-red-500 rounded-full hover:bg-red-500/30 transition-colors"
187
- title="Отправить голосовое"
188
  >
189
  <Send className="w-5 h-5" />
190
  </button>
191
  </div>
192
- </div>
193
  )}
194
 
195
  <form
196
  onSubmit={handleSubmit}
197
- className="flex items-center gap-2 px-1.5 py-1 transition-all"
198
  >
199
  <input
200
  type="file"
@@ -204,13 +219,13 @@ export function MessageInput({
204
  accept="image/*,.pdf,.txt,.doc,.docx"
205
  />
206
 
207
- <div className="flex items-center gap-0.5">
208
  <button
209
  type="button"
210
  onClick={() => fileInputRef.current?.click()}
211
  className={cn(
212
- "p-2 rounded-full transition-all active:scale-90",
213
- selectedFile ? "text-indigo-400 bg-indigo-500/10" : "text-slate-400/80 hover:text-white"
214
  )}
215
  >
216
  <Paperclip className="w-5 h-5" />
@@ -220,8 +235,8 @@ export function MessageInput({
220
  type="button"
221
  onClick={startRecording}
222
  className={cn(
223
- "p-2 rounded-full transition-all active:scale-90",
224
- isRecording ? "text-red-500 bg-red-500/10 animate-pulse" : "text-slate-400/80 hover:text-white"
225
  )}
226
  disabled={!!selectedFile}
227
  >
@@ -233,8 +248,8 @@ export function MessageInput({
233
  value={value}
234
  onChange={(e) => onChange(e.target.value)}
235
  onKeyDown={handleKeyDown}
236
- placeholder="Сообщение..."
237
- className="flex-1 bg-white/5 border border-white/5 rounded-2xl focus:ring-1 focus:ring-white/10 resize-none max-h-24 sm:max-h-32 py-2.5 sm:py-3 px-3 sm:px-4 text-[16px] leading-tight text-white placeholder:text-slate-500/60 overflow-y-auto transition-all"
238
  rows={1}
239
  style={{ minHeight: '44px' }}
240
  disabled={disabled || isRecording}
@@ -244,30 +259,30 @@ export function MessageInput({
244
  type="submit"
245
  disabled={(!value.trim() && !selectedFile) || isSending || disabled}
246
  className={cn(
247
- "p-2.5 rounded-xl transition-all duration-500 relative flex items-center justify-center",
248
  ((value.trim() || selectedFile) && !isSending && !disabled)
249
- ? "text-white"
250
- : "text-slate-600/50 opacity-50 grayscale"
251
  )}
252
  >
253
  {isSending ? (
254
  <Loader2 className="w-5 h-5 animate-spin" />
255
  ) : (
256
  <Send className={cn(
257
- "w-5 h-5 transition-all duration-500",
258
- ((value.trim() || selectedFile) && !isSending && !disabled)
259
- ? "scale-110 [filter:drop-shadow(0_0_8px_rgba(99,102,241,0.8))]"
260
- : "scale-100"
261
  )} />
262
  )}
263
  </button>
264
  </form>
 
 
265
  <div className="hidden md:block text-center mt-2">
266
  <p className="text-[10px] text-slate-400 font-medium">
267
  Enter для отправки • Shift + Enter для переноса
268
  </p>
269
  </div>
270
- </div>
271
- </div>
272
  )
273
  }
 
133
  }
134
 
135
  return (
136
+ <div className="px-2 sm:px-3 pb-3 pt-2 bg-transparent flex-shrink-0 relative z-30">
137
  <div className="max-w-4xl mx-auto relative">
138
  {/* File Preview */}
139
  {selectedFile && (
140
+ <motion.div
141
+ initial={{ opacity: 0, y: 10 }}
142
+ animate={{ opacity: 1, y: 0 }}
143
+ className="mb-2 p-2 bg-[#050510]/60 backdrop-blur-xl rounded-xl border border-white/10 flex items-center gap-2 w-fit max-w-[calc(100%-20px)] shadow-lg"
144
+ >
145
  <Paperclip className="w-4 h-4 text-indigo-400 shrink-0" />
146
  <span className="text-xs text-white truncate">{selectedFile.name}</span>
147
  <button onClick={() => setSelectedFile(null)} className="p-1 hover:bg-white/10 rounded-full">
148
  <X className="w-3 h-3 text-slate-400" />
149
  </button>
150
+ </motion.div>
151
  )}
152
 
153
  {/* Audio Preview */}
154
  {pendingAudio && !isRecording && (
155
+ <motion.div
156
+ initial={{ opacity: 0, y: 10 }}
157
+ animate={{ opacity: 1, y: 0 }}
158
+ className="mb-2 p-2 bg-[#050510]/60 backdrop-blur-xl rounded-xl border border-indigo-500/30 flex items-center gap-2 w-fit shadow-lg"
159
+ >
160
  <button
161
  onClick={toggleAudioPreview}
162
  className="w-8 h-8 rounded-full bg-indigo-500/20 flex items-center justify-center text-indigo-400 hover:bg-indigo-500/30"
163
  >
164
  {isPlayingPreview ? <Pause className="w-4 h-4" /> : <Play className="w-4 h-4 ml-0.5" />}
165
  </button>
166
+ <span className="text-xs text-indigo-300 font-medium">🎤 Готовое сообщение</span>
167
  <button onClick={clearPendingAudio} className="p-1 hover:bg-white/10 rounded-full">
168
  <X className="w-3 h-3 text-slate-400" />
169
  </button>
170
+ </motion.div>
171
  )}
172
 
173
  {/* Audio Recording UI */}
174
  {isRecording && (
175
+ <motion.div
176
+ initial={{ opacity: 0, scale: 0.95 }}
177
+ animate={{ opacity: 1, scale: 1 }}
178
+ className="absolute inset-0 bg-[#050510]/90 backdrop-blur-2xl rounded-2xl border border-red-500/30 flex items-center justify-between px-4 z-40 shadow-2xl"
179
+ >
180
+ <div className="flex items-center gap-3 text-red-400">
181
+ <div className="flex gap-1 items-end h-4">
182
+ <div className="w-1 bg-red-500 rounded-full animate-[voice-wave_1s_infinite_0s]" style={{ height: '60%' }} />
183
+ <div className="w-1 bg-red-500 rounded-full animate-[voice-wave_1s_infinite_0.2s]" style={{ height: '100%' }} />
184
+ <div className="w-1 bg-red-500 rounded-full animate-[voice-wave_1s_infinite_0.4s]" style={{ height: '40%' }} />
185
+ <div className="w-1 bg-red-500 rounded-full animate-[voice-wave_1s_infinite_0.1s]" style={{ height: '80%' }} />
186
+ </div>
187
+ <span className="text-sm font-bold tracking-tight">ЗАПИСЬ...</span>
188
  </div>
189
+ <div className="flex items-center gap-3">
 
190
  <button
191
  type="button"
192
  onClick={cancelRecording}
193
+ className="p-2.5 bg-white/5 text-slate-400 rounded-full hover:bg-white/10 hover:text-white transition-all active:scale-90"
194
+ title="Отменить"
195
  >
196
  <X className="w-5 h-5" />
197
  </button>
 
198
  <button
199
  type="button"
200
  onClick={stopRecording}
201
+ className="p-2.5 bg-red-500/20 text-red-500 rounded-full hover:bg-red-500/30 transition-all active:scale-90 shadow-[0_0_15px_rgba(239,68,68,0.2)]"
202
+ title="Готово"
203
  >
204
  <Send className="w-5 h-5" />
205
  </button>
206
  </div>
207
+ </motion.div>
208
  )}
209
 
210
  <form
211
  onSubmit={handleSubmit}
212
+ className="flex items-center gap-1.5 px-0.5 transition-all"
213
  >
214
  <input
215
  type="file"
 
219
  accept="image/*,.pdf,.txt,.doc,.docx"
220
  />
221
 
222
+ <div className="flex items-center">
223
  <button
224
  type="button"
225
  onClick={() => fileInputRef.current?.click()}
226
  className={cn(
227
+ "p-2.5 rounded-full transition-all active:scale-90",
228
+ selectedFile ? "text-indigo-400 bg-indigo-500/10" : "text-slate-400/60 hover:text-white hover:bg-white/5"
229
  )}
230
  >
231
  <Paperclip className="w-5 h-5" />
 
235
  type="button"
236
  onClick={startRecording}
237
  className={cn(
238
+ "p-2.5 rounded-full transition-all active:scale-95",
239
+ isRecording ? "text-red-500 bg-red-500/10" : "text-slate-400/60 hover:text-white hover:bg-white/5"
240
  )}
241
  disabled={!!selectedFile}
242
  >
 
248
  value={value}
249
  onChange={(e) => onChange(e.target.value)}
250
  onKeyDown={handleKeyDown}
251
+ placeholder="Написать..."
252
+ className="flex-1 bg-white/5 border border-white/5 rounded-[22px] focus:ring-1 focus:ring-indigo-500/30 focus:border-indigo-500/30 focus:bg-white/10 resize-none max-h-32 py-2.5 px-4 text-[16px] leading-tight text-white placeholder:text-slate-600 overflow-y-auto transition-all shadow-inner"
253
  rows={1}
254
  style={{ minHeight: '44px' }}
255
  disabled={disabled || isRecording}
 
259
  type="submit"
260
  disabled={(!value.trim() && !selectedFile) || isSending || disabled}
261
  className={cn(
262
+ "p-2.5 rounded-full transition-all duration-300 flex items-center justify-center",
263
  ((value.trim() || selectedFile) && !isSending && !disabled)
264
+ ? "text-indigo-400 bg-indigo-500/10 shadow-[0_0_15px_rgba(99,102,241,0.1)] active:scale-90"
265
+ : "text-slate-700 pointer-events-none"
266
  )}
267
  >
268
  {isSending ? (
269
  <Loader2 className="w-5 h-5 animate-spin" />
270
  ) : (
271
  <Send className={cn(
272
+ "w-5 h-5",
273
+ ((value.trim() || selectedFile) && !isSending && !disabled) && "fill-indigo-400/10"
 
 
274
  )} />
275
  )}
276
  </button>
277
  </form>
278
+ </div>
279
+ </div>
280
  <div className="hidden md:block text-center mt-2">
281
  <p className="text-[10px] text-slate-400 font-medium">
282
  Enter для отправки • Shift + Enter для переноса
283
  </p>
284
  </div>
285
+ </div >
286
+ </div >
287
  )
288
  }
frontend/components/MobileBottomNav.tsx CHANGED
@@ -54,7 +54,7 @@ export function MobileBottomNav() {
54
  animate={{ y: 0 }}
55
  exit={{ y: '100%' }}
56
  transition={{ type: 'spring', damping: 20, stiffness: 200 }}
57
- className="fixed bottom-0 left-0 right-0 z-40 bg-[#050510]/80 backdrop-blur-xl border-t border-white/5 pb-[env(safe-area-inset-bottom,0px)] md:hidden"
58
  >
59
  <div className="flex items-center justify-around h-[50px] px-2 relative">
60
  {/* Главная */}
 
54
  animate={{ y: 0 }}
55
  exit={{ y: '100%' }}
56
  transition={{ type: 'spring', damping: 20, stiffness: 200 }}
57
+ className="fixed bottom-0 left-0 right-0 z-40 bg-gradient-to-t from-[#050510] via-[#050510]/80 to-transparent pb-[env(safe-area-inset-bottom,0px)] md:hidden"
58
  >
59
  <div className="flex items-center justify-around h-[50px] px-2 relative">
60
  {/* Главная */}