From d10d6144b59504b830be1b6b6c6dd35294c342b4 Mon Sep 17 00:00:00 2001
From: Anurag Negi <115611556+anuragnegi000@users.noreply.github.com>
Date: Mon, 16 Sep 2024 22:36:59 +0530
Subject: [PATCH] feat:explore job page improvement (#349)
---
src/components/all-jobs.tsx | 79 ++++++++++++++++++++--------------
src/components/ui/card.tsx | 86 +++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+), 32 deletions(-)
create mode 100644 src/components/ui/card.tsx
diff --git a/src/components/all-jobs.tsx b/src/components/all-jobs.tsx
index 67123e2c..5f421e53 100644
--- a/src/components/all-jobs.tsx
+++ b/src/components/all-jobs.tsx
@@ -1,5 +1,6 @@
import { getAllJobs } from '@/actions/job.action';
import { DEFAULT_PAGE, JOBS_PER_PAGE } from '@/config/app.config';
+import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
import { JobQuerySchemaType } from '@/lib/validators/jobs.validator';
import {
PaginationNextButton,
@@ -17,7 +18,7 @@ type PaginatorProps = {
const AllJobs = async ({ searchParams }: PaginatorProps) => {
const jobs = await getAllJobs(searchParams);
- if (!jobs.status) {
+ if (!jobs.status || !jobs.additional) {
return
Error {jobs.message}
;
}
const totalPages =
@@ -26,38 +27,52 @@ const AllJobs = async ({ searchParams }: PaginatorProps) => {
const currentPage = parseInt(searchParams.page?.toString()) || DEFAULT_PAGE;
return (
- {jobs.additional?.jobs.map((job) => {
- return (
-
-
-
-
{job.title}
-
{job.companyName}
+ {jobs.additional.jobs.length > 0 ? (
+ jobs.additional?.jobs.map((job) => {
+ return (
+
+
+
+
{job.title}
+
{job.companyName}
+
+
+
+
+ {job.address}{' '}
+ ({job.workMode})
+
+
+ {job.minSalary && }
+ {job.minSalary && job.maxSalary
+ ? `${formatSalary(job.minSalary)}-${formatSalary(job.maxSalary)}`
+ : 'Not disclosed'}
+
+
+
+
+ {job.description}
+
-
-
-
- {job.address}{' '}
- ({job.workMode})
-
-
- {job.minSalary && }
- {job.minSalary && job.maxSalary
- ? `${formatSalary(job.minSalary)}-${formatSalary(job.maxSalary)}`
- : 'Not disclosed'}
-
-
-
-
- {job.description}
-
-
-
- );
- })}
+
+ );
+ })
+ ) : (
+
+
+ No Jobs Found
+
+
+
+ Sorry, no job openings meet your requirements at the moment.
+ Please check back later or adjust your search criteria.
+
+
+
+ )}
{totalPages ? (
diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx
new file mode 100644
index 00000000..fcde18dd
--- /dev/null
+++ b/src/components/ui/card.tsx
@@ -0,0 +1,86 @@
+import * as React from 'react';
+
+import { cn } from '../../lib/utils';
+
+const Card = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+Card.displayName = 'Card';
+
+const CardHeader = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+CardHeader.displayName = 'CardHeader';
+
+const CardTitle = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+CardTitle.displayName = 'CardTitle';
+
+const CardDescription = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+CardDescription.displayName = 'CardDescription';
+
+const CardContent = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+CardContent.displayName = 'CardContent';
+
+const CardFooter = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes
+>(({ className, ...props }, ref) => (
+
+));
+CardFooter.displayName = 'CardFooter';
+
+export {
+ Card,
+ CardHeader,
+ CardFooter,
+ CardTitle,
+ CardDescription,
+ CardContent,
+};