diff --git a/client/src/pages/find-donors.tsx b/client/src/pages/find-donors.tsx index a33efe1..43eacd0 100644 --- a/client/src/pages/find-donors.tsx +++ b/client/src/pages/find-donors.tsx @@ -698,4 +698,4 @@ export default function FindDonors() { ); -} \ No newline at end of file +} diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 4695e5f..94da09e 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -16,12 +16,35 @@ import { Plus, Search, Sparkles, - Shield + Shield, } from "lucide-react"; import { motion } from "framer-motion"; import type { Donor, Donation } from "@shared/schema"; +/* -------------------------------------------------------------------------- */ +/* ANIMATIONS */ +/* -------------------------------------------------------------------------- */ + +const fadeInUp = { + hidden: { opacity: 0, y: 12 }, + visible: { opacity: 1, y: 0 }, +}; + +const staggerContainer = { + hidden: {}, + visible: { + transition: { + staggerChildren: 0.12, + }, + }, +}; + +const subtleFade = { + hidden: { opacity: 0 }, + visible: { opacity: 1 }, +}; + export default function Home() { const { toast } = useToast(); const queryClient = useQueryClient(); @@ -33,13 +56,17 @@ export default function Home() { if (!isLoading && !isAuthenticated) { toast({ title: "Unauthorized", - description: "You are logged out. Redirecting...", + description: "You are logged out. Redirecting you to login…", variant: "destructive", }); setTimeout(() => (window.location.href = "/api/login"), 800); } }, [isAuthenticated, isLoading, toast]); + /* -------------------------------------------------------------------------- */ + /* QUERIES */ + /* -------------------------------------------------------------------------- */ + const { data: donor, isLoading: donorLoading } = useQuery({ queryKey: ["/api/donors/me"], retry: false, @@ -63,11 +90,20 @@ export default function Home() { if (isLoading || donorLoading) { return ( -
+
-
-
- Loading… +
+
+
+
+ +
+

+ Preparing your dashboard… +

+

+ Fetching your donor profile and activity +

@@ -148,236 +184,347 @@ export default function Home() { /* -------------------------------------------------------------------------- */ return ( -
-
+
+ {/* Soft background accent blur */} +
+
+
+
-
+
- {/* Resume Donor Registration */} + + {/* Resume Donor Registration Banner */} {!donor && ( -
+

Complete Your Donor Profile

- Unlock credits, increase visibility & help your community. + Unlock credits, boost your visibility, and help your local community.

- )} - {/* Welcome */} - -

+

+ + {greeting}, {donor?.name ?? "donor"} +

+ +

Welcome to PulseConnect

-

- Your dashboard for donations & community impact. + +

+ Track your donations, manage your credits, and see the impact you're + making in your community.

-
+ {/* Quick Actions */} - {[ { title: "Become a Donor", - desc: "Register to help save lives", + desc: "Register now and be the reason someone gets a second chance.", icon: , link: "/register-donor", variant: "secondary", - iconColor: "bg-secondary/10", + iconColor: "bg-secondary/15", + chip: "Start giving", }, { title: "Find Donors", - desc: "Search for blood donors nearby", + desc: "Search verified donors nearby whenever there is an emergency.", icon: , link: "/find-donors", variant: "outline", iconColor: "bg-accent/10", + chip: "Emergency ready", }, ].map((item, idx) => ( - - -
{item.icon}
-
-

{item.title}

-

{item.desc}

+ +
+ +
+ {item.icon} +
+
+
+ + {item.chip} + +
+

{item.title}

+

+ {item.desc} +

-
))} - + - {/* Donor Profile Section */} + {/* Donor Profile / Empty State */} {donor ? ( - {/* Donor Info */} - - - - Donor Profile - - - -
- Blood Group: - {donor.bloodGroup} -
-
- Total Donations: - {donor.totalDonations} -
-
- Credits: - {donor.credits} -
-
- Status: - - {eligibilityLoading - ? "Checking..." - : eligibility?.canDonate - ? "Eligible" - : "Not Eligible"} - -
-
-
+ + + + + + + Donor Profile + + + + + Verified + + + + + +
+ Blood Group + + {donor.bloodGroup} + +
+
+ Total Donations + {donor.totalDonations} +
+
+ Credits + + {donor.credits} + +
+
+ Status + + {eligibilityLoading + ? "Checking..." + : eligibility?.canDonate + ? "Eligible to donate" + : "Not eligible yet"} + +
+
+
+
{/* Recent Activity */} - - - - Recent Activity - - - - {donationsLoading ? ( -

Loading...

- ) : donations.length ? ( -
- {donations.slice(0, 3).map((d) => ( -
-
-

Blood Donation

-

- {new Date(d.donationDate).toLocaleDateString()} -

+ + + + + Recent Activity + + + + {donationsLoading ? ( +

Loading your activity…

+ ) : donations.length ? ( +
+ {donations.slice(0, 3).map((d) => ( +
+
+

Blood Donation

+

+ {new Date(d.donationDate).toLocaleDateString()} +

+
+ + +{d.creditsEarned} credits +
- +{d.creditsEarned} credits -
- ))} + ))} +
+ ) : ( +

+ No donations recorded yet. Your first donation could save a life. +

+ )} + + + + + {/* Community Impact */} + + + + + Community Impact + + + +
+

+ Lives touched +

+

+ {donor.totalDonations || 0} +

+

+ Every donation counts towards someone's story. +

+
+
+

+ Credits earned +

+

+ {donor.credits || 0} +

+

+ Use credits for blood requests when you or your family need help. +

- ) : ( -

No donations yet

- )} +
+
+
+ + ) : ( + + +
+ +
+

Become a PulseConnect Donor

+

+ Create your donor profile, start donating, and earn credits you can use + for future blood requests for yourself or your loved ones. +

+ +
+
+ )} + + {/* Tips & Credit Info */} + + + + + + + Donation Tips + + + +

• Eat a healthy, balanced meal before donating.

+

• Stay hydrated before and after your donation.

+

• Get a good night's rest the day before.

+

• Avoid alcohol 24 hours prior to donating.

+

• Carry a valid ID and prefer iron-rich foods regularly.

+
- {/* Community Impact */} - - - - Community Impact + + + + + + Credit System - -
-

{donor.totalDonations}

-

Lives Impacted

+ +
+ + Earn 5 credits for each successful donation. +
+
+ + Redeem credits towards verified blood requests. +
+
+ + We recommend waiting at least 6 months between donations.
-
-

{donor.credits}

-

Credits Earned

+
+ + PulseConnect follows a safe, verified donation cycle.
- ) : ( - - -

Complete Your Donor Profile

-

- Register as a donor to start saving lives and earning credits -

- -
- )} - - {/* Tips & Credit Info */} -
- - - Donation Tips - - -

• Eat a healthy meal before donating

-

• Stay hydrated before and after donation

-

• Rest the night before

-

• Avoid alcohol 24 hours before

-

• Bring a valid ID & eat iron-rich foods

-
-
- - - - Credit System - - -
- Earn 5 credits per donation -
-
- Redeem credits for blood requests -
-
- Donate every 6 months -
-
- Verified safe donation cycle -
-
-
-
-
+ +
); } diff --git a/client/src/pages/landing.tsx b/client/src/pages/landing.tsx index ee21b51..0c2b88d 100644 --- a/client/src/pages/landing.tsx +++ b/client/src/pages/landing.tsx @@ -1,6 +1,6 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; -import { Heart, Search, MapPin, MessageCircle, Shield, Award, Facebook, Instagram, Linkedin } from "lucide-react"; +import { Heart, Search, MapPin, MessageCircle, Shield, Award } from "lucide-react"; import Header from "@/components/header"; import { motion } from "framer-motion"; @@ -10,104 +10,103 @@ export default function Landing() {
{/* Hero Section */} -
- -

+
+
+ +
+ Save Lives, Connect Hearts -

+ -

- Join the largest blood donation network. Earn credits for every donation and connect instantly with those in need. -

+ + Join the largest blood donation network. Connect donors with those in need, earn credits, and make a real impact. + -
- - -
-
-
+ {/* Registration Cards */} +
+ + {/* Donor Card */} + + + +
+
+ +
+

Blood Donor

+

Register, donate, and earn credits for future use.

+
- {/* Registration Options */} -
-
- - {[ - { - title: "Blood Donor", - desc: "Register as a donor, help save lives, and earn credits for future needs", - icon: , - href: "/api/login", - bg: "bg-secondary/10", - btn: "bg-secondary text-secondary-foreground hover:bg-secondary/90", - }, - { - title: "Blood Finder", - desc: "Find donors near your location and connect instantly via WhatsApp", - icon: , - href: "/api/login", - bg: "bg-accent/10", - btn: "bg-accent text-accent-foreground hover:bg-accent/90", - } - ].map((card, i) => ( - - - -
- {card.icon} + + + + + + {/* Blood Finder */} + + + +
+
+ +
+

Blood Finder

+

Locate donors near you & contact them instantly.

-

{card.title}

-

{card.desc}

-
- ))} + +
{/* Credit System */} -
-
-

Credit System

-

Earn credits for every donation and redeem them when you need blood

+
+
+

Credit System

+

Earn credits with every donation & redeem them when needed.

- {[ - { icon: , title: "Earn Credits", desc: "Get 5 credits for each successful blood donation", bg: "bg-secondary/10" }, - { icon: , title: "Use Credits", desc: "Redeem credits for free blood when needed", bg: "bg-primary/10" }, - { icon: , title: "6-Month Rule", desc: "Safe tracking for donation intervals", bg: "bg-accent/10" } + {[ + { icon: Heart, title: "Earn Credits", desc: "Get 5 credits for every donation", color: "secondary" }, + { icon: Award, title: "Use Credits", desc: "Redeem credits when you need blood", color: "primary" }, + { icon: Shield, title: "6-Month Rule", desc: "Track donation intervals safely", color: "accent" }, ].map((item, i) => ( - - -
- {item.icon} + + +
+
-

{item.title}

+

{item.title}

{item.desc}

@@ -119,30 +118,25 @@ export default function Landing() { {/* Features */}
-
-

Why Choose PulseConnect?

-

Advanced features designed for fast and safe blood donation

+
+

Why Choose PulseConnect?

+

+ Advanced features for fast, safe, and rewarding blood donation. +

-
+
{[ - { icon: , title: "Location-Based", desc: "Find donors within your nearest radius" }, - { icon: , title: "Direct Contact", desc: "Instant WhatsApp communication" }, - { icon: , title: "Safe Tracking", desc: "Donation intervals monitored" }, - { icon: , title: "Reward System", desc: "Earn credits, unlock benefits" }, - ].map((item, i) => ( - -
- {item.icon} + { icon: MapPin, title: "Location-Based", desc: "Find donors within 5km using GPS", color: "primary" }, + { icon: MessageCircle, title: "Direct Contact", desc: "WhatsApp donors instantly", color: "secondary" }, + { icon: Shield, title: "Safe Tracking", desc: "Donation safety monitoring", color: "accent" }, + { icon: Award, title: "Reward System", desc: "Earn rewards for helping others", color: "purple-600" }, + ].map((f, i) => ( + +
+
-

{item.title}

-

{item.desc}

+

{f.title}

+

{f.desc}

))}
@@ -150,54 +144,48 @@ export default function Landing() {
{/* Footer */} -