import React, { useState } from 'react'; import PublicNavbar from '../components/PublicNavbar'; import PublicFooter from '../components/PublicFooter'; import { Button } from '../components/ui/button'; import { Card } from '../components/ui/card'; import { Input } from '../components/ui/input'; import { Label } from '../components/ui/label'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '../components/ui/dialog'; import { CreditCard, Mail, Heart, Loader2 } from 'lucide-react'; import api from '../utils/api'; import { toast } from 'sonner'; const Donate = () => { const loafHearts = `${process.env.PUBLIC_URL}/loaf-hearts.png`; const zelleLogo = `${process.env.PUBLIC_URL}/zelle-logo.png`; const [customAmountDialogOpen, setCustomAmountDialogOpen] = useState(false); const [customAmount, setCustomAmount] = useState(''); const [processingAmount, setProcessingAmount] = useState(null); const handleDonateAmount = async (amountCents) => { setProcessingAmount(amountCents); try { const response = await api.post('/donations/checkout', { amount_cents: amountCents }); // Redirect to Stripe Checkout window.location.href = response.data.checkout_url; } catch (error) { console.error('Failed to process donation:', error); toast.error(error.response?.data?.detail || 'Failed to process donation. Please try again.'); setProcessingAmount(null); } }; const handleCustomDonate = () => { const amount = parseFloat(customAmount); if (!customAmount || isNaN(amount) || amount < 1) { toast.error('Please enter a valid amount (minimum $1.00)'); return; } const amountCents = Math.round(amount * 100); setCustomAmountDialogOpen(false); handleDonateAmount(amountCents); }; return (
{/* Hero Section */}
Hearts e.target.style.display = 'none'} />

Donate

We really appreciate your donations. You can make your donation online or send a check by mail.

{/* Columns */}
{/* Donation Amount Buttons */}

Select Your Donation Amount

{/* Donation Buttons Grid */}
{[25, 50, 100, 250].map(amount => ( ))}
{/* Custom Amount Button */}

Secure donation processing powered by Stripe

{/* Alternative Payment Methods */}
{/* Mail Check */}

Mail a Check

Our mailing address for checks:
LOAF
P.O. Box 7207
Houston, Texas 77248-7207

{/* Zelle */}
Zelle e.target.style.display = 'none'} />

Pay with Zelle

If your bank allows the use of Zelle, please feel free to send money to:

LOAFHoustonTX@gmail.com
{/* Columns end */}
{/* Custom Amount Dialog */} Enter Donation Amount Choose how much you'd like to donate to support our community
$ setCustomAmount(e.target.value)} placeholder="50.00" className="pl-10 h-14 text-xl border-2 border-[#ddd8eb] focus:border-[#664fa3] rounded-xl" onKeyPress={(e) => { if (e.key === 'Enter') { handleCustomDonate(); } }} />

Minimum donation: $1.00

Thank you for supporting LOAF!
Your donation helps us continue our mission and provide meaningful experiences for our community.

); }; export default Donate;