Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | 1x 4x 4x 4x 4x 4x 4x 4x 4x 1x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 3x 3x 7x 2x 1x 5x 3x 1x 2x 2x 1x | import { useEffect } from 'react'
import { useLocation, Link, Navigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Button } from '@core/components/ui/button'
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from '@core/components/ui/card'
import { CheckCircle, Share2 } from 'lucide-react'
import { useAppConfig } from '@core/providers/AppConfigProvider'
import { fireConfetti } from '@core/lib/confetti'
export const ThankYouPage = () => {
const { t } = useTranslation('common')
const { config } = useAppConfig()
const location = useLocation()
const { slug } = useParams()
const state = location.state as {
amount?: number
transactionId?: string
donorName?: string
} | null
useEffect(() => {
fireConfetti()
}, [])
if (!state?.amount) {
return <Navigate to="/donate" replace />
}
const shareUrl = window.location.origin
const shareText = t('thankyou.share_text', {
defaultValue: 'I just donated to support this amazing cause! Join me at {{url}}',
url: shareUrl,
})
const handleShare = (platform: 'twitter' | 'facebook' | 'linkedin') => {
let url = ''
switch (platform) {
case 'twitter':
url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`
break
case 'facebook':
url = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`
break
case 'linkedin':
url = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}`
break
}
window.open(url, '_blank', 'width=600,height=400')
}
return (
<div
className="min-h-screen animate-gradient-xy flex items-center justify-center p-4"
style={{
background:
'linear-gradient(to bottom right, var(--thankyou-gradient-start), var(--thankyou-gradient-via), var(--thankyou-gradient-end))',
}}
>
<Card
className="max-w-md w-full backdrop-blur-xl shadow-[0_-4px_20px_-5px_rgba(0,0,0,0.1)] border-t rounded-3xl overflow-hidden"
style={{
backgroundColor: 'var(--thankyou-card-bg)',
borderColor: 'var(--thankyou-card-border)',
borderRadius: 'var(--panel-radius, 1.5rem)',
}}
>
<CardHeader className="text-center pb-2">
<div
className="mx-auto w-16 h-16 rounded-full flex items-center justify-center mb-4"
style={{
backgroundColor: 'var(--thankyou-icon-bg)',
outline: '4px solid rgba(220,252,231,0.3)',
}}
>
<CheckCircle
className="w-8 h-8"
style={{ color: 'var(--thankyou-icon-color)' }}
/>
</div>
<CardTitle
className="text-3xl font-bold"
style={{ color: 'var(--thankyou-title-color)' }}
>
{t('donation.success')}
</CardTitle>
<CardDescription
className="text-lg mt-2"
style={{ color: 'var(--thankyou-message-color)' }}
>
{t('donation.success_detail', { amount: `$${state.amount}` })}
</CardDescription>
</CardHeader>
<CardContent className="space-y-6 pt-6">
<div
className="p-4 rounded-lg space-y-2 text-sm"
style={{ backgroundColor: 'var(--thankyou-receipt-bg)' }}
>
{state.transactionId && (
<div className="flex justify-between">
<span style={{ color: 'var(--thankyou-receipt-label)' }}>
{t('thankyou.receipt.transaction_id')}
</span>
<span
className="font-mono"
style={{ color: 'var(--thankyou-receipt-text)' }}
>
{state.transactionId}
</span>
</div>
)}
<div className="flex justify-between">
<span style={{ color: 'var(--thankyou-receipt-label)' }}>
{t('thankyou.receipt.date')}
</span>
<span style={{ color: 'var(--thankyou-receipt-text)' }}>
{new Date().toLocaleDateString()}
</span>
</div>
{state.donorName && (
<div className="flex justify-between">
<span style={{ color: 'var(--thankyou-receipt-label)' }}>
{t('thankyou.receipt.from')}
</span>
<span
className="font-medium"
style={{ color: 'var(--thankyou-receipt-text)' }}
>
{state.donorName}
</span>
</div>
)}
</div>
<div className="space-y-3">
<div
className="text-center text-sm font-medium flex items-center justify-center gap-2"
style={{ color: 'var(--thankyou-share-label)' }}
>
<Share2 className="w-4 h-4" />
{t('thankyou.receipt.share_label')}
</div>
<div className="flex justify-center gap-4">
{config.donation.sharing?.enabled &&
config.donation.sharing.networks.map((network: string) => {
if (network === 'facebook') {
return (
<Button
key={network}
variant="outline"
size="icon"
onClick={() => handleShare('facebook')}
className="hover:opacity-80 hover:text-[#1877F2] hover:border-[#1877F2]"
aria-label="Facebook"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="lucide lucide-facebook"
>
<path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z" />
</svg>
</Button>
)
}
if (network === 'twitter') {
return (
<Button
key={network}
variant="outline"
size="icon"
onClick={() => handleShare('twitter')}
className="hover:opacity-80 hover:text-[#1DA1F2] hover:border-[#1DA1F2]"
aria-label="Twitter"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="lucide lucide-twitter"
>
<path d="M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-12.7 12.5S1.2 5.3 7.6 4.5c2.1-.3 3.3.4 3.3.4s0-1.9 1.9-2.3c3-.7 5.1 2.3 5.4 3.5 1-.3 2.1-.8 2.1-.8s-.6 2.3-1.8 3.1c.9-.1 1.8-.3 1.8-.3s-.3 1.8-1.3 2.8" />
</svg>
</Button>
)
}
Eif (network === 'linkedin') {
return (
<Button
key={network}
variant="outline"
size="icon"
onClick={() => handleShare('linkedin')}
className="hover:opacity-80 hover:text-[#0A66C2] hover:border-[#0A66C2]"
aria-label="LinkedIn"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="lucide lucide-linkedin"
>
<path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z" />
<rect width="4" height="12" x="2" y="9" />
<circle cx="4" cy="4" r="2" />
</svg>
</Button>
)
}
return null
})}
</div>
</div>
</CardContent>
<CardFooter className="flex flex-col gap-3">
<Button
asChild
className="w-full h-12 text-lg hover:opacity-90"
style={{
backgroundColor: 'var(--thankyou-button-bg)',
color: 'var(--thankyou-button-text)',
}}
>
<Link to={`/${slug}/donate`}>{t('donation.make_another')}</Link>
</Button>
</CardFooter>
</Card>
</div>
)
}
|