From 07c422c5c4170e8b9c7eb498f0d4a149933dfcce Mon Sep 17 00:00:00 2001 From: Dev Sharma Date: Thu, 24 Oct 2024 20:11:37 +0530 Subject: [PATCH 01/14] added the forms ui --- package.json | 1 + src/app/newProfile/layout.tsx | 40 ++ src/app/newProfile/page.tsx | 26 ++ src/components/profile/ProfileAboutMe.tsx | 126 +++++++ .../profile/ProfileAccountSheet.tsx | 156 ++++++++ src/components/profile/ProfileEducation.tsx | 250 +++++++++++++ src/components/profile/ProfileExperience.tsx | 321 ++++++++++++++++ src/components/profile/ProfileHeroSection.tsx | 346 ++++++++++++++++++ src/components/profile/ProfileHireme.tsx | 35 ++ src/components/profile/ProfileProjects.tsx | 244 ++++++++++++ src/components/profile/ProfileResume.tsx | 158 ++++++++ src/components/profile/ProfileSkills.tsx | 58 +++ .../ProfileEmptyContainers.tsx | 7 + src/lib/constant/profile.constant.ts | 10 + src/lib/validators/user.profile.validator.ts | 84 +++++ 15 files changed, 1862 insertions(+) create mode 100644 src/app/newProfile/layout.tsx create mode 100644 src/app/newProfile/page.tsx create mode 100644 src/components/profile/ProfileAboutMe.tsx create mode 100644 src/components/profile/ProfileAccountSheet.tsx create mode 100644 src/components/profile/ProfileEducation.tsx create mode 100644 src/components/profile/ProfileExperience.tsx create mode 100644 src/components/profile/ProfileHeroSection.tsx create mode 100644 src/components/profile/ProfileHireme.tsx create mode 100644 src/components/profile/ProfileProjects.tsx create mode 100644 src/components/profile/ProfileResume.tsx create mode 100644 src/components/profile/ProfileSkills.tsx create mode 100644 src/components/profile/emptycontainers/ProfileEmptyContainers.tsx create mode 100644 src/lib/constant/profile.constant.ts diff --git a/package.json b/package.json index c8c006cd..587d6a45 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "react": "^18", "react-day-picker": "^8.10.1", "react-dom": "^18", + "react-dropzone": "^14.2.10", "react-hook-form": "^7.52.2", "react-icons": "^5.2.1", "react-quill": "^2.0.0", diff --git a/src/app/newProfile/layout.tsx b/src/app/newProfile/layout.tsx new file mode 100644 index 00000000..cf6617ca --- /dev/null +++ b/src/app/newProfile/layout.tsx @@ -0,0 +1,40 @@ +'use client'; +import { getUserDetails } from '@/actions/user.profile.actions'; +import APP_PATHS from '@/config/path.config'; +import { useSession } from 'next-auth/react'; +import { useRouter } from 'next/navigation'; +import React, { useEffect } from 'react'; + +const ProfileLayout = ({ children }: { children: React.ReactNode }) => { + const router = useRouter(); + const session = useSession(); + useEffect(() => { + if (session.status !== 'loading' && session.status === 'unauthenticated') + router.push(`${APP_PATHS.SIGNIN}?redirectTo=/profile`); + }, [session.status, router]); + useEffect(() => { + async function fetchUserDetails() { + try { + const res = await getUserDetails(); + if (res.status) { + localStorage.setItem( + 'skills', + JSON.stringify(res.additional?.skills) + ); + localStorage.setItem( + 'resume', + JSON.stringify(res.additional?.resume) + ); + } + } catch (_error) {} + } + fetchUserDetails(); + }, []); + return ( +
+ {children} +
+ ); +}; + +export default ProfileLayout; diff --git a/src/app/newProfile/page.tsx b/src/app/newProfile/page.tsx new file mode 100644 index 00000000..79434ef7 --- /dev/null +++ b/src/app/newProfile/page.tsx @@ -0,0 +1,26 @@ +import ProfileAboutMe from '@/components/profile/ProfileAboutMe'; +import ProfileEducation from '@/components/profile/ProfileEducation'; +import ProfileExperience from '@/components/profile/ProfileExperience'; +import ProfileHeroSection from '@/components/profile/ProfileHeroSection'; +import ProfileHireme from '@/components/profile/ProfileHireme'; +import ProfileProjects from '@/components/profile/ProfileProjects'; +import ProfileResume from '@/components/profile/ProfileResume'; +import ProfileSkills from '@/components/profile/ProfileSkills'; +import React from 'react'; + +const page = () => { + return ( + <> + + + + + + + + + + ); +}; + +export default page; diff --git a/src/components/profile/ProfileAboutMe.tsx b/src/components/profile/ProfileAboutMe.tsx new file mode 100644 index 00000000..e8c32397 --- /dev/null +++ b/src/components/profile/ProfileAboutMe.tsx @@ -0,0 +1,126 @@ +'use client'; +import { FileText } from 'lucide-react'; +import React, { useState } from 'react'; +import { + Sheet, + SheetContent, + SheetDescription, + SheetHeader, + SheetTitle, +} from '@/components/ui/sheet'; +import { useForm } from 'react-hook-form'; +import { + aboutMeSchema, + AboutMeSchemaType, +} from '@/lib/validators/user.profile.validator'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { Button } from '@/components/ui/button'; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, +} from '@/components/ui/form'; +import { Textarea } from '../ui/textarea'; + +const ProfileAboutMe = () => { + const [isSheetOpen, setIsSheetOpen] = useState(false); + + const handleClose = () => { + setIsSheetOpen(false); + }; + const handleOpen = () => { + setIsSheetOpen(true); + }; + const form = useForm({ + resolver: zodResolver(aboutMeSchema), + defaultValues: { + aboutMe: '', + }, + }); + + // function onSubmit(values: AboutMeSchemaType) { + // console.log(values) + // } + function onSubmit() {} + + const handleFormClose = () => { + form.reset(); + handleClose(); + }; + + return ( + <> +

About Me

+
+ +
+

+ You haven’t added an about me yet +

+

+ Share a brief introduction to let companies know who you are. +

+
+ +
+ + + + Add About Me + + Share a brief introduction to let companies know who you are. + + +
+
+ +
+ ( + + +