Skip to content
Merged
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
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@eslint/js": "^9.17.0",
"@svgr/webpack": "^6.2.1",
"@types/react-dom": "^19.1.3",
"daisyui": "^5.0.28",
"eslint-config-react-app": "^7.0.1",
"eslint-define-config": "^2.1.0",
Expand Down
43 changes: 43 additions & 0 deletions src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Declarations file for fixing certain type errors

declare module "*.webp" {
const value: string;
export default value;
}

declare type PagesState = {
pages: string[];
activePage: string;
}

// FOr about section idk what this is tbh
declare interface AboutItem {
title: string;
description: string;
}

// This the result returned from 'packageOpportunityCard' in opportunity_routes.py in backend
declare interface OpportunityCardData {
"id": string,
"title": string,
"professor": string,
"season": stringr,
"location": string,
"year": string,
}

// This the result returned from 'packageIndividualOpportunity' in opportunity_routes.py in backend
declare interface OpportunityData {
"id": string;
"name": string;
"description": string;
"recommended_experience": string;
"author": string;
"authorProfile": string;
"department": string;
"pay": string;
"credits"?: string;
"semester": string
"application_due": string;
"recommended_class_years": string;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from "react";
import AboutSectionElement from "./AboutSectionElement";

const AboutSection = ({ aboutSection }) => {
interface AboutSectionProps {
aboutSection: AboutItem[];
}

const AboutSection = ({ aboutSection }: AboutSectionProps) => {
let i = 0;

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

const AboutSectionElement = ({ title, description }) => {
const AboutSectionElement = ({ title, description }: { title: string, description: string }) => {
return (
<div className="about-head">
<h5 className="about-title">{title}</h5>
Expand Down
17 changes: 8 additions & 9 deletions src/opportunities/components/HorizontalIconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from "react";
import PropTypes from "prop-types";

const HorizontalIconButton = ({ children, onClick, icon, special }) => {
interface HorizontalIconButtonProps {
children?: React.ReactNode;
onClick: (arg?: React.ReactNode) => void;
icon: React.ReactNode;
special: boolean;
}

const HorizontalIconButton = ({ children, onClick, icon, special }: HorizontalIconButtonProps) => {
return (
<div
className={`${special && "font-medium"} ${
Expand All @@ -21,11 +27,4 @@ const HorizontalIconButton = ({ children, onClick, icon, special }) => {
);
};

HorizontalIconButton.propTypes = {
children: PropTypes.node,
onClick: PropTypes.func.isRequired,
icon: PropTypes.node,
special: PropTypes.bool,
}

export default HorizontalIconButton;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

const JobDescription = ({ title, description }) => {
const JobDescription = ({ title, description }: { title?: string, description: string }) => {
return (
<article className="job-desc-header">
<div className="job-desc-title">{title || "Role Description"}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import AboutSection from "./AboutSection";
import JobHeader from "./JobHeader";
import JobDescription from "./JobDescription";

interface JobDetailsProps {
name: string;
author: string;
department: string;
description: string;
authorProfile: string;
aboutSection: AboutItem[];
recommended_experience: string;
}

const JobDetails = ({
name,
author,
Expand All @@ -11,7 +21,7 @@ const JobDetails = ({
authorProfile,
aboutSection,
recommended_experience,
}) => {
}: JobDetailsProps) => {
return (
<article className="job-details-header">
<JobHeader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React from "react";
import Avatar from "../../shared/components/UIElements/Avatar.tsx";

const JobHeader = ({ title, img, author, department }) => {
interface JobHeaderProps {
title: string;
img: string;
author: string;
department: string;
}

const JobHeader = ({ title, img, author, department }: JobHeaderProps) => {
return (
<section className="job-header-header">
<h2 className="job-header-title">{title}</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import React from "react";

const JobInteractionButton = ({ className, special, onClick, children }) => {
interface JobInteractionButtonProps {
className: string;
special: string;
onClick: () => void
children: React.ReactNode
}

const JobInteractionButton = ({ className, special, onClick, children }: JobInteractionButtonProps) => {
return (
<div className={`${className}`}>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import React from "react";

interface JobPostProps {
title: string;
professor: string;
id: string;
location: string;
season: string;
year: string;
onClick: (id: string) => void;
active: boolean;
}

const JobPost = ({
title,
professor,
Expand All @@ -9,7 +20,7 @@ const JobPost = ({
year,
onClick,
active,
}) => {
}: JobPostProps) => {
return (
<div className="job-post-header">
<div className={`${active && "border-l-2 border-l-purple-600"}`} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import React from "react";
import { useLocation } from "react-router";

const JobsNavigation = ({ jobPage, switchPage }) => {
interface JobsNavigationProps {
jobPage: boolean;
switchPage: () => void;
}

const JobsNavigation = ({ jobPage, switchPage }: JobsNavigationProps) => {
const path = useLocation().pathname;

Check failure on line 10 in src/opportunities/components/JobsNavigation.tsx

View workflow job for this annotation

GitHub Actions / eslint

'path' is assigned a value but never used

const activeLink = "active-link";
const normalLink = "normal-link hover:border-b-2 hover:text-black";
Expand Down
6 changes: 3 additions & 3 deletions src/opportunities/components/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const Posts = () => {
}, []);


const fetchOpportunities = async () => {
const fetchOpportunities = useCallback(async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good thinking, this should help reduce calls to the backend

const queryParams = new URLSearchParams(
Object.entries(opportunityState.filters.filterMap)
.filter(([, value]) => {
Expand Down Expand Up @@ -152,11 +152,11 @@ const Posts = () => {
console.error("Error fetching opportunities:", error);
dispatch({ type: "SET_OPPORTUNITIES", opportunities: [] });
}
};
}, [opportunityState.filters.filterMap, dispatch]);

useEffect(() => {
fetchOpportunities();
}, [opportunityState.filters.filterMap]);
}, [fetchOpportunities]);

return (
<section>
Expand Down
17 changes: 8 additions & 9 deletions src/opportunities/components/SmallTextButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from "react";
import PropTypes from "prop-types";

const SmallTextButton = ({ children, onClick, special, className }) => {
interface SmallTextButtonProps {
children: React.ReactNode;
onClick: () => void;
special: boolean;
className: string;
}

const SmallTextButton = ({ children, onClick, special, className }: SmallTextButtonProps) => {
return (
<div className={`${className}`}>
<button
Expand All @@ -16,11 +22,4 @@ const SmallTextButton = ({ children, onClick, special, className }) => {
);
};

SmallTextButton.propTypes = {
children: PropTypes.node,
onClick: PropTypes.func.isRequired,
special: PropTypes.bool,
className: PropTypes.string,
}

export default SmallTextButton;
6 changes: 3 additions & 3 deletions src/opportunities/pages/IndividualPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useEffect } from "react";
const IndividualPost = () => {
const { postID } = useParams();

const [details, setDetails] = useState("Searching");
const [details, setDetails] = useState<string | OpportunityData>("Searching");

const fetchOpportunities = async () => {
// Consider moving the base URL to a configuration
Expand All @@ -31,7 +31,7 @@ const IndividualPost = () => {

useEffect(() => {
findDetails();
}, []);
});

return (
<div>
Expand All @@ -40,7 +40,7 @@ const IndividualPost = () => {
) : details === "Nothing found" ? (
<p>No post found</p>
) : (
<JobDetails {...details} />
<JobDetails {...details as OpportunityData} />
)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function CheckBox({
{...formHook}
id={item}
className={type === "radio" ? "radio" : "checkbox"}
defaultChecked={(name === "semesters" && filters?.semesters?.includes(item)) || (name === "years" && filters?.years?.includes(item)) || (name === "credits" && filters?.credits?.includes(item) ? true : false)}
defaultChecked={(name === "semesters" && filters?.semesters?.includes(item)) || (name === "years" && filters?.years?.includes(Number(item))) || (name === "credits" && filters?.credits?.includes(item) ? true : false)}
/>
</label>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import React from "react";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { useEffect } from "react";
import Input from "../../../staff/components/Input";

const EditInformation = ({className, id, name, department, researchCenter, description, email, role, image }) => {
const submitHandler = (data) => {
interface EditInformationProps {
className?: string;
id: string;
name: string;
department: string;
researchCenter: string;
description: string;
email: string;
role: string;
image: string;
}

interface FormType {
id: string,
name: string,
email: string,
role: string,
description: string;
department: string;
researchCenter: string;
}

const EditInformation = ({className, id, name, department, researchCenter, description, email, role, image }: EditInformationProps) => {

Check failure on line 27 in src/shared/components/Profile/EditInformation.tsx

View workflow job for this annotation

GitHub Actions / eslint

'image' is defined but never used
const submitHandler = (data: FormType) => {
console.log(data);
};

Expand All @@ -25,7 +45,7 @@
},
});

var forms = (
const forms = (
<form
onSubmit={handleSubmit((data) => {
submitHandler(data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import React from "react";
import { Link } from "react-router-dom";

interface OpportunityActionCardProps {
editPath: string;
title: string;
body: React.ReactNode;
id: string;
activeStatus: string;
changeActiveStatus: (id: string, activeStatus: string) => void;
deleteOpp: (id: string) => void;
}

const OpportunityActionCard = ({
editPath,
title,
Expand All @@ -9,7 +19,7 @@ const OpportunityActionCard = ({
activeStatus,
changeActiveStatus,
deleteOpp,
}) => {
}: OpportunityActionCardProps) => {
if (title.length > 100) {
title = title.slice(0, 150) + " ...";
}
Expand Down
Loading
Loading