Skip to content

Commit

Permalink
Quicker Add job and event rendering, added delete modal to delete eve…
Browse files Browse the repository at this point in the history
…nt button, changed job dropdown to trash delete icon, and sybntax changes throughout the project.
  • Loading branch information
zeshankhatri committed Nov 17, 2023
1 parent 07b55fd commit 01f6654
Show file tree
Hide file tree
Showing 33 changed files with 614 additions and 613 deletions.
377 changes: 116 additions & 261 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();

async function main() {
for (const jobPosting of jobPostings) {
await prisma.jobPosting.create({
data: jobPosting
})
}
for (const event of events) {
await prisma.event.create({
data: event,
});
}
for (const jobPosting of jobPostings) {
await prisma.jobPosting.create({
data: jobPosting,
});
}
}

main()
.catch((e) => {
console.log(e);
process.exit(1)
}).finally(() => {
process.exit(1);
})
.finally(() => {
void prisma.$disconnect();
})
});
Binary file not shown.
Binary file removed public/assets/images/coder.png
Binary file not shown.
Binary file removed public/assets/images/groups.png
Binary file not shown.
Binary file removed public/assets/images/people10.png
Binary file not shown.
Binary file removed public/assets/images/people3.jpeg
Binary file not shown.
Binary file removed public/assets/images/people4.jpg
Binary file not shown.
Binary file removed public/assets/images/people5.jpg
Binary file not shown.
Binary file removed public/assets/images/people6.jpg
Binary file not shown.
Binary file removed public/assets/images/thisweek.png
Binary file not shown.
14 changes: 8 additions & 6 deletions src/Data/jobPostingsData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const jobPostings = [
{
image: "https://www.freepnglogos.com/uploads/netflix-logo-app-png-16.png",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202460/init-dashboard/jobs/netflix-logo.png",
title: "Software Engineer",
company: "Netflix",
jobType: "Fulltime",
Expand All @@ -12,7 +13,7 @@ export const jobPostings = [

{
image:
"https://www.freepnglogos.com/uploads/google-logo-png/google-logo-png-suite-everything-you-need-know-about-google-newest-0.png",
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202362/init-dashboard/jobs/google-logo.png",
title: "Software Engineer",
company: "Google",
jobType: "Fulltime",
Expand All @@ -24,7 +25,7 @@ export const jobPostings = [

{
image:
"https://tbcdn.talentbrew.com/company/234/gst_v1_0/img/logo-capital-one.svg",
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202587/init-dashboard/jobs/capital-one-logo.svg",
title: "Software Engineer",
company: "Capital One",
jobType: "Fulltime",
Expand All @@ -36,7 +37,7 @@ export const jobPostings = [

{
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Amazon_icon.svg/2500px-Amazon_icon.svg.png",
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202798/init-dashboard/jobs/104477_amazon_icon_b5cspe.png",
title: "Software Engineer",
company: "Amazon",
jobType: "Fulltime",
Expand All @@ -48,7 +49,7 @@ export const jobPostings = [

{
image:
"https://www.freepnglogos.com/uploads/google-logo-png/google-logo-png-suite-everything-you-need-know-about-google-newest-0.png",
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202362/init-dashboard/jobs/google-logo.png",
title: "Data Science",
company: "Google",
jobType: "Fulltime",
Expand All @@ -59,7 +60,8 @@ export const jobPostings = [
},

{
image: "https://www.freepnglogos.com/uploads/netflix-logo-app-png-16.png",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700202460/init-dashboard/jobs/netflix-logo.png",
title: "Machine Learning",
company: "Netflix",
jobType: "Fulltime",
Expand Down
93 changes: 93 additions & 0 deletions src/Data/programData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
export const programs = [
{
// {index 1} index in mapping
title: "Explore",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203809/init-dashboard/programs/initexplore.png",
description:
"INIT Explore is a program focused on the software development side of technology. From web development to machine learning to simple scripts, this program aims to expose members to all sorts of different programming languages and frameworks commonly used in the industry.",

open: true,
//pages that applications will be filled up
url: "https://airtable.com/appkfpQOssQZfmORj/shrNlrSaT073i6fog",
color: "#EB6A65",
},
{
// {index 2} index in mapping
title: "Reach",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203807/init-dashboard/programs/initreach.png",
description:
"INIT Reach is a program focused on the hardware development side of technology. Using all sorts of machinery, large or small, this program aims inspire members to create their own devices with the technology available today.",
open: true,
url: "https://airtable.com/appkfpQOssQZfmORj/shrNlrSaT073i6fog",
color: "#6FA4F4",
},
{
// {index 3} index in mapping
title: "Build",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203808/init-dashboard/programs/initbuild.jpg",
description:
"INIT Build is a program focused on project development. Teams have nine weeks to complete a project corresponding to a topic in technology that they may be interested in. From mobile applications to games to even robots.",
open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#FC6C3F",
},
{
// {index 4} index in mapping
title: "Ignite",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203805/init-dashboard/programs/InitIgnite.jpg",
description:
"INIT Ignite is a program focused on information technology, a field in technology. Commonly overlooked, information technology ensures that the systems running the software are secured and works. ",
open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#87DE65",
},
{
// {index 5} index in mapping
title: "Hack",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203811/init-dashboard/programs/inithack.jpg",
description:
"INIT Hack is a program focused on the community in Computer Science. Across the country, there are various coding competitions, Hackathons, where students must create a solution by the end of a given time frame. Most students work as teams, with the members being fellow students in the same school. ",
open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#A27BFC",
},
{
// {index 6} index in mapping
title: "Discover",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203802/init-dashboard/programs/Initdiscover.jpg",
description:
"INIT Discover is a program focused on the academic side of technology. Though often overlooked, research is a viable career path for students interested in academics or furthering advancements in the field. ",
open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#7F88A0",
},
{
// {index 7} index in mapping
title: "Uplift",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203814/init-dashboard/programs/inituplift.jpg",
description:
"INIT Uplift is a program focused on mentorship. Many incoming freshmen are overwhelmed by the amount of information available to them from the start. Our program aims to guide these new students and help them kickstart their tech careers. Those with experience in the field or program help to navigate freshmen during these rough times and allow them to establish a network or two. Mentor with us or get a mentor today",

open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#FF3E9E",
},
{
// {index 8} index in mapping
title: "Launch",
image:
"https://res.cloudinary.com/dh6y8bufo/image/upload/v1700203809/init-dashboard/programs/initlaunch.jpg",
description:
"INIT Launch is a program focused on project development. Teams have nine weeks to complete a project corresponding to a topic in technology that they may be interested in. From mobile applications to games to even robots, this program aims teach you the fundamentals of project development in the real world. No experience is required to spark up your portfolio with us.",
open: false,
url: "https://generalassemb.ly/education/user-experience-design-immersive",
color: "#11CEBB",
},
];
Binary file modified src/assets/images/programCards/InitIgnite.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/programCards/Initdiscover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/programCards/initbuild.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/programCards/inithack.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/programCards/initlaunch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/programCards/inituplift.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/init.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,3 @@ export const ChartComponentProjects = () => {
</div>
);
};

{
/*
<div>
<img
src="/assets/images/coder.png"
loading="lazy"
alt=""
width={50}
height={500}
className="w-xs"
/>
</div>
*/
}
Original file line number Diff line number Diff line change
@@ -1,43 +1,64 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
"use client";
import { Modal } from "flowbite-react";
import React from "react";
import { HiOutlineExclamationCircle } from "react-icons/hi";
import { api } from "~/utils/api";

interface DeleteJobModalProps {
export type SetPostingsStateType =
| React.Dispatch<
React.SetStateAction<
{
id: number;
image: string;
title: string;
company: string;
jobType: string;
jobPosition: string;
jobLocation: string;
date: string;
url: string;
}[]
>
>
| React.Dispatch<
React.SetStateAction<
{
id: number;
name: string;
description: string;
picture: string;
location: string;
program: string;
time: Date;
rsvpLink: string;
}[]
>
>;

interface DeleteModalProps {
cardType: string;
isOpen: boolean;
onClose: () => void;
id?: number; // Optional id prop,
setJobPostings: React.Dispatch<
React.SetStateAction<
{
id: number;
image: string;
title: string;
company: string;
jobType: string;
jobPosition: string;
jobLocation: string;
date: string;
url: string;
}[]
>
>;
setPostings: SetPostingsStateType;
}

export default function DeleteJobModal({
export default function DeleteModal({
cardType,
isOpen,
onClose,
id,
setJobPostings,
}: DeleteJobModalProps) {
const mutation = api.jobs.delete.useMutation({
onSuccess: (jobPostings) => {
setJobPostings((currentJobPostings) =>
currentJobPostings.filter((job) => job.id !== jobPostings.id),
setPostings,
}: DeleteModalProps) {
const route = cardType === "job" ? api.jobs : api.events;
const mutation = route.delete.useMutation({
onSuccess: (postings) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setPostings((currentPostings: any[]) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
currentPostings.filter(
(posting: { id: number }) => posting.id !== postings.id,
),
);
},
});
Expand All @@ -47,7 +68,7 @@ export default function DeleteJobModal({
try {
await mutation.mutateAsync({ id }); // Using mutateAsync to wait for completion
} catch (error) {
console.error("Error deleting job posting:", error);
console.error(`Error deleting ${cardType} posting:`, error);
// Handle error if necessary
}
}
Expand All @@ -73,22 +94,20 @@ export default function DeleteJobModal({
<div className="text-center">
<HiOutlineExclamationCircle className="mx-auto mb-4 h-14 w-14 text-red-600 dark:text-red-300" />
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
Are you sure you want to delete this job posting?
Are you sure you want to delete this {cardType} posting?
</h3>
<div className="flex justify-center gap-4">
<button
className="mb-2 mr-2 rounded-lg bg-primary_yellow px-5 py-2.5 text-sm
font-medium text-black hover:bg-yellow-500 focus:outline-none
focus:ring-4 focus:ring-yellow-300 dark:focus:ring-yellow-900"
font-medium text-black hover:bg-light_yellow focus:outline-none focus:ring-2 focus:ring-light_yellow"
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={deletedAndClose}
>
{"Yes, I'm sure"}
</button>
<button
className="mb-2 mr-2 rounded-lg bg-gray-300 px-5 py-2.5 text-sm
font-medium text-black hover:bg-gray-500 focus:outline-none
focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-900"
className="mb-2 mr-2 rounded-lg bg-primary_gray px-5 py-2.5 text-sm
font-medium text-black hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-500"
onClick={onClose}
>
{"No, cancel"}
Expand Down
Loading

0 comments on commit 01f6654

Please sign in to comment.