Skip to content

Commit 7ea7479

Browse files
authored
feat: show brief animation when starting server (#441)
1 parent 367bbfc commit 7ea7479

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

renderer/src/features/mcp-servers/components/card-mcp-server.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,27 @@ export function CardMcpServer({
167167
const isTransitioning =
168168
status === 'starting' || status === 'stopping' || status === 'restarting'
169169
const isStopped = status === 'stopped' || status === 'stopping'
170+
const [hadRecentStatusChange, setHadRecentStatusChange] = useState(false)
171+
const [prevStatus, setPrevStatus] =
172+
useState<WorkloadsWorkload['status']>(status)
173+
174+
useEffect(() => {
175+
// show a brief animation for status transitions that are immediate
176+
if (prevStatus !== status && ['running'].includes(status ?? '')) {
177+
setHadRecentStatusChange(true)
178+
const timeout = setTimeout(() => setHadRecentStatusChange(false), 2500)
179+
return () => clearTimeout(timeout)
180+
}
181+
setPrevStatus(status)
182+
}, [status, prevStatus])
170183

171184
return (
172185
<Card
173186
className={twMerge(
174187
'transition-all duration-300 ease-in-out',
175188
isNewServer ? 'ring-2' : undefined,
176189
isDeleting ? 'pointer-events-none opacity-50' : undefined,
177-
isTransitioning && 'animate-diagonal-ring',
190+
(isTransitioning || hadRecentStatusChange) && 'animate-diagonal-ring',
178191
isStopped && 'bg-card/65'
179192
)}
180193
>

0 commit comments

Comments
 (0)