Posts

Showing posts from February, 2025

Login.js

  import React , { useState } from 'react' ; import { Link , useNavigate } from 'react-router-dom' ; const Login = () => {     const navigate = useNavigate ();     const [ email , setEmail ] = useState ( '' );     const [ password , setPassword ] = useState ( '' );     const [ emailError , setEmailError ] = useState ( '' );     const [ passwordError , setPasswordError ] = useState ( '' );     const [ modalMessage , setModalMessage ] = useState ( '' );     const [ modalVisible , setModalVisible ] = useState ( false );     const handleSubmit = async ( event ) => {         event . preventDefault ();                 // Email validation         const emailRegex = / ^ [ a-zA-Z0-9._%+- ] + @ [ a-zA-Z0-9.- ] +\. [ a-zA-Z ] {2,} $ / ;         if ( ! emailRegex . test ( email...

PaymentComponent.js

  import React from 'react' ; const PaymentComponent = ({ amount , rideId , onPaymentSuccess , onPaymentFailure }) => {     const handlePayment = ( event ) => {         event . preventDefault ();         if ( ! window . Razorpay ) {             console . error ( 'Razorpay is not loaded' );             return ;         }         const options = {             key : 'rzp_test_LMZHnNT5VlTSU1' ,             amount : amount * 100 , // Amount in paise             currency : 'INR' ,             name : 'RideShare' ,             description : 'Payment For Ride' ,             handler : function ( response ) {         ...