diff --git a/frontend/src/components/SeoPreview/SeoPreview.tsx b/frontend/src/components/SeoPreview/SeoPreview.tsx new file mode 100644 index 0000000..84139ca --- /dev/null +++ b/frontend/src/components/SeoPreview/SeoPreview.tsx @@ -0,0 +1,131 @@ +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; + +interface SeoPreviewData { + seo?: { + ogImage?: string; + ogTitle?: string; + seoTitle?: string; + ogDescription?: string; + metaDescription?: string; + slug?: string; + }; + doctorId?: string; + name?: string; +} + +interface SeoPreviewProps { + open: boolean; + onOpenChange: (open: boolean) => void; + previewData?: SeoPreviewData | null; + url?: string; + title?: string; +} + +export default function SeoPreview({ + open, + onOpenChange, + previewData, + url, + title = "SEO Preview", +}: SeoPreviewProps) { + const previewUrl = url || "#"; + const imageUrl = + previewData?.seo?.ogImage || "https://placehold.co/1200x630?text=GG+Hospital"; + const ogTitle = + previewData?.seo?.ogTitle || previewData?.seo?.seoTitle || "GG Hospital"; + const ogDescription = + previewData?.seo?.ogDescription || previewData?.seo?.metaDescription || + "No description available"; + const searchTitle = + previewData?.seo?.seoTitle || previewData?.seo?.ogTitle || "SEO title preview"; + const searchDescription = + previewData?.seo?.metaDescription || previewData?.seo?.ogDescription || + "No meta description available"; + + return ( + + + + {title} + + + {previewData ? ( + + + + Social Media Preview (WhatsApp / Facebook) + + + + + + + + + + gg-hospital.com + + + + {ogTitle} + + + + {ogDescription} + + + + + + + + Google Search Preview + + + + + + {previewUrl} + + + + {searchTitle} + + + + + {searchDescription} + + + + + ) : ( + + No preview data available. + + )} + + + onOpenChange(false)}> + Close + + + + + ); +} diff --git a/frontend/src/pages/Doctor.tsx b/frontend/src/pages/Doctor.tsx index 2b7ce0d..c127f6f 100644 --- a/frontend/src/pages/Doctor.tsx +++ b/frontend/src/pages/Doctor.tsx @@ -28,6 +28,7 @@ import { DialogTitle, DialogFooter, } from "@/components/ui/dialog"; +import SeoPreview from "@/components/SeoPreview/SeoPreview"; import { Input } from "@/components/ui/input"; import { Badge } from "@/components/ui/badge"; import { Switch } from "@/components/ui/switch"; @@ -1159,97 +1160,12 @@ export default function DoctorPage() { - - - - SEO Preview - - - {previewDoctor && ( - - {/* SOCIAL MEDIA PREVIEW */} - - - Social Media Preview (WhatsApp / Facebook) - - - - {/* IMAGE */} - - - - - {/* CONTENT */} - - - gg-hospital.com - - - - {previewDoctor?.seo?.ogTitle || - previewDoctor?.seo?.seoTitle || - "GG Hospital"} - - - - {previewDoctor?.seo?.ogDescription || - previewDoctor?.seo?.metaDescription || - "No description available"} - - - - - - {/* GOOGLE SEARCH PREVIEW */} - - - Google Search Preview - - - - - {/* URL */} - - {getDoctorUrl(previewDoctor)} - - - {/* TITLE */} - - {previewDoctor?.seo?.seoTitle || - previewDoctor?.seo?.ogTitle || - "SEO title preview"} - - - - {/* DESCRIPTION */} - - {previewDoctor?.seo?.metaDescription || - previewDoctor?.seo?.ogDescription || - "No meta description available"} - - - - - )} - - + ); }
+ Social Media Preview (WhatsApp / Facebook) +
+ gg-hospital.com +
+ {ogDescription} +
+ Google Search Preview +
+ {previewUrl} +
+ {searchDescription} +
- Social Media Preview (WhatsApp / Facebook) -
- gg-hospital.com -
- {previewDoctor?.seo?.ogDescription || - previewDoctor?.seo?.metaDescription || - "No description available"} -
- Google Search Preview -
- {getDoctorUrl(previewDoctor)} -
- {previewDoctor?.seo?.metaDescription || - previewDoctor?.seo?.ogDescription || - "No meta description available"} -