Skip to content

Commit

Permalink
removed unused stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-ao committed Jul 23, 2024
1 parent 2bce2c1 commit 3d51003
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 43 deletions.
2 changes: 1 addition & 1 deletion components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Navbar = () => {

const handleLogout = () => signOut();
const handleLogin = () => signIn("auth0");
const isLinkActive = (uri: string) => router.pathname === uri;

const smallOnlineLogoSrc =
theme === "dark" ? "/Online_hvit_o.svg" : "/Online_bla_o.svg";
const onlineLogoSrc =
Expand Down
2 changes: 0 additions & 2 deletions components/PeriodCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from "react";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
import { periodType } from "../lib/types/types";
import { formatDateNorwegian } from "../lib/utils/dateUtils";
Expand All @@ -12,7 +11,6 @@ interface Props {

const PeriodCard = ({ period }: Props) => {
const { data: session } = useSession();
const router = useRouter();
const [hasApplied, setHasApplied] = useState(false);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion components/applicantoverview/ApplicantTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { applicantType, preferencesType } from "../../lib/types/types";
import { applicantType } from "../../lib/types/types";
import ApplicantCard from "./ApplicantCard";

interface Props {
Expand Down
2 changes: 0 additions & 2 deletions components/committee/CommitteeCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import router from "next/router";
import React from "react";
import Button from "../Button";
import Link from "next/link";

interface Props {
Expand Down
5 changes: 2 additions & 3 deletions components/committee/CommitteeInterviewTimes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const CommitteeInterviewTimes = ({
throw new Error("Failed to submit data");
}

const result = await response.json();
toast.success("Tidene er sendt inn!");
setHasAlreadySubmitted(true);
} catch (error) {
Expand Down Expand Up @@ -290,8 +289,8 @@ const CommitteeInterviewTimes = ({

<p className="px-5 my-5 text-lg text-center">
Velg ledige tider ved å trykke på eller dra over flere celler.
<br/>Intervjuene vil bli satt opp etter hverandre fra første ledige
tid.
<br />
Intervjuene vil bli satt opp etter hverandre fra første ledige tid.
</p>
<form className="flex flex-col text-center">
{hasAlreadySubmitted ? (
Expand Down
4 changes: 1 addition & 3 deletions components/committee/SendCommitteeMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useEffect, useState, ChangeEvent } from "react";
import { useEffect, useState } from "react";
import Button from "../Button";
import TextAreaInput from "../form/TextAreaInput";
import LoadingPage from "../LoadingPage";
import { useRouter } from "next/router";
import { committeeInterviewType, periodType } from "../../lib/types/types";
import { useSession } from "next-auth/react";
import toast from "react-hot-toast";

interface Props {
Expand Down
12 changes: 1 addition & 11 deletions lib/mongo/committees.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Collection, Db, MongoClient, ObjectId, UpdateResult } from "mongodb";
import { Collection, Db, MongoClient, ObjectId } from "mongodb";
import clientPromise from "./mongodb";
import { commiteeType } from "../types/types";
import { co } from "@fullcalendar/core/internal-common";

let client: MongoClient;
let db: Db;
Expand All @@ -23,15 +22,6 @@ async function init() {
await init();
})();

const userHasAccessList = (
userCommittees: string[],
dbCommittees: string[]
) => {
return dbCommittees.some((dbCommittee) =>
userCommittees.includes(dbCommittee)
);
};

const userHasAccessCommittee = (
userCommittees: string[],
dbCommittees: string
Expand Down
5 changes: 1 addition & 4 deletions lib/utils/dateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ export const formatDate = (inputDate: undefined | Date) => {
const day = date.getDate().toString().padStart(2, "0");
const month = (date.getMonth() + 1).toString().padStart(2, "0");
const year = date.getFullYear();
const hours = date.getHours().toString().padStart(2, "0");
const minutes = date.getMinutes().toString().padStart(2, "0");

return `${day}.${month}.${year}`; // - ${hours}:${minutes}
return `${day}.${month}.${year}`;
};

export const formatDateNorwegian = (inputDate?: Date): string => {
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const isApplicantType = (data: any): data is applicantType => {
data.preferences.second !== data.preferences.third);

// Check that the selectedTimes array is valid
const hasSelectedTimesFields =
/* const hasSelectedTimesFields = // TODO: DONT KNOW IF WE NEED THIS, LOOK AT THIS LATER
Array.isArray(data.selectedTimes) &&
data.selectedTimes.every(
(time: { start: any; end: any }) =>
typeof time.start === "string" && typeof time.end === "string"
);
); */

const hasOptionalFields =
data.optionalCommittees &&
Expand Down
2 changes: 0 additions & 2 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// pages/404.js
import Link from "next/link";
import Button from "../components/Button";
import Image from "next/image";

Expand Down
3 changes: 1 addition & 2 deletions pages/admin/[period-id]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useSession } from "next-auth/react";
import { useEffect, useState } from "react";
import router from "next/router";
import { applicantType, periodType } from "../../../lib/types/types";
import { periodType } from "../../../lib/types/types";
import NotFound from "../../404";
import ApplicantsOverview from "../../../components/applicantoverview/ApplicantsOverview";

Expand Down Expand Up @@ -29,7 +29,6 @@ const Admin = () => {
}
} catch (error) {
console.error("Error checking period:", error);
} finally {
}
};

Expand Down
2 changes: 0 additions & 2 deletions pages/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useSession } from "next-auth/react";
import Table, { RowType } from "../../components/Table";
import Button from "../../components/Button";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { periodType } from "../../lib/types/types";
import { formatDate } from "../../lib/utils/dateUtils";
import NotFound from "../404";

const Admin = () => {
const { data: session } = useSession();
const router = useRouter();

const [periods, setPeriods] = useState<RowType[]>([]);

Expand Down
1 change: 0 additions & 1 deletion pages/api/applicants/[period-id]/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getServerSession } from "next-auth";
import { authOptions } from "../../auth/[...nextauth]";
import {
hasSession,
isAdmin,
checkOwId,
} from "../../../../lib/utils/apiChecks";
import { getPeriodById } from "../../../../lib/mongo/periods";
Expand Down
2 changes: 1 addition & 1 deletion pages/api/applicants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getServerSession } from "next-auth";
import { emailDataType } from "../../../lib/types/types";
import { isApplicantType } from "../../../lib/utils/validators";
import { isAdmin, hasSession, checkOwId } from "../../../lib/utils/apiChecks";
import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";
import { SESClient } from "@aws-sdk/client-ses";
import capitalizeFirstLetter from "../../../lib/utils/capitalizeFirstLetter";
import sendEmail from "../../../lib/utils/sendEmail";
import { changeDisplayName } from "../../../lib/utils/toString";
Expand Down
7 changes: 1 addition & 6 deletions pages/api/committees/times/[period-id]/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { NextApiRequest, NextApiResponse } from "next";
import {
getCommittees,
createCommittee,
deleteCommittee,
updateCommitteeMessage,
} from "../../../../../lib/mongo/committees";
import {createCommittee } from "../../../../../lib/mongo/committees";
import { getServerSession } from "next-auth";
import { authOptions } from "../../../auth/[...nextauth]";
import { hasSession, isInCommitee } from "../../../../../lib/utils/apiChecks";
Expand Down

0 comments on commit 3d51003

Please sign in to comment.