MCPcopy Create free account
hub / github.com/codealong-dev/ride-sharing / HomeContent

Function HomeContent

web/src/app/page.tsx:32–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32function HomeContent() {
33 const [userType, setUserType] = useState<"driver" | "rider" | null>(null)
34 const router = useRouter()
35 const searchParams = useSearchParams()
36 const payment = searchParams.get("payment")
37 const [packageSlug, setPackageSlug] = useState<CarPackageSlug | null>(null)
38
39 const handleClick = (userType: "driver" | "rider") => {
40 setUserType(userType)
41 }
42
43 if (payment === 'success') {
44 return (
45 <main className="min-h-screen bg-gradient-to-b from-white to-gray-50">
46 <div className="flex flex-col items-center justify-center h-screen gap-6 px-4">
47 <div className="bg-white p-8 rounded-2xl shadow-lg text-center max-w-md w-full">
48 <div className="mb-6">
49 <div className="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
50 <svg className="w-8 h-8 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
51 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
52 </svg>
53 </div>
54 <h1 className="text-2xl font-bold text-gray-900">Payment Successful!</h1>
55 <p className="text-gray-600 mt-2">Your ride has been confirmed.</p>
56 </div>
57 <Button
58 className="w-full text-lg py-6"
59 variant="outline"
60 onClick={() => router.push("/")}
61 >
62 Return Home
63 </Button>
64 </div>
65 </div>
66 </main>
67 )
68 }
69
70 return (
71 <main className="min-h-screen bg-gradient-to-b from-white to-gray-50">
72 {userType === null && (
73 <div className="flex flex-col items-center justify-center h-screen gap-6 px-4">
74 <div className="bg-white p-8 rounded-2xl shadow-lg text-center max-w-md w-full">
75 <h2 className="text-2xl font-bold text-gray-900 mb-6">Welcome to RideShare</h2>
76 <p className="text-gray-600 mb-8">Choose how you&apos;d like to use our service today</p>
77 <div className="space-y-4">
78 <Button
79 className="w-full text-lg py-6 bg-primary hover:bg-primary/90"
80 onClick={() => handleClick("rider")}
81 >
82 I Need a Ride
83 </Button>
84 <Button
85 className="w-full text-lg py-6"
86 variant="outline"
87 onClick={() => handleClick("driver")}
88 >
89 I Want to Drive

Callers

nothing calls this directly

Calls 1

handleClickFunction · 0.85

Tested by

no test coverage detected