Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions app/actions/posts/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,60 @@ export async function GetAllApprovedPost() {
}
}

export async function GetJobById(id: string) {
try {
const allPosts = await prisma.post.findMany({
where: {
id,
approved: true,
},

orderBy: {
createdAt: "desc",
},

select: {
id: true,
apply_link: true,
company: true,
company_logo: true,
company_website: true,
experience_level: true,
job_type: true,
location: true,
position: true,
role_description: true,
salary_disclosed: true,
salary_max: true,
salary_min: true,
author: {
select: {
id: true,
avatar: true,
username: true,
role: true,
},
},
createdAt: true,
},
});

if (!allPosts) throw new Error("No Posts Found");

return {
status: 200,
message: "Succesfylly Fetched all Posts",
data: allPosts,
};
} catch (error) {
return {
status: 404,
message: (error as Error).message,
data: [],
};
}
}

//Get jobs by authorid

export async function GetPostByAuthorId(authorId: string) {
Expand Down
14 changes: 14 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,17 @@ input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #262a34 inset;
-webkit-text-fill-color: white !important;
}

::-webkit-scrollbar {
width: 6px;
height: 6px;
}

::-webkit-scrollbar-thumb {
background-color: rgba(100, 100, 100, 0.5);
border-radius: 3px;
}

::-webkit-scrollbar-track {
background: transparent;
}
13 changes: 13 additions & 0 deletions app/jobs/[...id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import JobsId from "@/components/Job/jobId";

type tParams = Promise<{ id: string }>;

export default async function JobsIdPage({ params }: { params: tParams }) {
const { id } = await params;

return (
<div className="mt-28 px-4 text-white">
<JobsId id={id[0]} />
</div>
);
}
22 changes: 13 additions & 9 deletions app/jobs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import ActivePostModal from "@/components/Job/activeJobModal";
import FilterSideBar from "@/components/Job/filterCard";
import { lazy } from "react";
const MobileFilterCard = lazy(() => import("@/components/Job/mobFilterCard"));
const DesktopFilterCard = lazy(() => import("@/components/Job/deskFilterCard"));

const AllJobsComp = lazy(() => import("@/components/Job/Jobs"));

export default function AllJobs() {
return (
<div className="lg:flex lg:gap-8">
<DesktopFilterCard />

<MobileFilterCard />
<>
<FilterSideBar />
<div className="lg:flex lg:gap-8">
<div className="max-h-screen overflow-y-scroll lg:w-2/5 xl:w-1/2">
<AllJobsComp />
</div>

<div className="lg:w-4/5">
<AllJobsComp />
<div className="mt-24 hidden lg:block lg:w-1/2">
<ActivePostModal />
</div>
</div>
</div>
</>
);
}
27 changes: 13 additions & 14 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { auth } from "@/auth";
import { Toaster } from "@/components/ui/sonner";
import Loader from "./loading";
import RegisterSw from "@/components/RegisterSw";
import { ReactLenis } from "lenis/react";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -25,19 +24,19 @@ export default async function RootLayout({
const session = await auth();
return (
<html lang="en">
<ReactLenis root>
<body className={`${inter.className} mx-auto bg-primaryBg`}>
<Suspense fallback={<Loader />}>
<AuthProvider session={session}>
<div className="overflow-x-hidden">
{children}
<Toaster />
<RegisterSw />
</div>
</AuthProvider>
</Suspense>
</body>
</ReactLenis>
{/* <ReactLenis root> */}
<body className={`${inter.className} mx-auto bg-primaryBg`}>
<Suspense fallback={<Loader />}>
<AuthProvider session={session}>
<div className="overflow-x-hidden">
{children}
<Toaster />
<RegisterSw />
</div>
</AuthProvider>
</Suspense>
</body>
{/* </ReactLenis> */}
</html>
);
}
183 changes: 0 additions & 183 deletions components/Job/JobSheet.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions components/Job/Jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ import { useEffect } from "react";
import { GetAllApprovedPost } from "@/app/actions/posts/jobs";
import { toast } from "sonner";
import { ApprovedJobLisitingType, GetAllPostResponseType } from "@/types/types";
import { useRecoilState, useRecoilValue } from "recoil";
import { useRecoilState, useRecoilValue, useSetRecoilState } from "recoil";
import {
allJobListings,
joblistingError,
universalActivePostModal,
universalLoader,
} from "@/store/store";
import JobCardSkeleton from "./jobCardSkeletion";

export default function AllJobsComp() {
const [allJobs, setAllJobs] = useRecoilState(allJobListings);
const [loading, setLoading] = useRecoilState(universalLoader);
const setActivePostModal = useSetRecoilState(universalActivePostModal);
const errorNoPost = useRecoilValue(joblistingError);

useEffect(() => {
Expand All @@ -25,6 +27,8 @@ export default function AllJobsComp() {
const response: GetAllPostResponseType = await GetAllApprovedPost();
if (response.status !== 200) throw new Error(response.message);
setAllJobs(response.data);

setActivePostModal(response.data[0].id);
} catch (error) {
toast((error as Error).message || "Error Occured");
} finally {
Expand All @@ -42,7 +46,7 @@ export default function AllJobsComp() {
<p>No Post found</p>
</div>
) : (
<div className="gap-8 bg-transparent py-6 md:flex md:flex-col">
<div className="mt-12 gap-8 bg-transparent py-6 sm:mt-16 md:flex md:flex-col">
{loading ? (
[1, 2, 3].map((_, i) => {
return (
Expand Down
Loading