Skip to content

Commit

Permalink
Added refresh for clear filters and see all jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-cartagena committed Nov 16, 2023
1 parent 0705da6 commit e56f4d9
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ await import("./src/env.mjs");
const config = {
reactStrictMode: true,
images: {
domains: ["res.cloudinary.com"],
domains: ["res.cloudinary.com", "www.freepnglogos.com", "upload.wikimedia.org"],
},

/**
Expand Down
3 changes: 0 additions & 3 deletions src/components/DeleteJobModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Modal } from 'flowbite-react';
import React from 'react';
import { HiOutlineExclamationCircle } from 'react-icons/hi';
import { api } from "~/utils/api";
import { useRouter } from 'next/router'
import type { JobPostingType } from "~/server/api/routers/jobRouter";

interface DeleteJobModalProps {
Expand Down Expand Up @@ -34,12 +33,10 @@ export default function DeleteJobModal({ isOpen, onClose, id, setJobPostings, jo


async function deleted() {
console.log("DELETED JOB:", id ?? "No ID available");

if (id) {
try {
await mutation.mutateAsync({ id }); // Using mutateAsync to wait for completion
console.log(jobPostings)
} catch (error) {
console.error("Error deleting job posting:", error);
// Handle error if necessary
Expand Down
1 change: 0 additions & 1 deletion src/components/EventModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export default function EventModal() {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onSubmit={handleSubmit(onSubmit)}
className="space-y-5"
action="#"
>
<div className="space-y-5 whitespace-nowrap text-sm sm:flex sm:items-center sm:justify-between sm:space-y-0">
<div className="w-full sm:mr-2">
Expand Down
5 changes: 2 additions & 3 deletions src/components/JobCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { Card, Dropdown } from 'flowbite-react';
import DeleteJobModal from './DeleteJobModal';
import Image from "next/image";

export type Job = {
id: number,
Expand Down Expand Up @@ -68,7 +69,6 @@ export default function JobCard({ jobPostings, setJobPostings }: JobCardProps) {
<Dropdown.Item>
<a
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white"
href="#"
>
<p>Edit</p>
</a>
Expand All @@ -77,7 +77,6 @@ export default function JobCard({ jobPostings, setJobPostings }: JobCardProps) {
<Dropdown.Item onClick={() => openModal(job)}>
<a
className="block px-4 py-2 text-sm text-red-600 hover.bg-gray-100 dark:text-gray-200 dark:hover-bg-gray-600 dark:hover:text-white"
href="#"
>
<p>Delete</p>
</a>
Expand All @@ -89,7 +88,7 @@ export default function JobCard({ jobPostings, setJobPostings }: JobCardProps) {
{/* Top of Card */}
<div className="flex items-center mb-1 mt-[-0.5em]">
<div className="">
<img className="w-20 h-20 mr-4 max-[428px]:w-16 max-[428px]:h-16" src={job.image} alt={job.title} />
<Image className="w-20 h-20 mr-4 max-[428px]:w-16 max-[428px]:h-16" src={job.image} alt={job.title} width={1000} height={1000} />
</div>
<div>
<h3 className="text-white text-lg max-[428px]:text-[0.84rem] mb-1">{job.title}</h3>
Expand Down
1 change: 1 addition & 0 deletions src/pages/jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function Jobs() {
const resetJobs = () => {
setWasSearchBtnClicked(false);
router.push("/jobs");
router.refresh();
};

function handleResetFilters() {
Expand Down

0 comments on commit e56f4d9

Please sign in to comment.