Skip to content

Commit f83db16

Browse files
authored
Merge pull request #482 from miurla/fix/collapsible-message-icon-spacing
Remove icon space when showIcon is false
2 parents e66b8db + c1ee4e0 commit f83db16

9 files changed

+22
-14
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
# cursor
39+
.cursor

components/chat-panel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function ChatPanel({
9090
onSubmit={handleSubmit}
9191
className={cn(
9292
'max-w-3xl w-full mx-auto',
93-
messages.length > 0 ? 'px-2 py-4' : 'px-6'
93+
messages.length > 0 ? 'px-2 pb-4' : 'px-6'
9494
)}
9595
>
9696
<div className="relative flex flex-col w-full gap-2 bg-muted rounded-3xl border border-input">

components/chat.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function Chat({
6363
}
6464

6565
return (
66-
<div className="flex flex-col w-full max-w-3xl pt-14 pb-60 mx-auto stretch">
66+
<div className="flex flex-col w-full max-w-3xl pt-14 pb-40 mx-auto stretch">
6767
<ChatMessages
6868
messages={messages}
6969
data={data}

components/collapsible-message.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ export function CollapsibleMessage({
3333

3434
return (
3535
<div className="flex gap-3">
36-
<div className="relative flex flex-col items-center">
37-
<div className={cn('mt-[10px] w-5', role === 'assistant' && 'mt-4')}>
38-
{showIcon &&
39-
(role === 'user' ? (
36+
{showIcon && (
37+
<div className="relative flex flex-col items-center">
38+
<div className={cn('mt-[10px] w-5', role === 'assistant' && 'mt-4')}>
39+
{role === 'user' ? (
4040
<UserCircle2 size={20} className="text-muted-foreground" />
4141
) : (
4242
<IconLogo className="size-5" />
43-
))}
43+
)}
44+
</div>
4445
</div>
45-
</div>
46+
)}
4647

4748
{isCollapsible ? (
4849
<div

components/related-questions.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const RelatedQuestions: React.FC<RelatedQuestionsProps> = ({
7474
header={header}
7575
isOpen={isOpen}
7676
onOpenChange={onOpenChange}
77+
showIcon={false}
7778
>
7879
<div className="flex flex-wrap">
7980
{Array.isArray(relatedQuestions.items) ? (

components/retrieve-section.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use client'
22

3-
import { Section, ToolArgsSection } from '@/components/section'
43
import { SearchResults } from '@/components/search-results'
4+
import { Section, ToolArgsSection } from '@/components/section'
55
import { SearchResults as SearchResultsType } from '@/lib/types'
66
import { ToolInvocation } from 'ai'
7-
import { DefaultSkeleton } from './default-skeleton'
87
import { CollapsibleMessage } from './collapsible-message'
8+
import { DefaultSkeleton } from './default-skeleton'
99

1010
interface RetrieveSectionProps {
1111
tool: ToolInvocation
@@ -32,6 +32,7 @@ export function RetrieveSection({
3232
header={header}
3333
isOpen={isOpen}
3434
onOpenChange={onOpenChange}
35+
showIcon={false}
3536
>
3637
{!isLoading && data ? (
3738
<Section title="Sources">

components/search-section.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export function SearchSection({
4747
header={header}
4848
isOpen={isOpen}
4949
onOpenChange={onOpenChange}
50+
showIcon={false}
5051
>
5152
{searchResults &&
5253
searchResults.images &&

components/tool-section.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use client'
22

33
import { ToolInvocation } from 'ai'
4+
import RetrieveSection from './retrieve-section'
45
import { SearchSection } from './search-section'
56
import { VideoSearchSection } from './video-search-section'
6-
import RetrieveSection from './retrieve-section'
77

88
interface ToolSectionProps {
99
tool: ToolInvocation

components/video-search-section.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use client'
22

3-
import { DefaultSkeleton } from './default-skeleton'
4-
import { Section, ToolArgsSection } from './section'
53
import type { SerperSearchResults } from '@/lib/types'
64
import { ToolInvocation } from 'ai'
7-
import { VideoSearchResults } from './video-search-results'
85
import { CollapsibleMessage } from './collapsible-message'
6+
import { DefaultSkeleton } from './default-skeleton'
7+
import { Section, ToolArgsSection } from './section'
8+
import { VideoSearchResults } from './video-search-results'
99

1010
interface VideoSearchSectionProps {
1111
tool: ToolInvocation
@@ -32,6 +32,7 @@ export function VideoSearchSection({
3232
header={header}
3333
isOpen={isOpen}
3434
onOpenChange={onOpenChange}
35+
showIcon={false}
3536
>
3637
{!isLoading && searchResults ? (
3738
<Section title="Videos">

0 commit comments

Comments
 (0)