Skip to content

Commit

Permalink
Add submit page
Browse files Browse the repository at this point in the history
  • Loading branch information
subhadip-kundu committed Apr 22, 2024
1 parent f029d4e commit 91c6e6b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/Components/Sell/FarmarInputForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { firestore, storage } from "../FireBase/Firebase";
import { uploadBytes, ref, getDownloadURL } from "firebase/storage";
import {collection , addDoc} from 'firebase/firestore' ;
import farmarImage from "../../assets/InputForrmFarmerMarket.png"; // Importing farmarImage from assets folder
import { useNavigate } from "react-router-dom";

const FarmerInputForm = () => {
const [itemName, setItemName] = useState("");
Expand All @@ -14,9 +15,9 @@ const FarmerInputForm = () => {
const [errorMessage, setErrorMessage] = useState("");
const [image, setImage] = useState();
const [image2, setImage2] = useState();



const navigate = useNavigate();
const path = `/Success`;

// const handleSubmit = async (e) => {
// e.preventDefault();
Expand Down Expand Up @@ -57,6 +58,9 @@ const FarmerInputForm = () => {
image2Url: image2Url,
});
console.log("Document written with ID: ", docRef.id);

//Navigate to the success page
navigate(path);
} catch (e) {
console.error("Error adding document: ", e);
}
Expand Down
7 changes: 5 additions & 2 deletions src/Components/Success.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React from 'react'
import React from 'react';
import submit from "../assets/Submitted.png"

function Success() {
return (
<div>Success</div>
<div className='w-full flex items-center justify-center'>
<img className='max-w-screen-md' src={submit} alt="Submit image" />
</div>
)
}

Expand Down
Binary file added src/assets/Submitted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const router = createBrowserRouter(
<Route path='shop' element={<Shop/>}/>
<Route path='sell' element={<Sell/>}/>
<Route path='contact-us' element={<Contact/>}/>
<Route path='contact-us/Success' element={<Success/>}/>
<Route path='Success' element={<Success/>}/>
<Route path='register' element={<LoginSignup/>}/>
<Route path='*' element={<Page404/>}/>
</Route>
Expand Down

0 comments on commit 91c6e6b

Please sign in to comment.