Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 6993f97

Browse files
sort completed and withdrawn
1 parent 4c918a1 commit 6993f97

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/containers/MyGigs/JobListing/index.jsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,37 @@ const JobListing = ({ jobs, loadMore, total, numLoaded, gigStatus }) => {
2828
useEffect(() => {
2929
setPage(1);
3030
}, [gigStatus]);
31-
3231
return (
3332
<div styleName="card-container">
34-
{jobs.map((job, index) => (
35-
<div styleName="card-item" key={`${job.title}-${index}`}>
36-
<JobCard job={job} />
37-
</div>
38-
))}
33+
{![
34+
constants.GIGS_FILTER_STATUSES.COMPLETED_JOBS,
35+
constants.GIGS_FILTER_STATUSES.ARCHIVED_JOBS,
36+
].includes(gigStatus) &&
37+
jobs.map((job, index) => (
38+
<div styleName="card-item" key={`${job.title}-${index}`}>
39+
<JobCard job={job} />
40+
</div>
41+
))}
42+
43+
{[
44+
constants.GIGS_FILTER_STATUSES.COMPLETED_JOBS,
45+
constants.GIGS_FILTER_STATUSES.ARCHIVED_JOBS,
46+
].includes(gigStatus) &&
47+
jobs
48+
.sort((a, b) => {
49+
if (a.sortPrio == b.sortPrio) {
50+
return (
51+
new Date(b.updatedAt).getTime() -
52+
new Date(a.updatedAt).getTime()
53+
);
54+
}
55+
return a.sortPrio - b.sortPrio;
56+
})
57+
.map((job, index) => (
58+
<div styleName="card-item" key={`${job.title}-${index}`}>
59+
<JobCard job={job} />
60+
</div>
61+
))}
3962

4063
{numLoaded < total && page * constants.PER_PAGE < total && (
4164
<div styleName="load-more">

0 commit comments

Comments
 (0)