@@ -30,6 +30,7 @@ import { Button } from '@/components/ui/button';
30
30
import { cn } from '@/lib/utils' ;
31
31
import { useModels } from '@/hooks/useModels' ;
32
32
import { gql , useMutation } from '@apollo/client' ;
33
+ import { useTheme } from 'next-themes' ; // 导入 useTheme
33
34
34
35
export interface PromptFormRef {
35
36
getPromptData : ( ) => {
@@ -69,6 +70,11 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
69
70
// State for regeneration loading
70
71
const [ isRegenerating , setIsRegenerating ] = useState ( false ) ;
71
72
73
+ // 使用 useTheme 钩子获取当前主题
74
+ const { theme } = useTheme ( ) ;
75
+ // 检查是否为暗色模式
76
+ const isDarkMode = theme === 'dark' ;
77
+
72
78
const {
73
79
selectedModel,
74
80
setSelectedModel,
@@ -176,7 +182,7 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
176
182
. pauseFor ( 10 )
177
183
. deleteAll ( )
178
184
. start ( ) ;
179
- }
185
+ } ;
180
186
181
187
return (
182
188
< div className = "relative w-full max-w-2xl mx-auto" >
@@ -282,25 +288,46 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
282
288
< TooltipProvider >
283
289
< Tooltip >
284
290
< TooltipTrigger asChild >
285
- < Button
286
- variant = "ghost"
287
- size = "icon"
291
+ < div
292
+ onClick = {
293
+ ! isLoading && ! isRegenerating
294
+ ? handleMagicEnhance
295
+ : undefined
296
+ }
288
297
className = { cn (
289
- 'rounded-full p-6 transition-all' ,
298
+ 'flex items-center justify-center w-12 h-12 rounded-full p-2 cursor-pointer transition-all' ,
299
+ 'focus:outline-none focus:ring-0 focus:border-0' ,
300
+ 'active:outline-none active:ring-0 active:border-0' ,
290
301
isEnhanced
291
- ? 'bg-amber-500/20 text-amber-500 hover:bg-amber-500/30 hover:text-amber-600'
292
- : 'text-gray-500 hover:text-amber-500' ,
302
+ ? isDarkMode
303
+ ? 'text-blue-700 hover:text-blue-700'
304
+ : 'text-yellow-300 hover:text-yellow-300'
305
+ : 'text-gray-500 hover:text-gray-500' ,
293
306
( isLoading || isRegenerating ) &&
294
307
'opacity-50 cursor-not-allowed'
295
308
) }
296
- onClick = { handleMagicEnhance }
297
- disabled = { isLoading || isRegenerating }
309
+ style = { {
310
+ border : 'none' ,
311
+ outline : 'none' ,
312
+ boxShadow : 'none' ,
313
+ WebkitTapHighlightColor : 'transparent' ,
314
+ WebkitAppearance : 'none' ,
315
+ MozAppearance : 'none' ,
316
+ WebkitUserSelect : 'none' ,
317
+ userSelect : 'none' ,
318
+ } }
319
+ tabIndex = { - 1 }
320
+ onMouseDown = { ( e ) => e . preventDefault ( ) }
321
+ onMouseUp = { ( e ) => e . preventDefault ( ) }
298
322
>
299
323
< Sparkles
300
324
size = { 36 }
301
- className = { cn ( "!w-6 !h-6" , isRegenerating && 'animate-spin' ) }
325
+ className = { cn (
326
+ 'w-6 h-6' ,
327
+ isRegenerating && 'animate-spin'
328
+ ) }
302
329
/>
303
- </ Button >
330
+ </ div >
304
331
</ TooltipTrigger >
305
332
< TooltipContent side = "bottom" >
306
333
< p >
0 commit comments