on master help sign in
grants: let people apply
e757bd9Matilde Park
pages/grants/[slug].js+12−4
@@ -26,6 +26,8 @@ export default function Grant({ post, markdown, search, similarGrants }) {
26 if (!router.isFallback && !post?.slug) {
26 if (!router.isFallback && !post?.slug) {
27 return <ErrorPage />;
27 return <ErrorPage />;
28 }
28 }
29+ const isOpen = !post?.extra?.completed && post?.extra?.assignee === "";
30+ const canApply = isOpen && post?.extra?.work_request_link;
29
31
30 return (
32 return (
31 <Container>
33 <Container>
@@ -66,11 +68,17 @@ export default function Grant({ post, markdown, search, similarGrants }) {
66 </div>
68 </div>
67 </Section>
69 </Section>
68 <Section narrow className={markdownStyles["markdown"]}>
70 <Section narrow className={markdownStyles["markdown"]}>
69− <article
70− dangerouslySetInnerHTML={{ __html: decode(markdown) }}
71+ <article dangerouslySetInnerHTML={{ __html: decode(markdown) }} />
71− ></article>
72 </Section>
72 </Section>
73−
73+ {canApply && (
74+ <a
75+ className="bg-green text-white badge-sm"
76+ href={post?.extra?.work_request_link}
77+ target="_blank"
78+ >
79+ Apply for this grant
80+ </a>
81+ )}
74 <Section narrow className="flex flex-col">
82 <Section narrow className="flex flex-col">
75 <h3 className="pb-8">Similar Grants</h3>
83 <h3 className="pb-8">Similar Grants</h3>
76 {similarGrants.map((grant) => {
84 {similarGrants.map((grant) => {