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]}

-
- -