diff --git a/src/webapp/app/bookmarklet/page.tsx b/src/webapp/app/bookmarklet/page.tsx new file mode 100644 index 00000000..a49d12bf --- /dev/null +++ b/src/webapp/app/bookmarklet/page.tsx @@ -0,0 +1,135 @@ +'use client'; + +import { + Container, + Title, + Text, + Stack, + Button, + Code, + Alert, + Box, + Group, + Anchor, +} from '@mantine/core'; +import { useState } from 'react'; +import { BiInfoCircle } from 'react-icons/bi'; +import { RiDragDropLine } from 'react-icons/ri'; + +export default function BookmarkletPage() { + const [copied, setCopied] = useState(false); + + const appUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'; + + const bookmarkletCode = `javascript:(function(){ + const currentUrl = encodeURIComponent(window.location.href); + const sembleUrl = '${appUrl}/url?id=' + currentUrl; + window.open(sembleUrl, '_blank'); + })();`; + + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(bookmarkletCode); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch (err) { + console.error('Failed to copy bookmarklet:', err); + } + }; + + return ( + + + + Semble Bookmarklet + + Add this bookmarklet to your browser to quickly open any webpage in Semble + and see what your network has shared about it. + + + + } title="How to install" color="blue"> + + + 1. Copy the bookmarklet code below or drag the button to your bookmarks bar + + + 2. When you're on any webpage, click the bookmarklet to open it in Semble + + + 3. You'll see who in your network has shared that URL and any notes they've added + + + + + + + Method 1: Drag to Bookmarks Bar + + + Drag this button directly to your browser's bookmarks bar: + + + + + Open in Semble + + + + + + + Method 2: Copy Code + + + Copy this code and create a new bookmark with it as the URL: + + + + {bookmarkletCode} + + + + + + } title="Note" color="gray"> + + This bookmarklet will open Semble in a new tab. Make sure you're logged in + to see personalized results from your network. + + + + + ); +}