Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

copy stats page to clipboard when made public

Steven Teyea5bd4caad77
diff --git a/app/ui/stats/toggle.tsx b/app/ui/stats/toggle.tsx
index 0541c404c2..3fdec1463c 100644
--- a/app/ui/stats/toggle.tsx
+++ b/app/ui/stats/toggle.tsx
@@ -152,6 +152,8 @@ const SharePopover = () => {
});
if (res.status === 200) {
mutate(`${endpoint}${queryString}`);
+ !publicStats &&
+ navigator.clipboard.writeText(`https://${domain}/stats/${key}`);
// artificial delay to sync toast with the switch change
await new Promise((r) => setTimeout(r, 200));
}
@@ -160,7 +162,9 @@ const SharePopover = () => {
}),
{
loading: "Updating...",
- success: `Stats page is now ${publicStats ? "private" : "public"}`,
+ success: `Stats page is now ${
+ publicStats ? "private." : "public. Link copied to clipboard."
+ }`,
error: "Something went wrong",
},
);
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsx
index b5fc18bbb2..abcd750091 100644
--- a/components/stats/toggle.tsx
+++ b/components/stats/toggle.tsx
@@ -175,6 +175,8 @@ const SharePopover = () => {
});
if (res.status === 200) {
mutate(`${endpoint}${queryString}`);
+ !publicStats &&
+ navigator.clipboard.writeText(`https://${domain}/stats/${key}`);
// artificial delay to sync toast with the switch change
await new Promise((r) => setTimeout(r, 200));
}
@@ -183,7 +185,9 @@ const SharePopover = () => {
}),
{
loading: "Updating...",
- success: `Stats page is now ${publicStats ? "private" : "public"}`,
+ success: `Stats page is now ${
+ publicStats ? "private." : "public. Link copied to clipboard."
+ }`,
error: "Something went wrong",
},
);