diff --git a/components/doctor/detailDoctor/List.js b/components/doctor/detailDoctor/List.js
index 4de120a..9b16283 100644
--- a/components/doctor/detailDoctor/List.js
+++ b/components/doctor/detailDoctor/List.js
@@ -9,8 +9,9 @@ import LinkedingBlueD from "@/components/icons/LinkedingBlueD";
import html2canvas from "html2canvas";
import jsPDF from "jspdf";
import { Button } from "@mui/material";
+import { toast } from "react-toastify";
-function List({ hiddenRef }) {
+function List({ hiddenRef, data }) {
const handleDownloadPDF = async () => {
const element = hiddenRef.current;
if (!element) return;
@@ -38,12 +39,51 @@ function List({ hiddenRef }) {
pdf.save("poster.pdf");
};
+ const getShareUrl = () =>
+ typeof window !== "undefined" ? window.location.href : "";
+
+ const getShareText = () =>
+ data?.name ? `معرفی ${data.name} در نوبت 724` : "معرفی پزشک در نوبت 724";
+
+ const openShareWindow = (url) => {
+ if (typeof window !== "undefined") {
+ window.open(url, "_blank", "noopener,noreferrer");
+ }
+ };
+
+ const handleWhatsapp = () => {
+ const text = encodeURIComponent(`${getShareText()}\n${getShareUrl()}`);
+ openShareWindow(`https://wa.me/?text=${text}`);
+ };
+
+ const handleTelegram = () => {
+ const url = encodeURIComponent(getShareUrl());
+ const text = encodeURIComponent(getShareText());
+ openShareWindow(`https://t.me/share/url?url=${url}&text=${text}`);
+ };
+
+ const handleLinkedin = () => {
+ const url = encodeURIComponent(getShareUrl());
+ openShareWindow(
+ `https://www.linkedin.com/sharing/share-offsite/?url=${url}`
+ );
+ };
+
+ const handleCopyLink = async () => {
+ try {
+ await navigator.clipboard.writeText(getShareUrl());
+ toast.success("لینک کپی شد");
+ } catch {
+ toast.error("کپی لینک ناموفق بود");
+ }
+ };
+
const listIcons = [
- { name: "واتساپ", icon:
شما می توانید این پزشک را با دیگران به اشتراک بگذارید:
-