diff --git a/frontend/src/components/ContactCard.vue b/frontend/src/components/ContactCard.vue
index ece64391..3c2c8276 100644
--- a/frontend/src/components/ContactCard.vue
+++ b/frontend/src/components/ContactCard.vue
@@ -126,6 +126,21 @@
>
{{ mail.mail }}
+
+
+ {{ copyError }}
+
@@ -255,6 +273,7 @@ import Button from "./ui/button/Button.vue";
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
import ContactForm from "./companies/ContactForm.vue";
import type { CreateCompanyRepData } from "@/dto/companies";
+import { ClipboardIcon, CheckIcon } from "lucide-vue-next";
interface Props {
contact?: Contact;
@@ -403,6 +422,27 @@ const hasSocials = (socials?: ContactSocials): boolean => {
);
};
+const copiedEmail = ref(null);
+const copyError = ref(null);
+
+const copyEmail = async (email: string) => {
+ if (!navigator?.clipboard) {
+ copyError.value = "Clipboard not available";
+ setTimeout(() => (copyError.value = null), 2000);
+ return;
+ }
+
+ try {
+ await navigator.clipboard.writeText(email);
+ copiedEmail.value = email;
+ setTimeout(() => (copiedEmail.value = null), 2000);
+ } catch (err) {
+ copyError.value = "Failed to copy email";
+ setTimeout(() => (copyError.value = null), 2000);
+ console.error("Failed to copy email:", err);
+ }
+};
+
const linkedinUrl = (username: string): string => {
if (username.startsWith("http")) return username;
return `https://linkedin.com/in/${username}`;