From 14a71db04a626c3926cf6fba0363c7d32791bfd1 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 18 Jan 2026 19:06:56 +0100 Subject: [PATCH] feat(settings): add public link sharing functionality and improve UI for password protection --- app/sites/[id]/settings/page.tsx | 65 ++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/app/sites/[id]/settings/page.tsx b/app/sites/[id]/settings/page.tsx index 4b2729d..fd90be8 100644 --- a/app/sites/[id]/settings/page.tsx +++ b/app/sites/[id]/settings/page.tsx @@ -40,6 +40,7 @@ export default function SiteSettingsPage() { excluded_paths: '' }) const [scriptCopied, setScriptCopied] = useState(false) + const [linkCopied, setLinkCopied] = useState(false) useEffect(() => { loadSite() @@ -127,6 +128,14 @@ export default function SiteSettingsPage() { setTimeout(() => setScriptCopied(false), 2000) } + const copyLink = () => { + const link = `${APP_URL}/share/${siteId}` + navigator.clipboard.writeText(link) + setLinkCopied(true) + toast.success('Link copied to clipboard') + setTimeout(() => setLinkCopied(false), 2000) + } + if (loading) { return } @@ -275,21 +284,47 @@ export default function SiteSettingsPage() { {formData.is_public && ( -
- - setFormData({ ...formData, password: e.target.value })} - placeholder="Leave empty to keep existing password (if any)" - className="w-full px-4 py-2 border border-neutral-300 dark:border-neutral-700 rounded-lg bg-white dark:bg-neutral-800 text-neutral-900 dark:text-white focus:ring-2 focus:ring-brand-orange focus:border-transparent" - /> -

- Set a password to restrict access to the public dashboard. -

+
+
+ +
+ + +
+

+ Share this link with others to view the dashboard. +

+
+ +
+ + setFormData({ ...formData, password: e.target.value })} + placeholder="Leave empty to keep existing password (if any)" + className="w-full px-4 py-2 border border-neutral-300 dark:border-neutral-700 rounded-lg bg-white dark:bg-neutral-800 text-neutral-900 dark:text-white focus:ring-2 focus:ring-brand-orange focus:border-transparent" + /> +

+ Set a password to restrict access to the public dashboard. +

+
)}