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.

add copy tag id button

Steven Teyd51c1a2ba6f1
diff --git a/apps/web/ui/links/link-filters.tsx b/apps/web/ui/links/link-filters.tsx
index 426b3850ea..4e4f5709c2 100644
--- a/apps/web/ui/links/link-filters.tsx
+++ b/apps/web/ui/links/link-filters.tsx
@@ -8,11 +8,13 @@ import { useAddEditTagModal } from "@/ui/modals/add-edit-tag-modal";
import { Delete, ThreeDots } from "@/ui/shared/icons";
import {
Button,
+ Copy,
LoadingCircle,
LoadingSpinner,
NumberTooltip,
Popover,
Switch,
+ Tick,
useRouterStuff,
} from "@dub/ui";
import {
@@ -454,6 +456,8 @@ const TagPopover = ({ tag, count }: { tag: TagProps; count: number }) => {
});
};
+ const [copied, setCopied] = useState(false);
+
return processing ? (
<div className="flex h-6 items-center justify-center">
<LoadingCircle />
@@ -471,6 +475,25 @@ const TagPopover = ({ tag, count }: { tag: TagProps; count: number }) => {
icon={<Edit3 className="h-4 w-4" />}
className="h-9 w-full justify-start px-2 font-medium"
/>
+ <Button
+ type="button"
+ text="Copy Tag ID"
+ variant="outline"
+ onClick={() => {
+ navigator.clipboard.writeText(tag.id);
+ setCopied(true);
+ toast.success("Tag ID copied");
+ setTimeout(() => setCopied(false), 3000);
+ }}
+ icon={
+ copied ? (
+ <Tick className="h-4 w-4" />
+ ) : (
+ <Copy className="h-4 w-4" />
+ )
+ }
+ className="h-9 w-full justify-start px-2 font-medium"
+ />
<Button
type="button"
text="Delete"