Write on the margins of the internet. Powered by the AT Protocol.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: navigate to own page instead of copying link

+5 -14
+5 -14
web/src/views/content/UrlPage.tsx
··· 35 35 "all" | "annotations" | "highlights" 36 36 >("all"); 37 37 const [copied, setCopied] = useState(false); 38 - const [userLinkCopied, setUserLinkCopied] = useState(false); 39 38 const user = useStore($user); 40 39 41 40 useEffect(() => { ··· 71 70 } 72 71 }, []); 73 72 74 - const handleCopyUserLink = useCallback(async () => { 73 + const handleNavigateMyAnnotations = useCallback(async () => { 75 74 if (!user?.handle || !targetUrl) return; 76 - try { 77 - const url = `${window.location.origin}/${user.handle}/url/${encodeURIComponent(targetUrl)}`; 78 - await navigator.clipboard.writeText(url); 79 - setUserLinkCopied(true); 80 - setTimeout(() => setUserLinkCopied(false), 2000); 81 - } catch (err) { 82 - console.error("Failed to copy user link:", err); 83 - } 84 - }, [user?.handle, targetUrl]); 75 + navigate(`/${user.handle}/url/${encodeURIComponent(targetUrl)}`); 76 + }, [user?.handle, targetUrl, navigate]); 85 77 86 78 const totalItems = annotations.length + highlights.length; 87 79 ··· 185 177 <div className="flex items-center gap-2 shrink-0"> 186 178 {user && ( 187 179 <button 188 - onClick={handleCopyUserLink} 180 + onClick={handleNavigateMyAnnotations} 189 181 className="flex items-center gap-1.5 px-3 py-1.5 bg-surface-100 dark:bg-surface-700 hover:bg-surface-200 dark:hover:bg-surface-600 text-surface-700 dark:text-surface-200 text-sm font-medium rounded-lg transition-colors" 190 182 title="Copy link to your annotations on this page" 191 183 > 192 - {userLinkCopied ? <Check size={14} /> : <User size={14} />} 193 - {userLinkCopied ? "Copied!" : "My Link"} 184 + <User size={14} /> My Annotations 194 185 </button> 195 186 )} 196 187 <button