Skip to content

Commit

Permalink
Merge pull request #594 from valory-xyz/tanya/siwtch-agent-tooltip
Browse files Browse the repository at this point in the history
fix: show tooltip when switch agent button is disabled
  • Loading branch information
Tanya-atatakai authored Dec 16, 2024
2 parents a3b635d + 16dc35d commit 3171e03
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions frontend/components/MainPage/sections/SwitchAgentSection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Flex, Typography } from 'antd';
import { Button, Flex, Popover, Typography } from 'antd';
import Image from 'next/image';
import { useMemo } from 'react';

Expand Down Expand Up @@ -53,14 +53,19 @@ export const SwitchAgentSection = () => {
<Text>{selectedAgentConfig.displayName}</Text>
</Flex>

<Button
disabled={!isSwitchAgentEnabled}
onClick={() => goto(Pages.SwitchAgent)}
type="primary"
ghost
>
Switch agent
</Button>
{isSwitchAgentEnabled ? (
<Button onClick={() => goto(Pages.SwitchAgent)} type="primary" ghost>
Switch agent
</Button>
) : (
<Popover
placement="bottomRight"
content="To switch, stop the agent you're running"
showArrow={false}
>
<Button disabled>Switch agent</Button>
</Popover>
)}
</CardSection>
);
};

0 comments on commit 3171e03

Please sign in to comment.