From d3f795608c25e9e5bdf46a23f7efcd7350e572b7 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Thu, 23 Jan 2025 00:19:43 -0800 Subject: [PATCH] feat: cleanup --- src/app/api/activity/route.ts | 50 -- src/app/api/contribute/route.ts | 28 - src/app/appeal/page.tsx | 48 -- src/app/apply/page.tsx | 48 -- src/app/ask/page.tsx | 214 -------- src/app/contact/page.tsx | 108 ---- src/app/contribute/page.tsx | 86 --- src/app/newsletter/page.tsx | 48 -- src/app/polycule/page.tsx | 42 -- src/app/sales/page.tsx | 48 -- src/app/team/page.tsx | 42 -- src/app/work/page.tsx | 2 +- src/components/activity.tsx | 80 --- src/components/issue.tsx | 70 --- src/components/member.tsx | 60 --- src/components/partner.tsx | 59 --- src/components/social.tsx | 45 -- src/config/Art.ts | 7 + src/config/NavItems.ts | 13 +- src/config/Partners.ts | 40 -- src/config/Socials.ts | 536 ------------------- src/config/TeamMembers.ts | 45 -- src/icons/Codeberg.ts | 73 --- src/icons/Coursera.ts | 126 ----- src/icons/Fiverr.ts | 63 --- src/icons/Gather.ts | 83 --- src/icons/Gog.ts | 22 - src/icons/Gumroad.ts | 212 -------- src/icons/KoFi.ts | 77 --- src/icons/Matrix.ts | 70 --- src/icons/Peerlist.ts | 136 ----- src/icons/Pixiv.ts | 104 ---- src/icons/Polywork.ts | 85 --- src/icons/RetroAchievements.ts | 116 ---- src/icons/Saylor.ts | 70 --- src/icons/TeeSpring.ts | 74 --- src/icons/Throne.ts | 93 ---- src/icons/Topmate.ts | 52 -- src/icons/TreeNation.ts | 148 ------ src/icons/Udemy.ts | 155 ------ src/icons/VRoid.ts | 355 ------------- src/lib/codeberg.ts | 300 ----------- src/lib/github.ts | 733 -------------------------- test/app/api/activity/route.spec.ts | 100 ---- test/app/api/contribute/route.spec.ts | 55 -- test/config/Partners.spec.ts | 29 - test/config/Socials.spec.ts | 117 ---- test/config/TeamMembers.spec.ts | 36 -- test/icons/Codeberg.spec.ts | 38 -- test/icons/Coursera.spec.ts | 38 -- test/icons/Fiverr.spec.ts | 38 -- test/icons/Gather.spec.ts | 38 -- test/icons/Gog.spec.ts | 38 -- test/icons/Gumroad.spec.ts | 38 -- test/icons/Kofi.spec.ts | 38 -- test/icons/Matrix.spec.ts | 38 -- test/icons/Peerlist.spec.ts | 38 -- test/icons/Pixiv.spec.ts | 38 -- test/icons/Polywork.spec.ts | 38 -- test/icons/RetroAchievements.spec.ts | 39 -- test/icons/Saylor.spec.ts | 38 -- test/icons/TeeSpring.spec.ts | 38 -- test/icons/Throne.spec.ts | 38 -- test/icons/Topmate.spec.ts | 38 -- test/icons/TreeNation.spec.ts | 38 -- test/icons/Udemy.spec.ts | 38 -- test/icons/VRoid.spec.ts | 38 -- test/lib/codeberg.spec.ts | 437 --------------- test/lib/github.spec.ts | 343 ------------ 69 files changed, 11 insertions(+), 6695 deletions(-) delete mode 100644 src/app/api/activity/route.ts delete mode 100644 src/app/api/contribute/route.ts delete mode 100644 src/app/appeal/page.tsx delete mode 100644 src/app/apply/page.tsx delete mode 100644 src/app/ask/page.tsx delete mode 100644 src/app/contact/page.tsx delete mode 100644 src/app/contribute/page.tsx delete mode 100644 src/app/newsletter/page.tsx delete mode 100644 src/app/polycule/page.tsx delete mode 100644 src/app/sales/page.tsx delete mode 100644 src/app/team/page.tsx delete mode 100644 src/components/activity.tsx delete mode 100644 src/components/issue.tsx delete mode 100644 src/components/member.tsx delete mode 100644 src/components/partner.tsx delete mode 100644 src/components/social.tsx delete mode 100644 src/config/Partners.ts delete mode 100644 src/config/Socials.ts delete mode 100644 src/config/TeamMembers.ts delete mode 100644 src/icons/Codeberg.ts delete mode 100644 src/icons/Coursera.ts delete mode 100644 src/icons/Fiverr.ts delete mode 100644 src/icons/Gather.ts delete mode 100644 src/icons/Gog.ts delete mode 100644 src/icons/Gumroad.ts delete mode 100644 src/icons/KoFi.ts delete mode 100644 src/icons/Matrix.ts delete mode 100644 src/icons/Peerlist.ts delete mode 100644 src/icons/Pixiv.ts delete mode 100644 src/icons/Polywork.ts delete mode 100644 src/icons/RetroAchievements.ts delete mode 100644 src/icons/Saylor.ts delete mode 100644 src/icons/TeeSpring.ts delete mode 100644 src/icons/Throne.ts delete mode 100644 src/icons/Topmate.ts delete mode 100644 src/icons/TreeNation.ts delete mode 100644 src/icons/Udemy.ts delete mode 100644 src/icons/VRoid.ts delete mode 100644 src/lib/codeberg.ts delete mode 100644 src/lib/github.ts delete mode 100644 test/app/api/activity/route.spec.ts delete mode 100644 test/app/api/contribute/route.spec.ts delete mode 100644 test/config/Partners.spec.ts delete mode 100644 test/config/Socials.spec.ts delete mode 100644 test/config/TeamMembers.spec.ts delete mode 100644 test/icons/Codeberg.spec.ts delete mode 100644 test/icons/Coursera.spec.ts delete mode 100644 test/icons/Fiverr.spec.ts delete mode 100644 test/icons/Gather.spec.ts delete mode 100644 test/icons/Gog.spec.ts delete mode 100644 test/icons/Gumroad.spec.ts delete mode 100644 test/icons/Kofi.spec.ts delete mode 100644 test/icons/Matrix.spec.ts delete mode 100644 test/icons/Peerlist.spec.ts delete mode 100644 test/icons/Pixiv.spec.ts delete mode 100644 test/icons/Polywork.spec.ts delete mode 100644 test/icons/RetroAchievements.spec.ts delete mode 100644 test/icons/Saylor.spec.ts delete mode 100644 test/icons/TeeSpring.spec.ts delete mode 100644 test/icons/Throne.spec.ts delete mode 100644 test/icons/Topmate.spec.ts delete mode 100644 test/icons/TreeNation.spec.ts delete mode 100644 test/icons/Udemy.spec.ts delete mode 100644 test/icons/VRoid.spec.ts delete mode 100644 test/lib/codeberg.spec.ts delete mode 100644 test/lib/github.spec.ts diff --git a/src/app/api/activity/route.ts b/src/app/api/activity/route.ts deleted file mode 100644 index 8509bb7..0000000 --- a/src/app/api/activity/route.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @copyright nhcarrigan - * @license Naomi's Public License - * @author Naomi Carrigan - */ -import { NextResponse } from "next/server"; -import { getCodebergActivty } from "../../../lib/codeberg"; -import { getGithubData } from "../../../lib/github"; - -/** - * GET route handler for the activity API. - * Loads recent activity from Codeberg and GitHub. - * @returns The formatted data. - */ -export async function GET(): Promise { - const codeberg = await getCodebergActivty(); - const github = await getGithubData(); - - const normalised: Array<{ - type: string; - date: Date; - repo: string; - repoName: string; - }> = [ - ...codeberg.map((index) => { - return { - date: new Date(index.created), - repo: index.repo.html_url, - repoName: index.repo.full_name, - type: index.op_type, - }; - }), - ...github.map((index) => { - return { - date: new Date(index.created_at), - repo: index.repo.url.replace("api.github.com/repos", "github.com"), - repoName: index.repo.name, - type: index.type, - }; - }), - ]; - - return NextResponse.json( - normalised. - toSorted((a, b) => { - return new Date(b.date).getTime() - new Date(a.date).getTime(); - }). - slice(0, 100), - ); -} diff --git a/src/app/api/contribute/route.ts b/src/app/api/contribute/route.ts deleted file mode 100644 index d27b298..0000000 --- a/src/app/api/contribute/route.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @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/appeal/page.tsx b/src/app/appeal/page.tsx deleted file mode 100644 index 98b3106..0000000 --- a/src/app/appeal/page.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @copyright nhcarrigan - * @license Naomi's Public License - * @author Naomi Carrigan - */ -"use client"; -import Script from "next/script"; -import type { JSX } from "react"; - -/** - * Renders the /polycule page. - * @returns A React Component. - */ -const Sales = (): JSX.Element => { - return ( - <> -
-

{`Appeal a Sanction`}

-

{`This form allows you to appeal a moderation action taken against you on one of our platforms.`}

-
- - - - - ); -}; - -export default Sales; diff --git a/src/app/apply/page.tsx b/src/app/apply/page.tsx deleted file mode 100644 index e77cf75..0000000 --- a/src/app/apply/page.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @copyright nhcarrigan - * @license Naomi's Public License - * @author Naomi Carrigan - */ -"use client"; -import Script from "next/script"; -import type { JSX } from "react"; - -/** - * Renders the /apply page. - * @returns A React Component. - */ -const Apply = (): JSX.Element => { - return ( - <> -
-

{`Staff Application`}

-

{`This form allows you to apply to join NHCarrigan's volunteer staff team.`}

-
- - - - - ); -}; - -export default Apply; diff --git a/src/app/ask/page.tsx b/src/app/ask/page.tsx deleted file mode 100644 index 02d8371..0000000 --- a/src/app/ask/page.tsx +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @copyright nhcarrigan - * @license Naomi's Public License - * @author Naomi Carrigan - */ -"use client"; -import { useEffect, useState, type ChangeEvent, type JSX } from "react"; -import { Rule } from "../../components/rule"; - -type Category = "question" | "compliment" | "confess" | "never"; - -const ColourMap: Record - = { - compliment: { - background: "#a6f1c6", - foreground: "#0f9d58", - }, - confess: { - background: "#f7c6d2", - foreground: "#b03060", - }, - never: { - background: "#f7e6c6", - foreground: "#b8860b", - }, - question: { - background: "#a6e6fc", - foreground: "#03779e", - }, - }; - -const TitleMap: Record = { - compliment: "Pay Naomi a Compliment", - confess: "Confess Your Sins to Naomi", - never: "Never Have I Ever?", - question: "Ask Naomi a Question", -}; - -const DescriptionMap: Record = { - compliment: - // eslint-disable-next-line stylistic/max-len - "Have you wanted to tell Naomi she's cute, but you've been too shy? Here's your chance!", - confess: - // eslint-disable-next-line stylistic/max-len - "Is there something weighing on your mind that you can't tell anyone else? Confess it here!", - never: - // eslint-disable-next-line stylistic/max-len - "What do you think Naomi has done that you haven't? Let's play a game of Never Have I Ever!", - question: "Do you have a question for Naomi? Ask it here!", -}; - -interface DataRecord { - category: Category; - question: string; - answer: string; -} - -/** - * Renders the /ask page. - * @returns A React Component. - */ -const Ask = (): JSX.Element => { - const [ category, setCategory ] = useState("question"); - const [ question, setQuestion ] = useState(""); - const [ submitted, setSubmitted ] = useState(false); - const [ errored, setErrored ] = useState(false); - const [ history, setHistory ] = useState>([]); - - useEffect(() => { - fetch("https://anon.nhcarrigan.com/recent").then(async(response) => { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - const result = await response.json() as Array; - setHistory(result); - }). - catch((error: unknown) => { - // eslint-disable-next-line no-console - console.error(error); - setHistory([]); - }); - }, []); - - const handleCategoryChange = ( - event: ChangeEvent, - ): void => { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - setCategory(event.target.value as Category); - }; - - const handleQuestionUpdate = ( - event: ChangeEvent, - ): void => { - setQuestion(event.target.value); - }; - - const submitForm = (): void => { - fetch("https://anon.nhcarrigan.com/api", { - body: JSON.stringify({ - category, - question, - }), - headers: { - "Content-Type": "application/json", - }, - method: "POST", - }). - then((response) => { - if (response.ok) { - setSubmitted(true); - } else { - setErrored(true); - } - }). - catch(() => { - setErrored(true); - }); - }; - return ( -
-

{`Ask Me Anything!`}

-

- {`This page allows you to anonymously ask any question you might wish! Once approved and answered, your question and our response will be visible in our `} - {`Discord`} - {`!`} -

- - {!submitted && !errored - &&
-

{TitleMap[category]}

-

{DescriptionMap[category]}

-
- -