Skip to content

Commit 87e2910

Browse files
committed
improvement: thinking
1 parent f780aaf commit 87e2910

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { useCallback, useEffect, useRef, useState } from 'react'
44
import { createLogger } from '@sim/logger'
55
import { useParams, useRouter } from 'next/navigation'
6-
import { Loader } from '@/components/emcn'
76
import { useSession } from '@/lib/auth/auth-client'
87
import {
98
LandingPromptStorage,
@@ -19,6 +18,27 @@ import { useChat } from './hooks'
1918

2019
const logger = createLogger('Home')
2120

21+
const THINKING_BLOCKS = [
22+
{ color: '#2ABBF8', delay: '0s' },
23+
{ color: '#00F701', delay: '0.2s' },
24+
{ color: '#FA4EDF', delay: '0.6s' },
25+
{ color: '#FFCC02', delay: '0.4s' },
26+
] as const
27+
28+
function ThinkingIndicator() {
29+
return (
30+
<div className='grid h-[16px] w-[16px] grid-cols-2 gap-[1.5px]'>
31+
{THINKING_BLOCKS.map((block, i) => (
32+
<div
33+
key={i}
34+
className='animate-thinking-block rounded-[2px]'
35+
style={{ backgroundColor: block.color, animationDelay: block.delay }}
36+
/>
37+
))}
38+
</div>
39+
)
40+
}
41+
2242
interface HomeProps {
2343
chatId?: string
2444
}
@@ -178,7 +198,7 @@ export function Home({ chatId }: HomeProps = {}) {
178198
if (!hasBlocks && !msg.content && isThisStreaming) {
179199
return (
180200
<div key={msg.id} className='flex items-center gap-[8px] py-[8px]'>
181-
<Loader className='h-[16px] w-[16px] text-[var(--text-icon)]' animate />
201+
<ThinkingIndicator />
182202
<span className='font-[var(--sidebar-font-weight)] text-[14px] text-[var(--text-body)]'>
183203
Thinking…
184204
</span>

apps/sim/tailwind.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ export default {
159159
from: { opacity: '0' },
160160
to: { opacity: '1' },
161161
},
162+
'thinking-block': {
163+
'0%, 100%': { opacity: '0.15' },
164+
'30%, 55%': { opacity: '1' },
165+
},
162166
'slide-in-right': {
163167
from: { opacity: '0', transform: 'translateX(40px)' },
164168
to: { opacity: '1', transform: 'translateX(0)' },
@@ -172,6 +176,7 @@ export default {
172176
'placeholder-pulse': 'placeholder-pulse 1.5s ease-in-out infinite',
173177
'ring-pulse': 'ring-pulse 1.5s ease-in-out infinite',
174178
'stream-fade-in': 'stream-fade-in 300ms ease-out forwards',
179+
'thinking-block': 'thinking-block 1.6s ease-in-out infinite',
175180
'slide-in-right': 'slide-in-right 350ms ease-out forwards',
176181
},
177182
},

0 commit comments

Comments
 (0)