Skip to content
Open
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
8 changes: 6 additions & 2 deletions components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Fragment } from 'react';
import { useSession, signOut } from 'next-auth/react';
import { Menu, Transition } from '@headlessui/react';
import { useEffect, useState } from 'react';
import { Paths } from '@lib/globals';

export default function NavBar({ pathname }) {
const { data: session } = useSession();
Expand Down Expand Up @@ -31,7 +32,7 @@ export default function NavBar({ pathname }) {

return (
<nav className="h-24 flex px-12 py-6 justify-between items-center text-[1.375rem] leading-7 font-medium bg-white">
<Link href="/">
<Link href={Paths.PostsPage}>
<svg
width="201"
height="49"
Expand Down Expand Up @@ -72,7 +73,10 @@ export default function NavBar({ pathname }) {
<div className="flex gap-x-[3.75rem]">
{/* Makes links pop in at same time */}
{accountType !== null && (
<Link href="/" className={pathname === '/' ? 'text-dark-blue font-extrabold' : ''}>
<Link
href={Paths.PostsPage}
className={pathname === Paths.PostsPage ? 'text-dark-blue font-extrabold' : ''}
>
Opportunities
</Link>
)}
Expand Down
7 changes: 4 additions & 3 deletions components/ResearcherSidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Link from 'next/link';
import { useRouter } from 'next/router';
import { Paths } from '@lib/globals';

export default function ResearcherSidebar() {
const router = useRouter();
const { pathname } = router;
return (
<aside className="w-[15.5rem] fixed">
<div className="flex flex-col h-screen items-center bg-white">
<Link href="/">
<Link href={Paths.PostsPage}>
<svg
width="199"
height="44"
Expand Down Expand Up @@ -98,10 +99,10 @@ export default function ResearcherSidebar() {
<span className="ml-2 font-medium text-lg">Dashboard</span>
</Link>
<Link
href="/posts"
href={Paths.ManagePostsPage}
className={
'flex items-center w-[12.25rem] h-14 rounded-lg' +
(pathname === '/posts' ? ' bg-light-blue/20' : '')
(pathname === Paths.ManagePostsPage ? ' bg-light-blue/20' : '')
}
>
<svg
Expand Down
6 changes: 6 additions & 0 deletions lib/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,9 @@ export const Durations = [
{ label: 'Summer', value: 'SUMMER' },
{ label: 'Year Round', value: 'YEAR_ROUND' },
];

export const Paths = {
LandingPage: '/',
PostsPage: '/posts',
ManagePostsPage: '/manage-posts',
};
148 changes: 0 additions & 148 deletions pages/about.jsx

This file was deleted.

5 changes: 3 additions & 2 deletions pages/account-type.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Head from 'next/head';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { getSession } from 'next-auth/react';
import { Paths } from '@lib/globals';

function AccountType() {
const router = useRouter();
Expand All @@ -22,7 +23,7 @@ function AccountType() {
const responseBody = await res.json();
if (responseBody?.message?.startsWith('Student al')) {
await getSession(); // calls jwt callback to update accountType
await router.push('/');
await router.push(Paths.PostsPage);
}
}
} catch (e) {}
Expand All @@ -43,7 +44,7 @@ function AccountType() {
const responseBody = await res.json();
if (responseBody?.message?.startsWith('Researcher al')) {
await getSession(); // calls jwt callback to update accountType
await router.push('/');
await router.push(Paths.PostsPage);
}
}
} catch (e) {}
Expand Down
3 changes: 2 additions & 1 deletion pages/api/applications/[jobId]/apply.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Prisma } from 'prisma/prisma-client';

import ApiRoute from '@lib/ApiRoute';
import { Paths } from '@lib/globals';

class ApplicationsApplyRoute extends ApiRoute {
/**
Expand Down Expand Up @@ -59,7 +60,7 @@ class ApplicationsApplyRoute extends ApiRoute {
},
});
await res.revalidate(`/job/${jobId}`);
await res.revalidate('/');
await res.revalidate(Paths.PostsPage);

return res.json(result);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/jobs/[jobId]/close.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Prisma } from 'prisma/prisma-client';
import ApiRoute from '@lib/ApiRoute';
import { Paths } from '@lib/globals';

class CloseJobRoute extends ApiRoute {
/**
Expand Down Expand Up @@ -46,7 +47,7 @@ class CloseJobRoute extends ApiRoute {
});

await res.revalidate(`/job/${updatedJob.id}`);
await res.revalidate('/');
await res.revalidate(Paths.PostsPage);

res.status(200).json(updatedJob);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/jobs/[jobId]/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DOMPurify from 'dompurify';
const window = new JSDOM('').window;
const purify = DOMPurify(window);
import ApiRoute from '@lib/ApiRoute';
import { Paths } from '@lib/globals';

class EditJobRoute extends ApiRoute {
/**
Expand Down Expand Up @@ -128,7 +129,7 @@ class EditJobRoute extends ApiRoute {
});

await res.revalidate(`/job/${updatedJob.id}`);
await res.revalidate('/');
await res.revalidate(Paths.PostsPage);

res.status(200).json(updatedJob);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/jobs/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DOMPurify from 'dompurify';
const window = new JSDOM('').window;
const purify = DOMPurify(window);
import ApiRoute from '@lib/ApiRoute';
import { Paths } from '@lib/globals';

/* example POST request body
{
Expand Down Expand Up @@ -123,7 +124,7 @@ class JobCreationRoute extends ApiRoute {
});

await res.revalidate(`/job/${result.id}`);
await res.revalidate('/');
await res.revalidate(Paths.PostsPage);

res.status(200).json(result);
} catch (e) {
Expand Down
Loading