diff --git a/src/app/api/activity/route.ts b/src/app/api/activity/route.ts index 3b9b9c7..8509bb7 100644 --- a/src/app/api/activity/route.ts +++ b/src/app/api/activity/route.ts @@ -4,7 +4,7 @@ * @author Naomi Carrigan */ import { NextResponse } from "next/server"; -import { getCodebergData } from "../../../lib/codeberg"; +import { getCodebergActivty } from "../../../lib/codeberg"; import { getGithubData } from "../../../lib/github"; /** @@ -13,7 +13,7 @@ import { getGithubData } from "../../../lib/github"; * @returns The formatted data. */ export async function GET(): Promise { - const codeberg = await getCodebergData(); + const codeberg = await getCodebergActivty(); const github = await getGithubData(); const normalised: Array<{ diff --git a/src/app/api/contribute/route.ts b/src/app/api/contribute/route.ts new file mode 100644 index 0000000..d27b298 --- /dev/null +++ b/src/app/api/contribute/route.ts @@ -0,0 +1,28 @@ +/** + * @copyright nhcarrigan + * @license Naomi's Public License + * @author Naomi Carrigan + */ +import { NextResponse } from "next/server"; +import { getCodebergIssues } from "../../../lib/codeberg"; + +/** + * GET route handler for the activity API. + * Loads recent activity from Codeberg and GitHub. + * @returns The formatted data. + */ +export async function GET(): Promise { + const issues = await getCodebergIssues(); + const normalised = issues.map((issue) => { + return { + body: issue.body, + labels: issue.labels.map((label) => { + return label.name; + }), + number: issue.number, + title: issue.title, + url: issue.html_url, + }; + }); + return NextResponse.json(normalised); +} diff --git a/src/app/contribute/page.tsx b/src/app/contribute/page.tsx new file mode 100644 index 0000000..f5e64fc --- /dev/null +++ b/src/app/contribute/page.tsx @@ -0,0 +1,75 @@ +/** + * @copyright nhcarrigan + * @license Naomi's Public License + * @author Naomi Carrigan + */ +"use client"; +import { type JSX, useEffect, useState } from "react"; +import { Issue } from "../../components/issue"; +import { Rule } from "../../components/rule"; + +/** + * Renders the /contribute page. + * @returns A React Component. + */ +const ContributeComponent = (): JSX.Element => { + const [ issues, setIssues ] = useState< + Array<{ + labels: Array; + number: number; + title: string; + url: string; + body: string; + }> + >([]); + + useEffect(() => { + void fetch("/api/contribute"). + then(async(data) => { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + return (await data.json()) as Array<{ + labels: Array; + number: number; + title: string; + url: string; + body: string; + }>; + }). + then((data) => { + setIssues(data); + }); + }, []); + + if (issues.length === 0) { + return ( +
+

{`Open for Contribution~!`}

+
+

{`Loading...`}

+
+
+ ); + } + + return ( +
+

{`Open for Contribution~!`}

+
+

{`Heya! This page lists issues across all of our projects that are currently open for contribution. + We'd love to have you work on one!`}

+ +
    + {issues.map((act) => { + return ( + + ); + })} +
+
+
+ ); +}; + +export default ContributeComponent; diff --git a/src/components/issue.tsx b/src/components/issue.tsx new file mode 100644 index 0000000..aeb79fb --- /dev/null +++ b/src/components/issue.tsx @@ -0,0 +1,70 @@ +/** + * @copyright nhcarrigan + * @license Naomi's Public License + * @author Naomi Carrigan + */ +import type { JSX } from "react"; + +interface IssueProperties { + labels: Array; + number: number; + title: string; + url: string; + body: string; +} + +/** + * Renders the view for a Codeberg issue. + * @param properties - The issue to render. + * @returns A JSX element. + */ +export const Issue = (properties: IssueProperties): JSX.Element => { + const { labels, number, title, url, body } = properties; + return ( +
+

{`#${number.toString()} ${title}`}

+ {labels.map((label) => { + return ( + + {label} + + ); + })} +

+ {body} +

+ + {`View Issue`} + + +
+ ); +}; diff --git a/src/config/Games.ts b/src/config/Games.ts index 9a7b9eb..89cd420 100644 --- a/src/config/Games.ts +++ b/src/config/Games.ts @@ -133,4 +133,28 @@ export const Games: Array<{ name: "V Rising", url: "https://store.steampowered.com/app/1604030/V_Rising/", }, + { + alt: "Digital illustration of a female character in a flowing teal dress standing on a hillside overlooking a fantasy landscape with distant buildings and fields.", + img: "aow-3.jpg", + name: "Age of Wonders 3", + url: "https://store.steampowered.com/app/226840/Age_of_Wonders_III/", + }, + { + alt: "Digital illustration of a character in a white and pink dress with bell sleeves and a crown, walking on a dirt path through a forested area with tall grass and flowers.", + img: "bannerlord.jpg", + name: "Mount & Blade II: Bannerlord", + url: "https://store.steampowered.com/app/261550/Mount__Blade_II_Bannerlord/", + }, + { + alt: "3D render of an anime-style character with pale skin and light hair, wearing a short purple dress with a textured pattern, standing against a plain gray background.", + img: "codevein.jpg", + name: "Code Vein", + url: "https://store.steampowered.com/app/678960/CODE_VEIN/", + }, + { + alt: "Digital artwork of a fantasy character with white hair in a long white dress holding a staff, standing against a backdrop of cloudy skies and distant ruins.", + img: "fallen-enchantress.jpg", + name: "Fallen Enchantress: Legendary Heroes", + url: "https://store.steampowered.com/app/228260/Fallen_Enchantress_Legendary_Heroes/", + }, ]; diff --git a/src/config/NavItems.ts b/src/config/NavItems.ts index fd56c81..2644089 100644 --- a/src/config/NavItems.ts +++ b/src/config/NavItems.ts @@ -24,6 +24,7 @@ export const NavItems = [ { href: "/ask", text: "Ask Me Anything!" }, { href: "/play", text: "Play with Naomi" }, { href: "/tech", text: "Technologies" }, + { href: "/contribute", text: "Contribute to our Projects" }, ].sort((a, b) => { return a.text.localeCompare(b.text); }); diff --git a/src/config/Play.ts b/src/config/Play.ts index 8e5b143..b2b175f 100644 --- a/src/config/Play.ts +++ b/src/config/Play.ts @@ -43,10 +43,14 @@ export const Play: Array<{ }, { android: "https://play.google.com/store/apps/details?id=com.yoozoo.jgame.us", - ios: "https://apps.apple.com/us/app/echocalypse-scarlet-covenant/id6446244975", - name: "Echocalypse: Scarlet Covenant", - server: "Aurora (3054310105)", - userId: "17754", + guild: { + id: "100021", + name: "NHC", + }, + ios: "https://apps.apple.com/us/app/echocalypse-scarlet-covenant/id6446244975", + name: "Echocalypse: Scarlet Covenant", + server: "Aurora (3054310105)", + userId: "17754", }, { android: "https://play.google.com/store/apps/details?id=jp.pokemon.pokemonsleep", diff --git a/src/lib/codeberg.ts b/src/lib/codeberg.ts index e56177f..ad82603 100644 --- a/src/lib/codeberg.ts +++ b/src/lib/codeberg.ts @@ -163,33 +163,118 @@ interface Comment { updated_at: string; } +interface Issue { + id: number; + url: string; + html_url: string; + number: number; + user: Owner; + original_author: string; + original_author_id: number; + title: string; + body: string; + ref: string; + assets: Array; + labels: Array