-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2e7810
commit 6347499
Showing
9 changed files
with
260 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
badge.json,1718017793881,33511d102658248ca81efcd2eb75c54df143d937f55f19fd056c08b89eb95964 | ||
index.html,1718161162661,699062a3ca34c216c6084cf084fc612c1a9197d633e2cd7297d68d86a557d998 | ||
assets/index-buGaNZFf.css,1718161162685,107ffffb4a5b1d1ee7254f3987c9a188f68a00beab4c91803beb13017cc3bd5b | ||
blog.json,1717270760062,103377ce7d408e1aeaf3990cc018cb6ecfc3d07ab2a559be75825a998cb0a9f5 | ||
assets/logos-CeWA07j-.png,1718161162655,0436dce91e3283a5e1b50bb804b3d0ca56a24830527b2343d1daf9bb2cabfaef | ||
vite.svg,1711360300018,59ec4b6085a0cb1bf712a5e48dd5f35b08e34830d49c2026c18241be04e05d5a | ||
logos.png,1717217521625,0436dce91e3283a5e1b50bb804b3d0ca56a24830527b2343d1daf9bb2cabfaef | ||
assets/index-D84-5Qn4.js,1718161162664,5d471354bfa13b51486c1d5633f8e098d155797c86bfe18b4dd555047f48e11c | ||
assets/404-DAsD6jbh.gif,1718161162665,f1c39464ff074bb7cc4f0bf6f6149b0702a2db1a767f1fd842cc822608c291a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "sms-clint" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"hosting": { | ||
"public": "dist", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
"**/node_modules/**" | ||
], | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
[ | ||
{ | ||
"title": "Exploring the Hidden Gems of the Pacific Northwest", | ||
"image": "https://i.ibb.co/KVr2ZMK/l2.jpg", | ||
"image": "https://i.ibb.co/hVPHv3b/thai-beef-salad-1980x1320-118406-1.jpg", | ||
"short_description": "Discover the lush forests, breathtaking coastlines, and charming small towns that make the Pacific Northwest a traveler's paradise. Join us as we uncover the region's best-kept secrets and hidden gems." | ||
}, | ||
{ | ||
"title": "The Rise of Sustainable Fashion: A Greener Future", | ||
"image": "https://i.ibb.co/41GSy4w/l1.jpg", | ||
"image": "https://i.ibb.co/4F0hLKk/impossible-quiche-24036-1.jpg", | ||
"short_description": "Sustainable fashion is more than just a trend; it's a movement towards a more ethical and eco-friendly industry. Learn about the innovative brands and practices paving the way for a greener future in fashion." | ||
}, | ||
{ | ||
"title": "Mastering the Art of Homemade Pasta", | ||
"image": "https://i.ibb.co/mqwS3hD/b1.jpg", | ||
"image": "https://i.ibb.co/GPpLSLx/images-5.jpg", | ||
"short_description": "There's nothing quite like the taste of fresh, homemade pasta. Our step-by-step guide will walk you through the process of making pasta from scratch, with tips and tricks to perfect your technique." | ||
}, | ||
{ | ||
"title": "A Beginner's Guide to Meditation: Finding Inner Peace", | ||
"image": "https://i.ibb.co/VqwHbds/d1.jpg", | ||
"image": "https://i.ibb.co/qY7Ck03/classic-shepherds-pie-1980x1320-118395-1.jpg", | ||
"short_description": "Meditation can be a powerful tool for reducing stress and improving mental clarity. This beginner's guide will introduce you to the basics of meditation and help you start your journey toward inner peace and mindfulness." | ||
}, | ||
{ | ||
"title": "The Ultimate Guide to Urban Gardening", | ||
"image": "https://i.ibb.co/WfqvCKz/b2.jpg", | ||
"image": "https://i.ibb.co/B6GJZCW/images-9.jpg", | ||
"short_description": "No backyard? No problem! Urban gardening is all about growing your own greens in small spaces. From container gardens to vertical gardening, we'll show you how to turn any urban area into a thriving garden." | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
import { useForm } from "react-hook-form"; | ||
import moment from "moment"; | ||
import useAxiosSecqur from "../../Hooks/useAxiosSecqur"; | ||
import useAxiosCommon from "../../Hooks/useAxiosCommon"; | ||
import { useParams } from "react-router-dom"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import LogingSpiner from "../../Sheare/LogingSpiner"; | ||
import toast from "react-hot-toast"; | ||
const imgHosting_api = `https://api.imgbb.com/1/upload?key=${ | ||
import.meta.env.VITE_IMGBB_key | ||
}`; | ||
|
||
const Updatemeaks = () => { | ||
const axiosSec = useAxiosSecqur(); | ||
const axiospub = useAxiosCommon(); | ||
const { id } = useParams(); | ||
const { | ||
data: meal = [], | ||
isLoading, | ||
refetch, | ||
} = useQuery({ | ||
queryKey: ["meal", id], | ||
queryFn: async () => { | ||
const { data } = await axiospub.get(`/meal/${id}`); | ||
return data; | ||
}, | ||
}); | ||
|
||
const { register, handleSubmit } = useForm(); | ||
|
||
const onSubmit = async (data) => { | ||
const { | ||
title, | ||
catagory, | ||
price, | ||
rating, | ||
likes, | ||
itm1, | ||
itm2, | ||
itm3, | ||
itm4, | ||
image, | ||
description, | ||
} = data; | ||
|
||
const imageFile = { image: data.image[0] }; | ||
const res = await axiospub.post(imgHosting_api, imageFile, { | ||
headers: { | ||
"Content-Type": "multipart/form-data", | ||
}, | ||
}); | ||
|
||
if (res.data.success) { | ||
const mealItem = { | ||
title, | ||
catagory, | ||
price: parseFloat(price), | ||
rating: parseFloat(rating), | ||
likes: parseFloat(likes), | ||
ingredients: { itm1, itm2, itm3, itm4 }, | ||
image: res.data.data.display_url, | ||
description, | ||
post_time: moment().format("LLLL"), | ||
}; | ||
// const menuRes = await axiosSec.put(`/updatemeals/${id}`, mealItem); | ||
// console.log(mealItem); | ||
|
||
refetch(); | ||
} | ||
}; | ||
|
||
if (isLoading) return <LogingSpiner></LogingSpiner>; | ||
return ( | ||
<div> | ||
<div> | ||
<h2 className="text-3xl font-bold my-5 text-center">Add Meal</h2> | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<div className="grid md:grid-cols-2 gap-3"> | ||
<div> | ||
<label>Meal Title</label> | ||
<input | ||
type="text" | ||
className=" input input-disabled w-full" | ||
name="" | ||
defaultValue={meal.title} | ||
{...register("title")} | ||
id="" | ||
/> | ||
</div> | ||
|
||
<div> | ||
<label>Catagory</label> | ||
<select | ||
className=" input input-disabled w-full" | ||
id="meal" | ||
name="catagory" | ||
defaultValue={meal.catagory} | ||
{...register("catagory")} | ||
> | ||
<option value="breakfast">Breakfast</option> | ||
<option value="lunch">Lunch</option> | ||
<option value="dinner">Dinner</option> | ||
</select> | ||
</div> | ||
|
||
<div> | ||
<label>Meal Price</label> | ||
<input | ||
type="number" | ||
className=" input input-disabled w-full" | ||
name="price" | ||
defaultValue={meal.price} | ||
{...register("price")} | ||
id="" | ||
/> | ||
</div> | ||
|
||
<div> | ||
<label>Meal Rating</label> | ||
<input | ||
type="number" | ||
className=" input input-disabled w-full" | ||
name="rating" | ||
defaultValue={meal.rating} | ||
{...register("rating")} | ||
id="" | ||
/> | ||
</div> | ||
|
||
<div> | ||
<label>Meal likes</label> | ||
<input | ||
type="number" | ||
className=" input input-disabled w-full" | ||
name=" likes" | ||
defaultValue={meal.likes} | ||
{...register("likes")} | ||
id="" | ||
/> | ||
</div> | ||
|
||
<div> | ||
<label>ingredients</label> | ||
<div className="grid md:grid-cols-2 gap-2"> | ||
<input | ||
type="text" | ||
className=" input input-disabled w-full" | ||
name=" itm1" | ||
defaultValue={meal.ingredients.itm1} | ||
{...register("itm1")} | ||
id="" | ||
required | ||
/> | ||
<input | ||
type="text" | ||
className=" input input-disabled w-full" | ||
name=" itm2" | ||
defaultValue={meal.ingredients.itm2} | ||
{...register("itm2")} | ||
id="" | ||
/> | ||
<input | ||
type="text" | ||
className=" input input-disabled w-full" | ||
defaultValue={meal.ingredients.itm3} | ||
name=" itm3" | ||
{...register("itm3")} | ||
id="" | ||
/> | ||
<input | ||
type="text" | ||
className=" input input-disabled w-full" | ||
defaultValue={meal.ingredients.itm4} | ||
name=" itm4" | ||
{...register("itm4")} | ||
id="" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<img className="w-14 h-14" src={meal.image} alt="" /> | ||
<input | ||
type="file" | ||
className="file-input file-input-bordered file-input-secondary w-full max-w-xs" | ||
{...register("image")} | ||
/> | ||
</div> | ||
</div> | ||
<div> | ||
<label>description </label> | ||
<textarea | ||
className=" input input-disabled w-full" | ||
name="" | ||
{...register("description")} | ||
defaultValue={meal.description} | ||
id="" | ||
cols="30" | ||
rows="50" | ||
></textarea> | ||
</div> | ||
<input | ||
className=" btn btn-primary w-full" | ||
type="submit" | ||
disabled | ||
value="Add Meal" | ||
/> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Updatemeaks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters