From 5b5204e364ccbe3cc177a5b303dc5249bad41cb8 Mon Sep 17 00:00:00 2001 From: Vukasin Date: Thu, 3 Jul 2025 23:40:55 +0200 Subject: [PATCH] feat: new chat input on landing --- .../components/home/sections/hero-section.tsx | 160 ++++++++++-------- .../thread/chat-input/chat-dropdown.tsx | 97 +++++++++++ 2 files changed, 185 insertions(+), 72 deletions(-) create mode 100644 frontend/src/components/thread/chat-input/chat-dropdown.tsx diff --git a/frontend/src/components/home/sections/hero-section.tsx b/frontend/src/components/home/sections/hero-section.tsx index 32d280a1..07a5e90d 100644 --- a/frontend/src/components/home/sections/hero-section.tsx +++ b/frontend/src/components/home/sections/hero-section.tsx @@ -17,7 +17,6 @@ import { useThreadQuery } from '@/hooks/react-query/threads/use-threads'; import { generateThreadName } from '@/lib/actions/threads'; import GoogleSignIn from '@/components/GoogleSignIn'; import { Input } from '@/components/ui/input'; -import { SubmitButton } from '@/components/ui/submit-button'; import { Dialog, DialogContent, @@ -32,6 +31,13 @@ import { useAccounts } from '@/hooks/use-accounts'; import { isLocalMode, config } from '@/lib/config'; import { toast } from 'sonner'; import { useModal } from '@/hooks/use-modal-store'; +import { Card, CardContent } from '@/components/ui/card'; +import { Button } from '@/components/ui/button'; +import { Send, ArrowUp, Paperclip } from 'lucide-react'; +import { Textarea } from '@/components/ui/textarea'; +import { cn } from '@/lib/utils'; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; +import ChatDropdown from '@/components/thread/chat-input/chat-dropdown'; // Custom dialog overlay with blur effect const BlurredDialogOverlay = () => ( @@ -63,7 +69,6 @@ export function HeroSection() { // Auth dialog state const [authDialogOpen, setAuthDialogOpen] = useState(false); - const [authError, setAuthError] = useState(null); useEffect(() => { setMounted(true); @@ -124,7 +129,7 @@ export function HeroSection() { try { const formData = new FormData(); formData.append('prompt', inputValue.trim()); - formData.append('model_name', 'openrouter/deepseek/deepseek-chat'); + formData.append('model_name', 'openrouter/deepseek/deepseek-chat'); formData.append('enable_thinking', 'false'); formData.append('reasoning_effort', 'low'); formData.append('stream', 'true'); @@ -174,37 +179,15 @@ export function HeroSection() { }; // Handle Enter key press - const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault(); // Prevent default form submission e.stopPropagation(); // Stop event propagation handleSubmit(); } }; - // Handle auth form submission - const handleSignIn = async (prevState: any, formData: FormData) => { - setAuthError(null); - try { - // Implement sign in logic here - const email = formData.get('email') as string; - const password = formData.get('password') as string; - // Add the returnUrl to the form data for proper redirection - formData.append('returnUrl', '/dashboard'); - - // Call your authentication function here - - // Return any error state - return { message: 'Invalid credentials' }; - } catch (error) { - console.error('Sign in error:', error); - setAuthError( - error instanceof Error ? error.message : 'An error occurred', - ); - return { message: 'An error occurred during sign in' }; - } - }; return (
@@ -260,7 +243,7 @@ export function HeroSection() { {hero.badge}

*/} - - -
+ */} +

Suna , your AI Employee. @@ -298,37 +281,76 @@ export function HeroSection() { {hero.description}

-
+
- {/* ChatGPT-like input with glow effect */} + {/* Input that looks exactly like ChatInput */}
-
- setInputValue(e.target.value)} - onKeyDown={handleKeyDown} - placeholder={hero.inputPlaceholder} - className="flex-1 h-12 md:h-14 rounded-full px-2 bg-transparent focus:outline-none text-sm md:text-base py-2" - disabled={isSubmitting} - /> - -
+ +
+ +
+
+