Skip to content

Commit

Permalink
fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
zakiabdullahi committed Sep 5, 2024
2 parents 1684aae + bf2055e commit 7816908
Show file tree
Hide file tree
Showing 26 changed files with 380 additions and 516 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-slot": "^1.1.0",
"dayjs": "^1.11.13",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@tanstack/react-query": "^5.51.23",
Expand All @@ -42,6 +41,7 @@
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"lodash": "^4.17.21",
"lucide-react": "^0.426.0",
"next": "14.2.5",
Expand All @@ -54,6 +54,7 @@
"react-icons": "^5.2.1",
"tailwind-merge": "^2.4.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.1",
"zod": "^3.23.8",
"zod-error": "^1.5.0"
},
Expand Down
50 changes: 50 additions & 0 deletions prisma/migrations/20240901095201_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- CreateEnum
CREATE TYPE "Currency" AS ENUM ('INR', 'USD');

-- CreateEnum
CREATE TYPE "WorkMode" AS ENUM ('remote', 'hybrid', 'office');

-- CreateEnum
CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN');

-- CreateEnum
CREATE TYPE "Location" AS ENUM ('BANGLORE', 'DELHI', 'MUMBAI', 'PUNE', 'CHENNAI', 'HYDERABAD', 'KOLKATA', 'AHMEDABAD', 'JAIPUR', 'SURAT');

-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"avatar" TEXT,
"isVerified" BOOLEAN NOT NULL DEFAULT false,
"role" "Role" NOT NULL DEFAULT 'USER',

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Job" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"company_name" TEXT NOT NULL,
"work_mode" "WorkMode" NOT NULL,
"currency" "Currency" NOT NULL DEFAULT 'INR',
"location" "Location" NOT NULL,
"has_salary_range" BOOLEAN NOT NULL DEFAULT false,
"minSalary" INTEGER,
"maxSalary" INTEGER,
"is_verified_job" BOOLEAN NOT NULL DEFAULT false,
"postedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Job_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- AddForeignKey
ALTER TABLE "Job" ADD CONSTRAINT "Job_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
15 changes: 15 additions & 0 deletions prisma/migrations/20240902211016_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
Warnings:
- Changed the type of `location` on the `Job` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- CreateEnum
CREATE TYPE "JobLocations" AS ENUM ('BANGLORE', 'DELHI', 'MUMBAI', 'PUNE', 'CHENNAI', 'HYDERABAD', 'KOLKATA', 'AHMEDABAD', 'JAIPUR', 'SURAT');

-- AlterTable
ALTER TABLE "Job" DROP COLUMN "location",
ADD COLUMN "location" "JobLocations" NOT NULL;

-- DropEnum
DROP TYPE "Location";
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
17 changes: 6 additions & 11 deletions src/actions/job.action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use server';
import { ADMIN_ROLE } from '@/config/app.config';
import prisma from '@/config/prisma.config';
import { withSession } from '@/lib/session';
import { withServerActionAsyncCatcher } from '@/lib/async-catch';
import { SuccessResponse } from '@/lib/success';
import {
Expand All @@ -19,12 +17,11 @@ import { getAllJobsAdditonalType, getJobType } from '@/types/jobs.types';
type additional = {
isVerifiedJob: boolean;
};
export const createJob = withSession<
export const createJob = withServerActionAsyncCatcher<
JobPostSchemaType,
ServerActionReturnType<additional>
>(async (session, data) => {
>(async (data) => {
const result = JobPostSchema.parse(data);
const isVerifiedJob = session.user.role === ADMIN_ROLE;
const {
companyName,
location,
Expand All @@ -38,23 +35,21 @@ export const createJob = withSession<
} = result;
await prisma.job.create({
data: {
userId: session.user.id,
userId: '1', // Default to 1 since there's no session to check for user id
title,
description,
companyName,
hasSalaryRange,
minSalary,
maxSalary,
isVerifiedJob,
location,
workMode,
currency,
isVerifiedJob: false, // Default to false since there's no session to check for admin role
},
});
const message = isVerifiedJob
? 'Job created successfully'
: 'Job created successfully, waiting for admin approval';
const additonal = { isVerifiedJob };
const message = 'Job created successfully, waiting for admin approval';
const additonal = { isVerifiedJob: false };
return new SuccessResponse(message, 201, additonal).serialize();
});

Expand Down
17 changes: 0 additions & 17 deletions src/app/(auth)/signin/page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/app/(auth)/signup/page.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/api/auth/[...nextauth]/route.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/app/jobs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ const page = async ({ searchParams }: { searchParams: JobQuerySchemaType }) => {
}
const parsedSearchParams = parsedData.data;
return (
<div className="container flex gap-5 pt-5">
<JobFilters searchParams={parsedSearchParams} />
<div className="container flex gap-5 pt-5 mt-10">
<div className="hidden sm:block border h-fit rounded-lg w-[310px] ">
<JobFilters searchParams={parsedSearchParams} />
</div>
<div className="grow">
<JobsHeader searchParams={parsedSearchParams} />
<Suspense
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Metadata } from 'next';
import { Inter as FontSans } from 'next/font/google';
import './globals.css';
import TopLoader from '@/components/Toploader';
import ScrollToTop from '@/components/ScrollToTop';

const fontSans = FontSans({
subsets: ['latin'],
Expand Down Expand Up @@ -36,6 +37,7 @@ export default async function RootLayout({
<main className="grow grid">{children}</main>
<Footer />
</Providers>
<ScrollToTop />
</body>
</html>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/HalfCircleGradient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default function HalfCircleGradient({ position }: { position: string }) {
return (
<div
className={cn(
'absolute left-1/2 transform -translate-x-1/2 w-[90%] blur-[130px] bg-no-repeat -z-10',
'absolute left-1/2 transform -translate-x-1/2 w-[100%] sm:w-[90%] blur-[130px] bg-no-repeat -z-10',
{
'-top-28 bg-gradient-to-b from-[#2563EB]/40 to-[#3672E3]/20 rounded-b-full h-[500px]':
'-top-52 sm:-top-32 bg-gradient-to-b from-[#2563EB]/40 to-[#3672E3]/20 rounded-b-full h-[420px]':
position === 'top',
'bottom-3 bg-gradient-to-t from-[#2563EB]/40 to-[#3672E3]/20 rounded-t-full h-[700px] overflow-hidden':
'sm:bottom-0 bg-gradient-to-t from-[#2563EB]/40 to-[#3672E3]/20 rounded-t-full h-[500px] overflow-hidden':
position === 'bottom',
}
)}
Expand Down
41 changes: 41 additions & 0 deletions src/components/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use client';
import { Button } from './ui/button';
import { MoveUp } from 'lucide-react';
import { useEffect, useState } from 'react';

export default function ScrollToTop() {
const [isVisible, setIsVisible] = useState(false);

useEffect(() => {
const handleScroll = () => {
if (window.scrollY > 200) {
setIsVisible(true);
} else {
setIsVisible(false);
}
};
window.addEventListener('scroll', handleScroll);

return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);

function toUp() {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
}
return (
<Button
className={`fixed bottom-5 right-5 w-[50px] h-[50px] rounded-full bg-white text-black flex items-center justify-center shadow-lg hover:bg-gray-200 transition-opacity duration-300 ${
isVisible ? 'opacity-100' : 'opacity-0 pointer-events-none'
}`}
aria-label="Scroll to top"
onClick={toUp}
>
<MoveUp className="text-black" />
</Button>
);
}
4 changes: 2 additions & 2 deletions src/components/all-jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const AllJobs = async ({ searchParams }: PaginatorProps) => {
DEFAULT_PAGE;
const currentPage = parseInt(searchParams.page?.toString()) || DEFAULT_PAGE;
return (
<div className="bg-background py-4 grid gap-3">
<div className="bg-background py-4 grid gap-3 w-full">
{jobs.additional?.jobs.map((job) => {
return (
<Link key={job.id} href={`/jobs/${job.id}`}>
<div
className="w-full flex flex-col items-start gap-4 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
className="w-[94%] mx-auto flex flex-col items-start gap-4 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
key={job.id}
>
<div className="flex w-full flex-col gap-2">
Expand Down
Loading

0 comments on commit 7816908

Please sign in to comment.