An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
style: enhance UI components with animations and visual improvements
Yoshiki Miura077c68fdc5e8
diff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex 33d98261..7d2507fc 100644--- a/components/chat-panel.tsx+++ b/components/chat-panel.tsx@@ -1,14 +1,14 @@'use client'-import { useState, useRef, useEffect } from 'react'-import { useRouter } from 'next/navigation'import { cn } from '@/lib/utils'-import { Button } from './ui/button'-import { ArrowRight, Plus, Square } from 'lucide-react'-import { EmptyScreen } from './empty-screen'-import Textarea from 'react-textarea-autosize'import { Message } from 'ai'+import { ArrowUp, Plus, Square } from 'lucide-react'+import { useRouter } from 'next/navigation'+import { useEffect, useRef, useState } from 'react'+import Textarea from 'react-textarea-autosize'+import { EmptyScreen } from './empty-screen'import { ModelSelector } from './model-selector'+import { Button } from './ui/button'interface ChatPanelProps {input: string@@ -72,8 +72,8 @@ export function ChatPanel({className={cn('mx-auto w-full',messages.length > 0- ? 'fixed bottom-0 left-0 right-0 bg-background/80 backdrop-blur-sm'- : 'fixed bottom-8 left-0 right-0 top-10 flex flex-col items-center justify-center'+ ? 'fixed bottom-0 left-0 right-0 bg-background'+ : 'fixed bottom-8 left-0 right-0 top-0 flex flex-col items-center justify-center')}><form@@ -89,10 +89,10 @@ export function ChatPanel({variant="ghost"size="icon"onClick={handleNewChat}- className="shrink-0 rounded-full"+ className="shrink-0 rounded-full group"type="button">- <Plus className="h-4 w-4" />+ <Plus className="size-4 group-hover:rotate-90 transition-all" /></Button>)}{messages.length === 0 && <ModelSelector />}@@ -161,7 +161,7 @@ export function ChatPanel({disabled={input.length === 0 && !isLoading}onClick={isLoading ? stop : undefined}>- {isLoading ? <Square size={20} /> : <ArrowRight size={20} />}+ {isLoading ? <Square size={20} /> : <ArrowUp size={20} />}</Button></div>{messages.length === 0 && (diff --git a/components/search-results.tsx b/components/search-results.tsxindex 14c9b257..9725c3db 100644--- a/components/search-results.tsx+++ b/components/search-results.tsx@@ -1,11 +1,11 @@'use client'-import { useState } from 'react'-import { AvatarImage, Avatar, AvatarFallback } from '@/components/ui/avatar'-import { CardContent, Card } from '@/components/ui/card'+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'import { Button } from '@/components/ui/button'-import Link from 'next/link'+import { Card, CardContent } from '@/components/ui/card'import { SearchResultItem } from '@/lib/types'+import Link from 'next/link'+import { useState } from 'react'export interface SearchResultsProps {results: SearchResultItem[]@@ -34,7 +34,7 @@ export function SearchResults({ results }: SearchResultsProps) {<Link href={result.url} passHref target="_blank"><Card className="flex-1 h-full"><CardContent className="p-2 flex flex-col justify-between h-full">- <p className="text-xs line-clamp-2">+ <p className="text-xs line-clamp-2 min-h-[2rem]">{result.title || result.content}</p><div className="mt-2 flex items-center space-x-1">diff --git a/components/section.tsx b/components/section.tsxindex 02447b64..cbeeada1 100644--- a/components/section.tsx+++ b/components/section.tsx@@ -11,8 +11,9 @@ import {Search} from 'lucide-react'import React from 'react'-import { Separator } from './ui/separator'import { ToolBadge } from './tool-badge'+import { Badge } from './ui/badge'+import { Separator } from './ui/separator'type SectionProps = {children: React.ReactNode@@ -66,10 +67,13 @@ export const Section: React.FC<SectionProps> = ({)}>{title && (- <h2 className="flex items-center leading-none py-2">+ <Badge+ variant="secondary"+ className="flex items-center leading-none w-fit my-1"+ >{icon}{title}- </h2>+ </Badge>)}{children}</section>