1- import { FC , startTransition , useEffect , useMemo } from 'react'
1+ import { FC , startTransition , useEffect , useMemo , useState } from 'react'
22// import UnlinkOutlineIcon from '../assets/unlink-outline'
33import ArrowForwardIcon from '@/assets/arrow-forward'
44import { Switch } from '@/components/ui/switch'
@@ -42,6 +42,7 @@ type TAgentProps = {
4242}
4343
4444const Agent : FC < TAgentProps > = ( { capabilitiy } ) => {
45+ const [ isWaiting , setIsWaiting ] = useState ( false )
4546 const navigate = useNavigate ( )
4647 const queryClient = useQueryClient ( )
4748
@@ -55,7 +56,10 @@ const Agent: FC<TAgentProps> = ({ capabilitiy }) => {
5556 const action = useMemo ( ( ) => {
5657 // ToDo: better to use capabilitiy.id?
5758 if ( capabilitiy . name === 'news-monitor' )
58- return ( ) => startTransition ( ( ) => navigate ( '/news-monitor' ) )
59+ return ( ) => {
60+ setIsWaiting ( true )
61+ startTransition ( ( ) => navigate ( '/news-monitor' ) )
62+ }
5963 } , [ capabilitiy , navigate ] )
6064
6165 const handleChangeStatus = ( ) =>
@@ -83,9 +87,13 @@ const Agent: FC<TAgentProps> = ({ capabilitiy }) => {
8387 < div className = "group flex items-center gap-2 pt-1 pb-0.25 text-left text-[14px]/[125%] font-semibold wrap-anywhere" >
8488 { capabilitiy . title ?? capabilitiy . name }
8589 { action ? (
86- < div className = "text-(--color-gray-text) transition group-hover:text-(--color-main-text)" >
87- < ArrowForwardIcon />
88- </ div >
90+ isWaiting ? (
91+ < span className = "h-3 w-3 animate-spin rounded-[6px] border-2 border-(--color-opposite-text) border-b-(--color-gray-text)" > </ span >
92+ ) : (
93+ < div className = "text-(--color-gray-text) transition group-hover:text-(--color-main-text)" >
94+ < ArrowForwardIcon />
95+ </ div >
96+ )
8997 ) : null }
9098 </ div >
9199 { capabilitiy . title ? (
0 commit comments