-
Notifications
You must be signed in to change notification settings - Fork 1
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
28b4e8f
commit 6de72f3
Showing
75 changed files
with
1,924 additions
and
661 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,2 @@ | ||
1. The app is made by implementing modern features of nextjs. | ||
2. Each component of any page is responsible for fetching and mutating its own data. |
Empty file.
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,30 @@ | ||
"use server"; | ||
import User from "@/lib/schemas/UserSchema"; | ||
import dbConnect from "@/utils/dbConnect"; | ||
|
||
export const CreateUser = async (payload) => { | ||
const email = payload.email; | ||
const conn = await dbConnect(); | ||
|
||
const existingUser = await User.findOne({ email }); | ||
if (existingUser) { | ||
return JSON.parse( | ||
JSON.stringify({ | ||
message: "User Already Exists", | ||
status: 400, | ||
}) | ||
); | ||
} | ||
|
||
const users = await User.create(payload); | ||
|
||
const data = JSON.stringify(users); | ||
console.log("users ", users); | ||
return JSON.parse( | ||
JSON.stringify({ | ||
status: 200, | ||
success: true, | ||
data: data, | ||
}) | ||
); | ||
}; |
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,14 @@ | ||
export const metadata = { | ||
title: "Authentication", | ||
description: "Authenticdate yourself to use Pendrive", | ||
}; | ||
|
||
export default function RootLayout({ children }) { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
{children} | ||
</body> | ||
</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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
"use client"; | ||
import { CreateUser } from "@/actions/user.actions"; | ||
import { useRouter } from "next/navigation"; | ||
import React, { useState } from "react"; | ||
|
||
const OnboardingForm = ({ email, name, id }) => { | ||
const [formData, setFormData] = useState({ | ||
name: name || "", | ||
email: email || "", | ||
address: "", | ||
phone: "", | ||
}); | ||
const router = useRouter(); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const handleChange = (e) => { | ||
const { name, value } = e.target; | ||
setFormData({ | ||
...formData, | ||
[name]: value, | ||
}); | ||
}; | ||
|
||
const handleSubmit = async (e) => { | ||
e.preventDefault(); | ||
setLoading(true); | ||
const res = await CreateUser({ | ||
email: formData.email, | ||
name: formData.name, | ||
address: formData.address, | ||
phone: formData.phone, | ||
AuthId: id, | ||
}); | ||
setLoading(false); | ||
if (res.status === 200) { | ||
router.push("/"); | ||
} | ||
}; | ||
|
||
return ( | ||
<form | ||
onSubmit={handleSubmit} | ||
className="max-w-md mx-auto p-4 shadow-md rounded bg-white" | ||
> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Name</label> | ||
<input | ||
type="text" | ||
name="name" | ||
value={formData.name} | ||
onChange={handleChange} | ||
className="w-full p-2 border border-gray-300 rounded mt-1" | ||
required | ||
disabled={loading} | ||
/> | ||
</div> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Email</label> | ||
<input | ||
type="email" | ||
name="email" | ||
value={formData.email} | ||
onChange={handleChange} | ||
className="w-full p-2 border border-gray-300 rounded mt-1" | ||
required | ||
disabled={loading} | ||
/> | ||
</div> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Address</label> | ||
<input | ||
type="text" | ||
name="address" | ||
value={formData.address} | ||
onChange={handleChange} | ||
className="w-full p-2 border border-gray-300 rounded mt-1" | ||
required | ||
disabled={loading} | ||
/> | ||
</div> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Phone Number</label> | ||
<input | ||
type="tel" | ||
name="phone" | ||
value={formData.phone} | ||
onChange={handleChange} | ||
className="w-full p-2 border border-gray-300 rounded mt-1" | ||
required | ||
disabled={loading} | ||
/> | ||
</div> | ||
|
||
<button | ||
type="submit" | ||
className="w-full p-2 bg-blue-600 text-white rounded mt-2 hover:bg-blue-700 transition" | ||
disabled={loading} | ||
> | ||
Submit | ||
</button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default OnboardingForm; |
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,19 @@ | ||
import { currentUser } from "@clerk/nextjs/server"; | ||
import OnboardingForm from "./OnboardingForm"; | ||
|
||
const OnBoardingPage = async () => { | ||
const { primaryEmailAddress, fullName, id } = await currentUser(); | ||
|
||
return ( | ||
<div className="w-full h-screen"> | ||
<h1 className="text-3xl font-bold font-sans">OnBoarding</h1> | ||
<OnboardingForm | ||
email={primaryEmailAddress.emailAddress} | ||
name={fullName} | ||
id={id} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OnBoardingPage; |
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,34 @@ | ||
import { SignIn } from "@clerk/nextjs"; | ||
import Image from "next/image"; | ||
|
||
const SignInPage = () => { | ||
return ( | ||
<div className="w-full lg:h-screen flex items-center flex-row lg:p-0"> | ||
<div className="w-full h-screen hidden lg:flex items-center justify-center"> | ||
<Image | ||
height={700} | ||
width={700} | ||
src={"/images/image.png"} | ||
alt="Image-1" | ||
/> | ||
</div> | ||
<div className="h-full w-full flex items-center justify-center py-11"> | ||
<SignIn | ||
appearance={{ | ||
elements: { | ||
card: "bg-gray-50", | ||
formButtonPrimary: | ||
"bg-red-500 border-none outline-none text-white p-2", | ||
input: "p-2", | ||
socialButtonsBlockButton: "p-2", | ||
footerActionText: "text-md font-semibold", | ||
footerActionLink: "text-red-500 text-md font-bold", | ||
}, | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SignInPage; |
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,33 @@ | ||
import { SignUp } from "@clerk/nextjs"; | ||
import Image from "next/image"; | ||
|
||
export default function SignUpPage() { | ||
return ( | ||
<div className="w-full h-screen flex items-center flex-row"> | ||
<div className="w-full h-full hidden md:flex items-center justify-center"> | ||
<Image | ||
height={700} | ||
width={700} | ||
src={"/images/image.png"} | ||
alt="Image-1" | ||
/> | ||
</div> | ||
<div className="h-full w-full flex items-center justify-center flex-col py-11"> | ||
<SignUp | ||
|
||
appearance={{ | ||
elements: { | ||
card: "bg-gray-50", | ||
formButtonPrimary: | ||
"bg-red-500 border-none outline-none text-white p-2", | ||
input: "p-2", | ||
socialButtonsBlockButton: "p-2", | ||
footerActionText: "text-md font-semibold", | ||
footerActionLink: "text-red-500 text-md font-bold", | ||
}, | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
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,39 @@ | ||
import ItemsCarousel from "@/components/reuseable/ItemsCarousel"; | ||
import ProductItem from "@/components/reuseable/ProductItem"; | ||
|
||
|
||
const AllProductsCarousel = () => { | ||
const dummyArray = Array.from({ length: 10 }, (v, k) => k); | ||
|
||
return ( | ||
<> | ||
<div className="w-full flex flex-col items-center justify-center relative my-11"> | ||
<ItemsCarousel title={"Our Products"} text={"Explore Our Products"}> | ||
{dummyArray.map((item) => ( | ||
<div className="embla__slide" key={item}> | ||
<div className="flex flex-col items-center justify-center"> | ||
<ProductItem /> | ||
</div> | ||
</div> | ||
))} | ||
</ItemsCarousel> | ||
</div> | ||
<div className="w-full flex flex-col items-center justify-center relative my-11"> | ||
<ItemsCarousel> | ||
{dummyArray.map((item) => ( | ||
<div className="embla__slide" key={item}> | ||
<div className="flex flex-col items-center justify-center"> | ||
<ProductItem /> | ||
</div> | ||
</div> | ||
))} | ||
</ItemsCarousel> | ||
<button className="px-11 text-xl py-2 bg-red-500 rounded-md w-max text-white"> | ||
View All Products | ||
</button> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default AllProductsCarousel; |
20 changes: 20 additions & 0 deletions
20
app/(root)/_components/home/CategorySideBar/CategoryItem.jsx
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,20 @@ | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
const CategoryItem = ({ name, icon, link }) => { | ||
return ( | ||
<Link | ||
href={link} | ||
className="flex flex-col items-center justify-center hover:bg-gray-200 transition" | ||
> | ||
<div className="md:hidden ">{icon}</div> | ||
<div | ||
className="px-4 py-1 text-md w-max " | ||
> | ||
{name} | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default CategoryItem; |
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,30 @@ | ||
import { FaCottonBureau, FaShoppingBag } from "react-icons/fa"; | ||
import { MdComputer, MdKitchen, MdWoman } from "react-icons/md"; | ||
const categories = [ | ||
{ | ||
name: "Fashion", | ||
link: "/categories/fashion", | ||
icon: <FaShoppingBag size={40} />, | ||
}, | ||
{ | ||
name: "Computers", | ||
link: "/categories/computers", | ||
icon: <MdComputer size={40} />, | ||
}, | ||
{ | ||
name: "Embriodery", | ||
link: "/categories/embriodery", | ||
icon: <FaCottonBureau size={40} />, | ||
}, | ||
{ | ||
name: "HouseHold", | ||
link: "/categories/household", | ||
icon: <MdKitchen size={40} />, | ||
}, | ||
{ | ||
name: "Women", | ||
link: "/categories/women", | ||
icon: <MdWoman size={40} />, | ||
}, | ||
]; | ||
export default categories; |
30 changes: 1 addition & 29 deletions
30
components/feed/CategorySideBar/index.jsx → ...components/home/CategorySideBar/index.jsx
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.