{"version":3,"file":"PageHeader-lRcjKcpX.js","sources":["../../src/components/ShareTool.tsx","../../src/lib/email.ts","../../src/components/PageHeader.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Share2, Copy, Check, Mail, Link2, Facebook, X as XIcon } from 'lucide-react';\nimport { sendEmail } from '../lib/email';\nimport { toast } from 'react-hot-toast';\n\ninterface ShareToolProps {\n title: string;\n description: string;\n url?: string;\n}\n\nfunction ShareTool({ title, description, url = window.location.href }: ShareToolProps) {\n const [copied, setCopied] = useState(false);\n const [showEmailForm, setShowEmailForm] = useState(false);\n const [email, setEmail] = useState('');\n\n const copyToClipboard = async () => {\n try {\n await navigator.clipboard.writeText(url);\n setCopied(true);\n toast.success('Link copied to clipboard!');\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error('Failed to copy link:', err);\n toast.error('Failed to copy link');\n }\n };\n\n const shareOnX = () => {\n const text = encodeURIComponent(`Check out ${title} - ${description}`);\n window.open(`https://x.com/intent/tweet?text=${text}&url=${encodeURIComponent(url)}`, '_blank');\n };\n\n const shareOnFacebook = () => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`, '_blank');\n };\n\n const handleEmailShare = async (e: React.FormEvent) => {\n e.preventDefault();\n \n try {\n await sendEmail({\n to: email,\n subject: `Check out this tool: ${title}`,\n html: `\n

${title}

\n

${description}

\n

Try it out here: ${url}

\n `,\n });\n setShowEmailForm(false);\n setEmail('');\n toast.success('Email sent successfully!');\n } catch (error) {\n console.error('Error sending email:', error);\n toast.error('Failed to send email');\n }\n };\n\n return (\n
\n
\n setShowEmailForm(!showEmailForm)}\n className=\"p-2 text-gray-400 hover:text-gray-300 light:text-gray-600 light:hover:text-gray-900 transition-colors rounded-lg hover:bg-gray-700 light:hover:bg-gray-100\"\n title=\"Share via email\"\n >\n \n \n\n {showEmailForm && (\n
\n
\n
\n \n setEmail(e.target.value)}\n className=\"w-full rounded-lg bg-gray-700 light:bg-white border-gray-600 light:border-gray-200 text-gray-100 light:text-gray-900\"\n required\n />\n
\n
\n setShowEmailForm(false)}\n className=\"px-3 py-1 text-gray-400 hover:text-gray-300 light:text-gray-600 light:hover:text-gray-900\"\n >\n Cancel\n \n \n Send\n \n
\n
\n
\n )}\n
\n\n \n \n \n\n \n \n \n\n \n {copied ? (\n \n ) : (\n \n )}\n \n
\n );\n}\n\nexport default ShareTool;","import { toast } from 'react-hot-toast';\n\ninterface EmailOptions {\n to: string;\n subject: string;\n text?: string;\n html?: string;\n}\n\nexport async function sendEmail({ to, subject, text, html }: EmailOptions) {\n try {\n const response = await fetch('/api/send-email', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ to, subject, text, html }),\n });\n\n if (!response.ok) {\n const data = await response.json();\n throw new Error(data.error || 'Failed to send email');\n }\n\n const data = await response.json();\n toast.success('Email sent successfully!');\n return data;\n } catch (error) {\n console.error('Error sending email:', error);\n toast.error(error instanceof Error ? error.message : 'Failed to send email');\n throw error;\n }\n}","import React from 'react';\nimport ShareTool from './ShareTool';\n\ninterface PageHeaderProps {\n title: string;\n description: string;\n subtitle?: string;\n}\n\nfunction PageHeader({ title, description, subtitle }: PageHeaderProps) {\n return (\n
\n
\n

{title}

\n {subtitle && (\n

{subtitle}

\n )}\n

\n {description}\n

\n
\n
\n \n
\n
\n );\n}\n\nexport default PageHeader;"],"names":["ShareTool","title","description","url","window","location","href","copied","setCopied","useState","showEmailForm","setShowEmailForm","email","setEmail","jsxs","className","children","jsxRuntimeExports","jsx","onClick","Mail","onSubmit","async","e","preventDefault","to","subject","text","html","response","fetch","method","headers","body","JSON","stringify","ok","data","json","Error","error","toast","success","message","sendEmail","type","value","onChange","target","required","encodeURIComponent","open","XIcon","Facebook","navigator","clipboard","writeText","setTimeout","err","Check","Link2","PageHeader","subtitle"],"mappings":"6LAWA,SAASA,GAAUC,MAAEA,EAAOC,YAAAA,EAAAC,IAAaA,EAAMC,OAAOC,SAASC,OAC7D,MAAOC,EAAQ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