Skip to content

Commit

Permalink
Revert "feature"
Browse files Browse the repository at this point in the history
This reverts commit 7673146.
  • Loading branch information
VineeTagarwaL-code authored Sep 15, 2024
1 parent 7673146 commit 27d38be
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 159 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ NEXTAUTH_URL="http://localhost:3000"
CDN_API_KEY=api-key
CDN_BASE_UPLOAD_URL=https://sg.storage.bunnycdn.com/job-board/assets
CDN_BASE_ACCESS_URL=https://job-board.b-cdn.net/assets


NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=

6 changes: 1 addition & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:

- name: Run format check
run: npm run check

- name: Run format fix if check fails
if: ${{ failure() }}
run: npm run format

- name: Run build
run: npm run build
run: npm run build
13 changes: 1 addition & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,16 @@
"lint": "next lint",
"dev:docker": "npm run db:seed & next dev",
"db:seed": "npx prisma db push & npx prisma db seed",
"check": "prettier --check \"**/*.{ts,tsx,js,jsx,md,mdx,css}\"",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,mdx,css}\"",
"check": "prettier --check \"**/*.{ts,tsx,js,jsx,md,mdx,css}\"",
"prepare": "husky"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.{ts,tsx,js,jsx,md,mdx,css}": [
"prettier --write"
]
},
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.645.0",
"@aws-sdk/s3-request-presigner": "^3.645.0",
"@faker-js/faker": "^9.0.0",
"@hookform/resolvers": "^3.9.0",
"@prisma/client": "5.18.0",
"@radix-ui/react-accordion": "^1.2.0",
Expand Down
15 changes: 13 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ model Job {
type String
workMode WorkMode @map("work_mode")
currency Currency @default(INR)
city String
address String
location JobLocations
application String
companyLogo String
hasSalaryRange Boolean @default(false) @map("has_salary_range")
Expand Down Expand Up @@ -59,3 +58,15 @@ enum Role {
ADMIN
}

enum JobLocations {
BANGLORE
DELHI
MUMBAI
CHENNAI
PUNE
HYDERABAD
KOLKATA
AHMEDABAD
JAIPUR
SURAT
}
15 changes: 12 additions & 3 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/* eslint-disable no-console */
import { Currency, Role, WorkMode } from '@prisma/client';
import { faker } from '@faker-js/faker';
import bcrypt from 'bcryptjs';
import prisma from '../src/config/prisma.config';
import { JobLocations } from '@prisma/client';

const users = [
{ id: '1', name: 'Jack', email: '[email protected]' },
{ id: '2', name: 'Admin', email: '[email protected]', role: Role.ADMIN },
];

const locationArr = Object.keys(JobLocations);

let jobs = [
{
id: '1',
Expand Down Expand Up @@ -284,6 +286,13 @@ async function seedUsers() {
}

async function seedJobs() {
jobs = jobs.map((j, index) => {
return {
...j,
location:
locationArr[index] !== undefined ? locationArr[index] : locationArr[3],
};
});
try {
await Promise.all(
jobs.map(async (j) =>
Expand All @@ -302,8 +311,8 @@ async function seedJobs() {
workMode: j.workMode,
currency: j.currency,
application: j.application,
city: faker.location.city(),
address: faker.location.streetAddress(),
//@ts-ignore
location: j.location,
companyLogo: j.companyLogo,
hasSalaryRange: j.hasSalaryRange,
minSalary: j.minSalary,
Expand Down
28 changes: 6 additions & 22 deletions src/actions/job.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export const createJob = withServerActionAsyncCatcher<
type,
category,
application,
city,
address,
location,
companyLogo,
title,
workMode,
Expand All @@ -53,8 +52,7 @@ export const createJob = withServerActionAsyncCatcher<
hasSalaryRange,
minSalary,
maxSalary,
city,
address,
location,
companyLogo,
workMode,
isVerifiedJob: false, // Default to false since there's no session to check for admin role
Expand All @@ -75,8 +73,8 @@ export const getAllJobs = withServerActionAsyncCatcher<
if (data?.salaryrange && !Array.isArray(data?.salaryrange)) {
data.salaryrange = Array.of(data?.salaryrange);
}
if (data?.city && !Array.isArray(data?.city)) {
data.city = Array.of(data?.city);
if (data?.location && !Array.isArray(data?.location)) {
data.location = Array.of(data?.location);
}
const result = JobQuerySchema.parse(data);
const { filterQueries, orderBy, pagination } = getJobFilters(result);
Expand All @@ -92,8 +90,7 @@ export const getAllJobs = withServerActionAsyncCatcher<
title: true,
description: true,
companyName: true,
city: true,
address: true,
location: true,
workMode: true,
minSalary: true,
maxSalary: true,
Expand Down Expand Up @@ -134,8 +131,7 @@ export const getJobById = withServerActionAsyncCatcher<
companyBio: true,
companyEmail: true,
companyLogo: true,
city: true,
address: true,
location: true,
workMode: true,
minSalary: true,
maxSalary: true,
Expand All @@ -146,15 +142,3 @@ export const getJobById = withServerActionAsyncCatcher<
job,
}).serialize();
});

export const getCityFilters = async () => {
const response = await prisma.job.findMany({
select: {
city: true,
},
});
const cities = Array.from(new Set(response.map((res) => res.city)));
return new SuccessResponse(`Cities fetched successfully`, 200, {
cities,
}).serialize();
};
27 changes: 0 additions & 27 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -345,30 +345,3 @@
overflow-x: hidden !important; /* Allow horizontal scrolling */
overflow-y: hidden !important; /* Hide vertical overflow */
}

.pac-container {
background-color: black !important;
color: #fff;
border-radius: 8px;
padding-top: 5px;
padding-bottom: 5px;
font-family: '__Inter_36bd41', '__Inter_Fallback', sans-serif !important;
font-size: 14px !important;
}
.pac-item {
color: #fff !important;
border: none;
font-size: 14px;
}
.pac-item:hover {
background-color: hsl(0, 0%, 14.9%) !important;
cursor: pointer;
}
.pac-item-query {
color: white;
font-weight: bold;
}

.pac-logo.hdpi::after {
content: none;
}
2 changes: 1 addition & 1 deletion src/components/all-jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AllJobs = async ({ searchParams }: PaginatorProps) => {
<div className="flex gap-2 text-xs text-muted-foreground">
<span className="flex items-center gap-0.5">
<Icon icon="location" size={12} />
{job.address}{' '}
{job.location}{' '}
<span className="capitalize">({job.workMode})</span>
</span>
<span className="flex items-center gap-0.5">
Expand Down
42 changes: 0 additions & 42 deletions src/components/gmaps-autosuggest.tsx

This file was deleted.

24 changes: 18 additions & 6 deletions src/components/job-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Image from 'next/image';
import { FaFileUpload } from 'react-icons/fa';
import { Switch } from './ui/switch';
import { Label } from './ui/label';
import { GmapsAutocompleteAddress } from './gmaps-autosuggest';

const PostJobForm = () => {
const { toast } = useToast();
Expand All @@ -44,8 +43,7 @@ const PostJobForm = () => {
companyName: '',
companyBio: '',
companyEmail: '',
city: '',
address: '',
location: undefined,
companyLogo: '',
workMode: 'remote',
type: 'full-time',
Expand Down Expand Up @@ -112,8 +110,7 @@ const PostJobForm = () => {

const handleFormSubmit = async (data: JobPostSchemaType) => {
try {
data.companyLogo =
(await submitImage(file)) ?? 'https://wwww.example.com';
data.companyLogo = (await submitImage(file)) ?? '';
``;
const response = await createJob(data);
if (!response.status) {
Expand Down Expand Up @@ -345,7 +342,22 @@ const PostJobForm = () => {
)}
</div>

<GmapsAutocompleteAddress form={form}></GmapsAutocompleteAddress>
<FormField
control={form.control}
name="location"
render={({ field }) => (
<FormItem>
<FormLabel className="font-medium">Location</FormLabel>
<FormControl>
<Input
{...field}
className="w-full bg-gray-800 border-none text-white"
placeholder="Where is the job located?"
/>
</FormControl>
</FormItem>
)}
/>

<FormField
control={form.control}
Expand Down
12 changes: 6 additions & 6 deletions src/layouts/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ const Footer = () => {
<div className="flex flex-col gap-2">
<p className="font-bold text-base md:text-lg">Follow us on</p>
<div className="flex gap-3">
{socials.map((social, index) => (
{socials.map((social) => (
<Link
target="_blank"
key={social.href + index}
key={social.href}
href={social.href}
aria-label={social.label}
>
Expand All @@ -48,9 +48,9 @@ const Footer = () => {
<div className="flex flex-col gap-2 ">
<p className="font-bold text-xl md:text-2xl">100xLinks</p>

{footerLinks['100xlinks'].map((link, index) => (
{footerLinks['100xlinks'].map((link) => (
<Link
key={link.href + index}
key={link.href}
href={link.href}
className="text-foreground/60 hover:text-foreground/80 sm:text-lg font-light"
>
Expand All @@ -61,9 +61,9 @@ const Footer = () => {
<div className="flex flex-col gap-2 ">
<p className="font-bold text-xl md:text-2xl">100xLegal</p>

{footerLinks['100xlegal'].map((link, index) => (
{footerLinks['100xlegal'].map((link) => (
<Link
key={link.href + index}
key={link.href}
href={link.href}
className="text-foreground/60 hover:text-foreground/80 sm:text-lg font-light"
>
Expand Down
Loading

0 comments on commit 27d38be

Please sign in to comment.