Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
💄 Show a toast when copying poll and event links (#3355)
Luke Vella979c8a46fda0
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex 36bda3454..bbc41a176 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -478,6 +478,7 @@"licenseKeyGenericError": "An error occurred while validating the license key","licenseLimitWarning": "You have exceeded the limits of your license. Please <a>upgrade</a>.","licenseType": "License type",+ "linkCopied": "Link copied","loading": "Loading...","location": "Location","locationCustomLink": "Custom link",diff --git a/apps/web/src/components/copy-link-button.tsx b/apps/web/src/components/copy-link-button.tsxindex 324bdea70..fabc90148 100644--- a/apps/web/src/components/copy-link-button.tsx+++ b/apps/web/src/components/copy-link-button.tsx@@ -1,9 +1,9 @@"use client";import { Button } from "@rallly/ui/button";+import { toast } from "@rallly/ui/sonner";import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";-import { CheckIcon, CopyIcon } from "lucide-react";-import { useState } from "react";+import { LinkIcon } from "lucide-react";import { useCopyToClipboard } from "react-use";import { useTranslation } from "@/i18n/client";@@ -16,10 +16,9 @@ export function CopyLinkButton({className?: string;}) {const [, copy] = useCopyToClipboard();- const [didCopy, setDidCopy] = useState(false);const { t } = useTranslation();return (- <Tooltip open={didCopy ? true : undefined}>+ <Tooltip><TooltipTriggerrender={<Button@@ -29,23 +28,15 @@ export function CopyLinkButton({size="icon"onClick={() => {copy(href);- setDidCopy(true);- setTimeout(() => setDidCopy(false), 1000);+ toast.success(t("linkCopied", { defaultValue: "Link copied" }));}}>- <CopyIcon className="text-muted-foreground" />+ <LinkIcon className="text-muted-foreground" /></Button>}/><TooltipContent>- {didCopy ? (- <div className="flex items-center gap-2">- <CheckIcon className="size-4 text-green-400" />- {t("copied", { defaultValue: "Copied" })}- </div>- ) : (- <p>{t("copyLink", { defaultValue: "Copy link" })}</p>- )}+ <p>{t("copyLink", { defaultValue: "Copy link" })}</p></TooltipContent></Tooltip>);