From 735a74cb312f526e2f36b8ba2f02d6a5284ddb6f Mon Sep 17 00:00:00 2001 From: darshan totagi Date: Thu, 20 Nov 2025 14:41:53 +0530 Subject: [PATCH 1/3] card animations --- client/src/pages/find-donors.tsx | 2 +- client/src/pages/home.tsx | 487 ++++++++++++++++++++----------- 2 files changed, 322 insertions(+), 167 deletions(-) diff --git a/client/src/pages/find-donors.tsx b/client/src/pages/find-donors.tsx index df5aad2..0eee0ef 100644 --- a/client/src/pages/find-donors.tsx +++ b/client/src/pages/find-donors.tsx @@ -365,4 +365,4 @@ export default function FindDonors() { ); -} do enhancement \ No newline at end of file +} \ No newline at end of file diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index c23674b..10810d6 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -16,28 +16,63 @@ 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 { isAuthenticated, isLoading } = useAuth(); - // Redirect on logout + // Time-based greeting (purely visual, no logic change) + const hours = new Date().getHours(); + const greeting = + hours < 12 ? "Good morning" : hours < 17 ? "Good afternoon" : "Good evening"; + + /* -------------------------------------------------------------------------- */ + /* AUTH REDIRECT UX */ + /* -------------------------------------------------------------------------- */ + useEffect(() => { 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, @@ -61,11 +96,20 @@ export default function Home() { if (isLoading || donorLoading) { return ( -
+
-
-
- Loading… +
+
+
+
+ +
+

+ Preparing your dashboard… +

+

+ Fetching your donor profile and activity +

@@ -77,236 +121,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. +

- ) : ( -

No donations yet

- )} +
+

+ Credits earned +

+

+ {donor.credits || 0} +

+

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

+
+
+
+
+ + ) : ( + + +
+ +
+

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.
-
-

{donor.credits}

-

Credits Earned

+
+ + Redeem credits towards verified blood requests. +
+
+ + We recommend waiting at least 6 months between donations. +
+
+ + 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 -
-
-
-
-
+ +
); } From bb07078a1931db9f5cf974b72ffc1cfd4b1b9069 Mon Sep 17 00:00:00 2001 From: darshan totagi Date: Fri, 21 Nov 2025 08:33:39 +0530 Subject: [PATCH 2/3] landing page --- client/src/pages/landing.tsx | 339 ++++++++++++++++----------------- client/src/pages/not-found.tsx | 2 +- 2 files changed, 168 insertions(+), 173 deletions(-) diff --git a/client/src/pages/landing.tsx b/client/src/pages/landing.tsx index ee21b51..e72cd70 100644 --- a/client/src/pages/landing.tsx +++ b/client/src/pages/landing.tsx @@ -1,206 +1,201 @@ 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"; export default function Landing() { return (
- + {/* Hero Section */} -
- -

- Save Lives, Connect Hearts -

- -

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

- -
- - +
+
+
+

Save Lives, Connect Hearts

+

+ Join the largest blood donation network. Connect donors with those in need, earn credits for donations, and make a difference in your community. +

- -
- - {/* 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} + {/* Registration Options */} +
+ {/* Blood Donor Registration */} + + +
+
+
-

{card.title}

-

{card.desc}

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

Credit System

-

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

- -
- {[ - { 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" } - ].map((item, i) => ( - - - -
- {item.icon} -
-

{item.title}

-

{item.desc}

-
-
-
- ))} +

Blood Donor

+

Register as a donor, help save lives, and earn credits for future needs

+
+ + + + + {/* Blood Finder Registration */} + + +
+
+ +
+

Blood Finder

+

Find donors in your area quickly and connect directly via WhatsApp

+
+ +
+
- {/* Features */} -
-
-

Why Choose PulseConnect?

-

Advanced features designed for fast and safe 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} + {/* Credits System Display */} +
+
+
+

Credit System

+

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

+
+ +
+ + +
+ +
+

Earn Credits

+

Get 5 credits for each successful blood donation

+
+
+ + + +
+ +
+

Use Credits

+

Redeem credits for free blood when you need it most

+
+
+ + + +
+
-

{item.title}

-

{item.desc}

- - ))} +

6-Month Rule

+

Credits are valid and donations tracked for safe intervals

+
+
- {/* Footer */} -