Skip to content

Commit a8c80ca

Browse files
committed
fix(tarko): disable share button during agent execution instead of hiding
1 parent ae83d3d commit a8c80ca

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

multimodal/tarko/agent-web-ui/src/standalone/navbar/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const Navbar: React.FC = () => {
135135
</motion.button>
136136

137137
{/* Share button - moved to last position */}
138-
{activeSessionId && !isProcessing && !isReplayMode && <ShareButton variant="navbar" />}
138+
{activeSessionId && !isReplayMode && <ShareButton variant="navbar" disabled={isProcessing} />}
139139
</div>
140140
</div>
141141

multimodal/tarko/agent-web-ui/src/standalone/share/ShareButton.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ShareModal } from './ShareModal';
66

77
interface ShareButtonProps {
88
variant?: 'default' | 'navbar';
9+
disabled?: boolean;
910
}
1011

1112
/**
@@ -17,11 +18,12 @@ interface ShareButtonProps {
1718
* - Fine hover and click animations, enhancing interactive experience
1819
* - Support different display variants to adapt to different positions
1920
*/
20-
export const ShareButton: React.FC<ShareButtonProps> = ({ variant = 'default' }) => {
21+
export const ShareButton: React.FC<ShareButtonProps> = ({ variant = 'default', disabled = false }) => {
2122
const [isModalOpen, setIsModalOpen] = useState(false);
2223
const { activeSessionId } = useSession();
2324

2425
const handleOpenModal = () => {
26+
if (disabled) return;
2527
setIsModalOpen(true);
2628
};
2729

@@ -38,16 +40,21 @@ export const ShareButton: React.FC<ShareButtonProps> = ({ variant = 'default' })
3840
return (
3941
<>
4042
<motion.button
41-
whileHover={{ scale: 1.05 }}
42-
whileTap={{ scale: 0.95 }}
43+
whileHover={disabled ? {} : { scale: 1.05 }}
44+
whileTap={disabled ? {} : { scale: 0.95 }}
4345
onClick={handleOpenModal}
44-
className="p-2 text-gray-600 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200 hover:bg-gray-100/40 dark:hover:bg-gray-700/40 rounded-full transition-all duration-200"
45-
title="Share this conversation"
46+
disabled={disabled}
47+
className={`p-2 rounded-full transition-all duration-200 ${
48+
disabled
49+
? 'text-gray-400 dark:text-gray-600 cursor-not-allowed'
50+
: 'text-gray-600 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200 hover:bg-gray-100/40 dark:hover:bg-gray-700/40'
51+
}`}
52+
title={disabled ? 'Share unavailable during agent execution' : 'Share this conversation'}
4653
>
4754
<FiShare2 size={16} />
4855
</motion.button>
4956

50-
<ShareModal isOpen={isModalOpen} onClose={handleCloseModal} sessionId={activeSessionId} />
57+
{!disabled && <ShareModal isOpen={isModalOpen} onClose={handleCloseModal} sessionId={activeSessionId} />}
5158
</>
5259
);
5360
}
@@ -56,17 +63,22 @@ export const ShareButton: React.FC<ShareButtonProps> = ({ variant = 'default' })
5663
return (
5764
<>
5865
<motion.button
59-
whileHover={{ scale: 1.05 }}
60-
whileTap={{ scale: 0.95 }}
66+
whileHover={disabled ? {} : { scale: 1.05 }}
67+
whileTap={disabled ? {} : { scale: 0.95 }}
6168
onClick={handleOpenModal}
62-
className="flex items-center gap-1.5 px-3 py-1.5 rounded-3xl text-xs text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border border-gray-200/70 dark:border-gray-700/30 shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700/70 transition-all duration-200"
63-
title="Share this conversation"
69+
disabled={disabled}
70+
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-3xl text-xs border shadow-sm transition-all duration-200 ${
71+
disabled
72+
? 'text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-700 border-gray-200/50 dark:border-gray-600/30 cursor-not-allowed'
73+
: 'text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 border-gray-200/70 dark:border-gray-700/30 hover:bg-gray-50 dark:hover:bg-gray-700/70'
74+
}`}
75+
title={disabled ? 'Share unavailable during agent execution' : 'Share this conversation'}
6476
>
65-
<FiShare2 className="text-gray-500 dark:text-gray-400" size={14} />
77+
<FiShare2 className={disabled ? 'text-gray-400 dark:text-gray-500' : 'text-gray-500 dark:text-gray-400'} size={14} />
6678
<span>Share</span>
6779
</motion.button>
6880

69-
<ShareModal isOpen={isModalOpen} onClose={handleCloseModal} sessionId={activeSessionId} />
81+
{!disabled && <ShareModal isOpen={isModalOpen} onClose={handleCloseModal} sessionId={activeSessionId} />}
7082
</>
7183
);
7284
};

0 commit comments

Comments
 (0)