Skip to content

Commit

Permalink
Merge pull request #38 from Kashyap1ankit/fix/hero
Browse files Browse the repository at this point in the history
Fix/hero
  • Loading branch information
Kashyap1ankit authored Nov 17, 2024
2 parents 8eab79d + 6699bcd commit 9cf3f05
Show file tree
Hide file tree
Showing 83 changed files with 1,350 additions and 857 deletions.
111 changes: 110 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,112 @@
{
"extends": "next/core-web-vitals"
"parser": "@typescript-eslint/parser",

"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"strict": 0,
"no-underscore-dangle": 0,
"no-mixed-requires": 0,
"no-process-exit": 0,
"no-warning-comments": 0,
"no-use-before-define": 0,
"curly": 0,
"no-multi-spaces": 0,
"no-alert": 0,
"consistent-return": 0,
"consistent-this": [0, "self"],
"func-style": 0,
"max-nested-callbacks": 0,
"camelcase": 0,
"no-dupe-class-members": 0,
"no-debugger": 1,
"no-empty": 1,
"no-invalid-regexp": 1,
"no-unused-expressions": 1,
"no-native-reassign": 1,
"no-fallthrough": 1,
"eqeqeq": 2,
"no-undef": 0,
"no-dupe-keys": 2,
"no-empty-character-class": 2,
"no-self-compare": 2,
"valid-typeof": 2,
"handle-callback-err": 2,
"no-shadow-restricted-names": 2,
"no-new-require": 2,
"no-mixed-spaces-and-tabs": 2,
"block-scoped-var": 2,
"no-else-return": 2,
"no-throw-literal": 2,
"no-void": 2,
"radix": 2,
"wrap-iife": [2, "outside"],
"no-shadow": 0,
"no-path-concat": 2,
"valid-jsdoc": [
0,
{
"requireReturn": false,
"requireParamDescription": false,
"requireReturnDescription": false
}
],
"no-spaced-func": 2,
"semi-spacing": 2,
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"no-lonely-if": 2,
"no-floating-decimal": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"comma-style": [2, "last"],
"no-multiple-empty-lines": [2, { "max": 1 }],
"no-nested-ternary": 2,
"operator-assignment": [2, "always"],
"padded-blocks": [2, "never"],
"quote-props": [2, "as-needed"],
"keyword-spacing": [2, { "before": true, "after": true, "overrides": {} }],
"space-before-blocks": [2, "always"],
"array-bracket-spacing": [2, "never"],
"computed-property-spacing": [2, "never"],
"space-in-parens": [2, "never"],
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"wrap-regex": 2,
"linebreak-style": 0,
"semi": [2, "always"],
"arrow-spacing": [2, { "before": true, "after": true }],
"no-class-assign": 2,
"no-const-assign": 2,
"no-this-before-super": 2,
"no-var": 2,
"object-shorthand": [2, "always"],
"prefer-arrow-callback": 2,
"prefer-const": 2,
"prefer-spread": 2,
"prefer-template": 2,
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-use-before-define": ["off"],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/ban-types": "off"
},
"overrides": [
{
"files": ["test/**", "*.spec.ts", "*.test.ts"],
"rules": {
"prefer-arrow-callback": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unused-vars": 0
}
}
]
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
npm run format:check
npm run format:fix
npm run lint
git add .
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
coverage
dist
.next
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"tabWidth": 2,
"singleQuote": false,
"trailingComma": "all",
"plugins": ["prettier-plugin-tailwindcss"]
}
2 changes: 1 addition & 1 deletion README.Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ you'll want to build the image for that platform, e.g.:
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.

Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing.
docs for more detail on building and pushing.
14 changes: 7 additions & 7 deletions app/actions/posts/bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export async function HandleBookmakrClick(userId: string, postId: string) {

const checkForBookmark = await prisma.bookmark.findFirst({
where: {
postId: postId,
userId: userId,
postId,
userId,
},
});

Expand All @@ -34,8 +34,8 @@ export async function HandleBookmakrClick(userId: string, postId: string) {

const createNewBookmark = await prisma.bookmark.create({
data: {
postId: postId,
userId: userId,
postId,
userId,
},
});

Expand Down Expand Up @@ -63,8 +63,8 @@ export async function CheckForBookmark(userId: string, postId: string) {

const checkForBookmark = await prisma.bookmark.findFirst({
where: {
postId: postId,
userId: userId,
postId,
userId,
},
});

Expand Down Expand Up @@ -92,7 +92,7 @@ export async function GetBookmarkByUserId(userId: string) {

const getUserBookmarks = await prisma.bookmark.findMany({
where: {
userId: userId,
userId,
},

select: {
Expand Down
9 changes: 6 additions & 3 deletions app/actions/posts/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function deleteExpiredJobs() {
},
});

for (let job of allJobs) {
for (const job of allJobs) {
const diff = Math.floor(calculateDayDiff(job.createdAt));

if (diff >= 7) {
Expand All @@ -26,7 +26,10 @@ async function deleteExpiredJobs() {
}
}
} catch (error) {
console.log(error);
return {
status: 400,
message: (error as Error).message,
};
}
}

Expand All @@ -35,6 +38,6 @@ export const cleanDB = async () => {
"0 0 * * *", //running my delete jobs function everynight at 12am IST
async () => {
await deleteExpiredJobs();
}
},
);
};
8 changes: 4 additions & 4 deletions app/actions/posts/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export async function GetPostByAuthorId(authorId: string) {

const getPost = await prisma.post.findMany({
where: {
authorId: authorId,
authorId,
},

select: {
Expand Down Expand Up @@ -175,7 +175,7 @@ export async function DestroyPost(postId: string, authorId: string) {
const isUserAuthor = await prisma.post.findFirst({
where: {
id: postId,
authorId: authorId,
authorId,
},
});

Expand Down Expand Up @@ -238,7 +238,7 @@ export async function UploadImage(data: FormData) {
reject(err);
}
resolve(res);
}
},
);

streamifier.createReadStream(buffer).pipe(cld);
Expand All @@ -255,7 +255,7 @@ export async function UploadImage(data: FormData) {
} catch (error) {
return {
status: 200,
message: "File unot ploaded",
message: (error as Error).message,
public_id: null,
secure_url: null,
};
Expand Down
2 changes: 1 addition & 1 deletion app/actions/users/checkUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export async function GetAllUserAdmin(userId: string) {
} catch (error) {
return {
status: 404,
message: "Users fetched",
message: (error as Error).message,
data: [],
};
}
Expand Down
14 changes: 7 additions & 7 deletions app/actions/users/updateUserInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function UpdateUserInfo(
bio: string | undefined,
instagram_url: string | undefined,
twitter_url: string | undefined,
linkedin_url: string | undefined
linkedin_url: string | undefined,
) {
try {
const { success }: { success: boolean } = userProfileUpdateSchema.safeParse(
Expand All @@ -18,7 +18,7 @@ export async function UpdateUserInfo(
instagram_url,
twitter_url,
linkedin_url,
}
},
);

if (!success) throw new Error("Schema Vlidation failed");
Expand All @@ -29,13 +29,13 @@ export async function UpdateUserInfo(

const updatedUser = await prisma.user.update({
where: {
id: id,
id,
},
data: {
bio: bio,
instagram_url: instagram_url,
linkedin_url: linkedin_url,
twitter_url: twitter_url,
bio,
instagram_url,
linkedin_url,
twitter_url,
},
});

Expand Down
6 changes: 3 additions & 3 deletions app/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export default function AdminLayout({
return (
<>
<Navbar />
<div className="md:flex md:p-4 max-h-screen overflow-y-scroll no-scrollbar mt-16">
<div className="md:w-1/6 p-2 md:p-0 ">
<div className="no-scrollbar mt-16 max-h-screen overflow-y-scroll md:flex md:p-4">
<div className="p-2 md:w-1/6 md:p-0">
<AdminSideBar />
</div>
<div className="md:w-5/6 px-3 md:px-12 ">{children}</div>
<div className="px-3 md:w-5/6 md:px-12">{children}</div>
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion app/api/jobs/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prisma from "@/db";
import { NextRequest, NextResponse } from "next/server";

export async function POST(req: NextRequest, res: NextResponse) {
export async function POST(req: NextRequest) {
try {
const { experience, job, location } = await req.json();

Expand Down
2 changes: 1 addition & 1 deletion app/jobs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Navbar = lazy(() => import("@/components/Navbar/Navbar"));

export default function JobLayout({ children }: { children: React.ReactNode }) {
return (
<div className="bg-primaryBg mt-20">
<div className="mt-20 bg-primaryBg">
<Navbar />
{children}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function RootLayout({
<body className={inter.className}>
<Suspense fallback={<Loader />}>
<AuthProvider session={session}>
<div className=" overflow-x-hidden bg-primaryBg">
<div className="overflow-x-hidden bg-primaryBg">
{children}
<Toaster />
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import HashLoader from "react-spinners/HashLoader";

export default function Loader() {
return (
<div className="flex justify-center items-center w-full h-screen ">
<div className="flex h-screen w-full items-center justify-center">
<HashLoader
color={"#355ee8"}
loading={true}
Expand Down
12 changes: 6 additions & 6 deletions app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import { IoWarning } from "react-icons/io5";

export default function NotFound() {
return (
<div className="flex flex-col gap-4 justify-center items-center w-full h-screen bg-primaryBg">
<div className="flex h-screen w-full flex-col items-center justify-center gap-4 bg-primaryBg">
<motion.div
className="flex items-center "
className="flex items-center"
animate={{
y: [-200, 0],
}}
transition={{
duration: 0.3,
}}
>
<span className="text-blue-500 font-bold text-9xl">4</span>
<span className="text-9xl font-bold text-blue-500">4</span>
<span>
<Settings className="text-gray-400 size-20 animate-spin delay-600" />
<Settings className="delay-600 size-20 animate-spin text-gray-400" />
</span>
<span className="text-blue-500 font-bold text-9xl">4</span>
<span className="text-9xl font-bold text-blue-500">4</span>
</motion.div>
<div className="flex items-center">
<IoWarning className="size-6 fill-yellow-500" />
Expand All @@ -31,7 +31,7 @@ export default function NotFound() {

<Link href={"/"}>
<Button
className={`${fraunces.className} bg-gradient-to-r from-primarySkyBlue to-secondarySkyBlue hover:bg-gradient-to-r hover:to-primarySkyBlue hover:from-secondarySkyBlue`}
className={`${fraunces.className} bg-gradient-to-r from-primarySkyBlue to-secondarySkyBlue hover:bg-gradient-to-r hover:from-secondarySkyBlue hover:to-primarySkyBlue`}
aria-label="go-back"
>
Go To Homepage
Expand Down
2 changes: 1 addition & 1 deletion app/user/[userId]/jobs/bookmarks/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lazy } from "react";
const SavedJobsComp = lazy(
() => import("@/components/User/Tabs/Posts/Bookmark")
() => import("@/components/User/Tabs/Posts/Bookmark"),
);

export default function MySavedJobs() {
Expand Down
Loading

0 comments on commit 9cf3f05

Please sign in to comment.