Skip to content

Commit fdedd4d

Browse files
authored
feat: add good first module issues list (#201)
1 parent c81e6f5 commit fdedd4d

1 file changed

Lines changed: 158 additions & 2 deletions

File tree

src/pages/contribute.jsx

Lines changed: 158 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import { graphql, Link } from "gatsby";
3-
import { Row, Col } from "reactstrap";
3+
import {
4+
Row,
5+
Col,
6+
Card,
7+
CardBody,
8+
CardHeader,
9+
CardSubtitle,
10+
CardTitle,
11+
} from "reactstrap";
12+
import moment from "moment";
13+
import { IconContext } from "react-icons";
14+
import { FaGithub } from "react-icons/fa";
415
import PostListing from "../components/PostListing/PostListing";
516
import Section from "../components/Section";
617
import SEO from "../components/SEO/SEO";
718
import Layout from "../layout";
19+
import Tags from "../components/common/Tags";
820

921
function GettingStarted({ data }) {
1022
function toCardData(project, defaultCover) {
@@ -21,6 +33,31 @@ function GettingStarted({ data }) {
2133
toCardData(project, defaultCover)
2234
);
2335

36+
const moduleIssues = data.moduleIssues.nodes
37+
.filter((module) => module.issues.nodes.length !== 0)
38+
.flatMap((module) => {
39+
const { name, url: moduleUrl, issues } = module;
40+
return issues.nodes.map((issue) => {
41+
const { title, author, labels, updatedAt, url } = issue;
42+
const { login } = author;
43+
const { nodes } = labels;
44+
const tags = nodes.flatMap((node) => node.name);
45+
return {
46+
module: name,
47+
moduleUrl,
48+
title,
49+
author: login,
50+
tags,
51+
date: updatedAt,
52+
url,
53+
};
54+
});
55+
})
56+
.sort((a, b) =>
57+
new Date(a.date).getTime() <= new Date(b.date).getTime() ? 1 : 0
58+
);
59+
60+
const githubIconSize = useMemo(() => ({ size: "4em" }), []);
2461
return (
2562
<Layout title="Getting Contributors Started">
2663
<Row className="justify-content-center align-items-start">
@@ -234,6 +271,16 @@ function GettingStarted({ data }) {
234271
</a>
235272
</li>
236273
</ul>
274+
<p>
275+
Jump below to our{" "}
276+
<Link
277+
to="#good-first-module-land-issues"
278+
className="text-success"
279+
>
280+
<b>Good First Issues in Module Land</b>
281+
</Link>
282+
.
283+
</p>
237284
</Col>
238285
<Col md="5" className="text-justify">
239286
<p>
@@ -325,6 +372,93 @@ function GettingStarted({ data }) {
325372
<PostListing postList={ongoingProjects} />
326373
</Section>
327374
) : null}
375+
<Section tag="h4" title="Good First Module Land Issues">
376+
<Row className="justify-content-center align-items-start">
377+
<Col md="8" className="text-justify justify-content-center">
378+
<p>
379+
Find some of our module-land issues below. If you would like to
380+
work on one of them, start a draft PR for it. You can also view
381+
the full list on{" "}
382+
<a
383+
className="text-success font-weight-bold"
384+
href="https://github.com/search?q=org%3ATerasology+label%3A%22Good+First+Issue%22+state%3Aopen&type=Issues&ref=advsearch&l=&l="
385+
>
386+
GitHub
387+
</a>
388+
.
389+
</p>
390+
</Col>
391+
</Row>
392+
<Col lg="12" className="card-spacing">
393+
{moduleIssues
394+
.slice(0, 10)
395+
.map(({ module, moduleUrl, title, tags, author, url, date }) => (
396+
<Row className="justify-content-start align-items-start">
397+
<Card
398+
className="row_shadow h-100 md-12 my-3"
399+
style={{ width: "100%" }}
400+
>
401+
<a
402+
href={moduleUrl}
403+
className="btn-success"
404+
target="_blank"
405+
rel="noreferrer"
406+
>
407+
<CardHeader>{module}</CardHeader>
408+
</a>
409+
<a
410+
href={url}
411+
className="btn-light"
412+
target="_blank"
413+
rel="noreferrer"
414+
>
415+
<Row className="justify-content-start align-items-center">
416+
<Col
417+
md="1"
418+
className="ml-5 pt-0 pb-2 d-none d-md-block"
419+
>
420+
<div>
421+
<IconContext.Provider value={githubIconSize}>
422+
<FaGithub />
423+
</IconContext.Provider>
424+
</div>
425+
</Col>
426+
<Col md="10" className="pt-0 pb-2">
427+
<CardBody>
428+
{tags ? (
429+
<CardSubtitle tag="h7">
430+
<Tags tags={tags} />
431+
</CardSubtitle>
432+
) : (
433+
""
434+
)}
435+
<CardTitle tag="h5" className="mt-3">
436+
{title}
437+
</CardTitle>
438+
{author ? (
439+
<CardSubtitle className="text-muted">
440+
<b>Author:</b> {author}
441+
</CardSubtitle>
442+
) : (
443+
""
444+
)}
445+
{date ? (
446+
<CardSubtitle className="text-muted">
447+
<b>Last updated on: </b>
448+
{moment(date).format("MMMM DD, YYYY")}
449+
</CardSubtitle>
450+
) : (
451+
""
452+
)}
453+
</CardBody>
454+
</Col>
455+
</Row>
456+
</a>
457+
</Card>
458+
</Row>
459+
))}
460+
</Col>
461+
</Section>
328462
</Section>
329463
</Layout>
330464
);
@@ -349,6 +483,28 @@ export const pageQuery = graphql`
349483
}
350484
}
351485
}
486+
moduleIssues: allTerasologyModule {
487+
nodes {
488+
name
489+
url
490+
issues {
491+
nodes {
492+
id
493+
title
494+
author {
495+
login
496+
}
497+
labels {
498+
nodes {
499+
name
500+
}
501+
}
502+
updatedAt
503+
url
504+
}
505+
}
506+
}
507+
}
352508
projectCover: file(name: { eq: "defaultCardcover" }, ext: { eq: ".jpg" }) {
353509
childImageSharp {
354510
gatsbyImageData

0 commit comments

Comments
 (0)