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
11 changes: 11 additions & 0 deletions src/components/Job.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import jobToMarkdown from "../jobToMarkdown.js";
const Job = ({ job }) => {
const processedJob = React.useMemo(() => jobToMarkdown(job), [job]);

const isExpired = React.useMemo(() => {
if (!processedJob || !processedJob.expires) return false;
const today = new Date();
return new Date(`${processedJob.expires}T23:59:59.999-12:00`) < today;
}, [processedJob]);

if (processedJob === undefined) {
console.log("We don't expect an empty job posting; aborting");
return <div>Empty job posting</div>;
Expand Down Expand Up @@ -51,6 +57,11 @@ const Job = ({ job }) => {
</div>
}
</div>
{isExpired && (
<div className="expired-banner">
This job post has expired and is no longer open for applications.
</div>
)}
<div
className="description"
dangerouslySetInnerHTML={{__html: processedJob.description}}
Expand Down
13 changes: 11 additions & 2 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ li {
a {
color: #2c3e50;
font-weight: bold;
text-decoration: none;
}
.page {
}
Expand Down Expand Up @@ -114,8 +113,18 @@ a {
bottom: 1rem;
right: 1rem;
}
.expired-banner {
background-color: #f8d7da;
color: #721c24;
padding: 0.5rem;
margin-bottom: 0.75rem;
margin-top: 1rem;
border-radius: 4px;
text-align: center;
font-weight: bold;
font-size: 0.9rem;
}
.job a {
text-decoration: none;
}
.job .meta a {
font-weight: normal;
Expand Down