feat: enhance AIChatPanel UI with improved button styles and layout adjustments

This commit is contained in:
Roberto Musso
2026-02-26 16:36:13 +01:00
parent f09afd2d9e
commit e19582201f

View File

@@ -308,15 +308,15 @@ export function AIChatPanel({
onSend={handleSend} onSend={handleSend}
isHomePage={isHomePage} isHomePage={isHomePage}
/> />
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2 mt-3"> <div className="flex flex-wrap items-center justify-center gap-2 mt-4">
{SUGGESTION_CHIPS.map((chip) => ( {SUGGESTION_CHIPS.map((chip) => (
<button <button
key={chip.label} key={chip.label}
type="button" type="button"
className="flex items-start gap-2 rounded-xl border border-border bg-background px-3 py-2.5 text-left text-sm text-foreground shadow-sm transition-colors hover:bg-muted cursor-pointer" className="group flex items-center gap-2 rounded-full border border-border/50 bg-background/60 backdrop-blur-lg px-4 py-2 text-sm text-foreground shadow-sm ring-1 ring-border/20 transition-all hover:shadow-md hover:-translate-y-0.5 hover:border-ring/40 cursor-pointer"
onClick={() => setInput(chip.label)} onClick={() => setInput(chip.label)}
> >
<chip.icon size={16} className="shrink-0 mt-0.5 text-muted-foreground" /> <chip.icon size={14} className="shrink-0 text-muted-foreground transition-colors group-hover:text-foreground" />
<span>{chip.label}</span> <span>{chip.label}</span>
</button> </button>
))} ))}
@@ -328,7 +328,7 @@ export function AIChatPanel({
{/* Home page with messages: brief stays, then messages */} {/* Home page with messages: brief stays, then messages */}
{isHomePage && hasMessages && ( {isHomePage && hasMessages && (
<div className="mx-auto w-full max-w-3xl px-6 pt-8 pb-44"> <div className="mx-auto w-full max-w-3xl px-6 pt-8 pb-32">
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
{/* Brief persists */} {/* Brief persists */}
{dailyBrief && ( {dailyBrief && (
@@ -397,7 +397,7 @@ export function AIChatPanel({
{/* Non-home messages */} {/* Non-home messages */}
{!isHomePage && hasMessages && ( {!isHomePage && hasMessages && (
<div className="mx-auto w-full max-w-[1088px] px-6 pt-4 pb-44"> <div className="mx-auto w-full max-w-[1088px] px-6 pt-4 pb-32">
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
{messages.map((msg) => { {messages.map((msg) => {
if (msg.role === 'user') { if (msg.role === 'user') {
@@ -459,8 +459,8 @@ export function AIChatPanel({
{/* Fixed input — pinned to the bottom (hidden on home initial state) */} {/* Fixed input — pinned to the bottom (hidden on home initial state) */}
{!(isHomePage && !hasMessages) && ( {!(isHomePage && !hasMessages) && (
<div className="absolute bottom-0 left-0 right-0 z-10 px-6 pb-4 pt-12 pointer-events-none"> <div className="absolute bottom-0 left-0 right-0 z-10 px-6 pb-5 pt-16 pointer-events-none">
<div className="absolute inset-x-0 top-0 h-full bg-gradient-to-b from-transparent via-background/80 to-background" /> <div className="absolute inset-x-0 top-0 h-full bg-gradient-to-b from-transparent via-background/60 to-background/90" />
<div className={`relative pointer-events-auto mx-auto ${isHomePage ? 'max-w-3xl' : 'max-w-[1088px]'}`}> <div className={`relative pointer-events-auto mx-auto ${isHomePage ? 'max-w-3xl' : 'max-w-[1088px]'}`}>
<ChatInput <ChatInput
input={input} input={input}
@@ -494,34 +494,23 @@ function ChatInput({
onInputChange, onInputChange,
onKeyDown, onKeyDown,
onSend, onSend,
isHomePage,
}: ChatInputProps) { }: ChatInputProps) {
return ( return (
<div <div className="relative rounded-2xl bg-background/70 backdrop-blur-xl border border-border/50 shadow-lg ring-1 ring-border/20 transition-shadow focus-within:shadow-xl focus-within:border-ring/50">
className={ <div className="flex items-center gap-2 px-4 py-2.5">
isHomePage
? 'relative rounded-2xl bg-white dark:bg-neutral-900 border border-[#d4d4d4] shadow-lg overflow-hidden'
: 'relative rounded-2xl bg-muted/60 backdrop-blur-xl border border-border shadow-[0_2px_20px_rgba(0,0,0,0.08)] dark:shadow-[0_2px_20px_rgba(0,0,0,0.3)] overflow-hidden'
}
>
<textarea <textarea
value={input} value={input}
onChange={(e) => onInputChange(e.target.value)} onChange={(e) => onInputChange(e.target.value)}
onKeyDown={onKeyDown} onKeyDown={onKeyDown}
placeholder="Ask me anything..." placeholder="Ask me anything..."
rows={isHomePage ? 4 : 3} rows={1}
style={isHomePage ? { minHeight: 109 } : undefined} className="flex-1 resize-none bg-transparent text-sm placeholder:text-muted-foreground outline-none max-h-[7.5rem] overflow-y-auto"
className="w-full resize-none bg-transparent px-4 pt-4 pb-12 text-sm placeholder:text-muted-foreground outline-none" style={{ fieldSizing: 'content' } as React.CSSProperties}
/> />
<div className="absolute bottom-3 right-3">
<button <button
onClick={onSend} onClick={onSend}
disabled={!input.trim() || isStreaming} disabled={!input.trim() || isStreaming}
className={`flex h-8 w-8 items-center justify-center rounded-xl shadow-sm transition-opacity hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed ${ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground shadow-sm transition-all hover:bg-primary/90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed disabled:active:scale-100"
isHomePage
? 'bg-foreground text-background'
: 'bg-primary text-primary-foreground'
}`}
> >
<ArrowUp size={16} /> <ArrowUp size={16} />
</button> </button>