-
Notifications
You must be signed in to change notification settings - Fork 0
new jobs page to see all saved jobs with proper pagination. #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| "use client"; | ||
|
|
||
| import { Job } from "@/types/job"; | ||
|
|
||
| interface JobCardProps { | ||
| job: Job; | ||
| onView?: (jobId: number) => void; | ||
| onDelete?: (jobId: number) => void; | ||
| } | ||
|
|
||
| export default function JobCard({ job, onView, onDelete }: JobCardProps) { | ||
| const inputTypeBadgeColor = job.inputType === "TEXT" ? "bg-blue-100 text-blue-800" : "bg-green-100 text-green-800"; | ||
|
|
||
| return ( | ||
| <div className="bg-white rounded-lg shadow p-6 hover:shadow-lg transition"> | ||
| <div className="flex justify-between items-start mb-3"> | ||
| <h3 className="text-lg font-bold text-gray-900">{job.jobTitle || "Untitled Job"}</h3> | ||
| <span className={`text-xs ${inputTypeBadgeColor} px-3 py-1 rounded-full`}> | ||
| {job.inputType} | ||
| </span> | ||
| </div> | ||
| <p className="text-gray-700 font-semibold mb-2">{job.companyName || "No company"}</p> | ||
| <p className="text-gray-600 text-sm mb-4 line-clamp-2"> | ||
| {job.inputType === "TEXT" ? job.jobText : job.jobLink} | ||
| </p> | ||
| <div className="flex justify-between items-center text-sm text-gray-500 mb-4"> | ||
| <span>Created: {new Date(job.createdAt).toLocaleDateString()}</span> | ||
| </div> | ||
| <div className="flex gap-2"> | ||
| <button | ||
| onClick={() => onView?.(job.jobId)} | ||
| className="flex-1 bg-gray-200 hover:bg-gray-300 text-gray-900 py-2 px-4 rounded transition" | ||
| > | ||
| View | ||
| </button> | ||
| <button | ||
| onClick={() => onDelete?.(job.jobId)} | ||
| className="flex-1 bg-red-100 hover:bg-red-200 text-red-700 py-2 px-4 rounded transition" | ||
| > | ||
| Delete | ||
| </button> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| "use client"; | ||
|
|
||
| import JobCard from "./job-card"; | ||
| import { Job } from "@/types/job"; | ||
|
|
||
| interface JobsListProps { | ||
| jobs: Job[]; | ||
| currentPage: number; | ||
| totalPages: number; | ||
| onPreviousPage: () => void; | ||
| onNextPage: () => void; | ||
| isLoading: boolean; | ||
| onView?: (jobId: number) => void; | ||
| onDelete?: (jobId: number) => void; | ||
| } | ||
|
|
||
| export default function JobsList({ | ||
| jobs, | ||
| currentPage, | ||
| totalPages, | ||
| onPreviousPage, | ||
| onNextPage, | ||
| isLoading, | ||
| onView, | ||
| onDelete, | ||
| }: JobsListProps) { | ||
| if (isLoading) { | ||
| return ( | ||
| <div className="flex justify-center items-center py-12"> | ||
| <div className="text-lg text-gray-600">Loading jobs...</div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| if (jobs.length === 0) { | ||
| return ( | ||
| <div className="flex justify-center items-center py-12"> | ||
| <div className="text-center"> | ||
| <p className="text-lg text-gray-600 mb-4">No jobs created yet</p> | ||
| <p className="text-sm text-gray-500">Create your first job to get started</p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| {/* Jobs Grid */} | ||
| <div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3"> | ||
| {jobs.map((job) => ( | ||
| <JobCard | ||
| key={job.jobId} | ||
| job={job} | ||
| onView={onView} | ||
| onDelete={onDelete} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| {/* Pagination */} | ||
| <div className="flex justify-center items-center gap-2 mt-12"> | ||
| <button | ||
| onClick={onPreviousPage} | ||
| disabled={currentPage === 1} | ||
| className="px-4 py-2 bg-gray-700 text-white rounded hover:bg-gray-800 transition disabled:opacity-50 disabled:cursor-not-allowed" | ||
| > | ||
| Previous | ||
| </button> | ||
| <span className="px-4 py-2 text-gray-600">Page {currentPage} of {totalPages}</span> | ||
| <button | ||
| onClick={onNextPage} | ||
| disabled={currentPage === totalPages} | ||
| className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition disabled:opacity-50 disabled:cursor-not-allowed" | ||
| > | ||
| Next | ||
| </button> | ||
| </div> | ||
| </> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.