Skip to content

Commit 89b0021

Browse files
authored
feat(tarko-agent-ui): add copy link option to share conversation modal (#1706)
1 parent db9c02c commit 89b0021

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

multimodal/tarko/agent-ui/src/standalone/share/ShareModal.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const ShareModal: React.FC<ShareModalProps> = ({ isOpen, onClose, session
1616
const [isLoading, setIsLoading] = useState(false);
1717
const [shareResult, setShareResult] = useState<ShareResult | null>(null);
1818
const [copied, setCopied] = useState(false);
19+
const [linkCopied, setLinkCopied] = useState(false);
1920

2021
console.log('ShareModal render', { isOpen, sessionId });
2122

@@ -38,6 +39,7 @@ export const ShareModal: React.FC<ShareModalProps> = ({ isOpen, onClose, session
3839
useEffect(() => {
3940
if (!isOpen) {
4041
setShareResult(null);
42+
setLinkCopied(false);
4143
}
4244
}, [isOpen]);
4345

@@ -93,6 +95,13 @@ export const ShareModal: React.FC<ShareModalProps> = ({ isOpen, onClose, session
9395
}
9496
};
9597

98+
const handleCopyCurrentLink = () => {
99+
const currentUrl = window.location.href;
100+
navigator.clipboard.writeText(currentUrl);
101+
setLinkCopied(true);
102+
setTimeout(() => setLinkCopied(false), 2000);
103+
};
104+
96105
return (
97106
<Dialog open={isOpen} onClose={onClose} maxWidth="sm">
98107
<DialogPanel className="p-4 sm:p-6">
@@ -128,6 +137,40 @@ export const ShareModal: React.FC<ShareModalProps> = ({ isOpen, onClose, session
128137
</p>
129138

130139
<div className="space-y-3 sm:space-y-4">
140+
<motion.button
141+
whileHover={{ y: -2 }}
142+
whileTap={{ scale: 0.98 }}
143+
onClick={handleCopyCurrentLink}
144+
className="w-full flex items-center justify-between p-3 sm:p-4 bg-white dark:bg-gray-800 rounded-xl border border-[#E5E6EC] dark:border-gray-700/30 hover:border-gray-300 dark:hover:border-gray-600/70 transition-all duration-200"
145+
>
146+
<div className="flex items-center">
147+
<div className="w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center text-gray-700 dark:text-gray-300 mr-3">
148+
<FiLink size={16} className="sm:hidden" />
149+
<FiLink size={20} className="hidden sm:block" />
150+
</div>
151+
<div className="text-left">
152+
<h4 className="font-medium text-gray-800 dark:text-gray-200 text-sm sm:text-base">
153+
Copy Link
154+
</h4>
155+
<p className="text-xs text-gray-500 dark:text-gray-400 hidden sm:block">
156+
Copy current conversation link
157+
</p>
158+
</div>
159+
</div>
160+
<div className="w-6 h-6 sm:w-8 sm:h-8 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center">
161+
{linkCopied ? (
162+
<FiCheck size={14} className="sm:hidden text-green-500 dark:text-green-400" />
163+
) : (
164+
<FiShare2 size={14} className="sm:hidden text-gray-500 dark:text-gray-400" />
165+
)}
166+
{linkCopied ? (
167+
<FiCheck size={16} className="hidden sm:block text-green-500 dark:text-green-400" />
168+
) : (
169+
<FiShare2 size={16} className="hidden sm:block text-gray-500 dark:text-gray-400" />
170+
)}
171+
</div>
172+
</motion.button>
173+
131174
{shareConfig.hasShareProvider && (
132175
<motion.button
133176
whileHover={{ y: -2 }}

0 commit comments

Comments
 (0)