adds help pages, changes homepage fully over to ttcmd
This commit is contained in:
31
app/help/[article]/error.tsx
Normal file
31
app/help/[article]/error.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
export default function Error({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="w-1/3 mx-auto mt-96">
|
||||
<div className="card error">
|
||||
<h1 className="text-4xl mb-8">Uh oh!</h1>
|
||||
<p>
|
||||
Seems like you found an article that doesn't exist. If you
|
||||
clicked on a link from another help article, it's likely that
|
||||
either the article has been renamed or hasn't been written yet.
|
||||
</p>
|
||||
<p>
|
||||
You can let Emma know about the missing article in
|
||||
[#help-articles](insert discord link here) on the official
|
||||
CyborgGrizzly Discord server. Be sure to include the below error and
|
||||
the page that you came from in case the link is broken.
|
||||
</p>
|
||||
<pre className="whitespace-pre-wrap rounded-md bg-black/20 p-4">
|
||||
{`${error.name}\n${error.message}\n${error.digest}`}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
26
app/help/[article]/page.tsx
Normal file
26
app/help/[article]/page.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { TTCMD } from "@/components/ttcmd";
|
||||
import { readFile } from "fs/promises";
|
||||
import Error from "next/error";
|
||||
import { Suspense } from "react";
|
||||
|
||||
export default async function Help({
|
||||
params,
|
||||
}: {
|
||||
params: { article: string };
|
||||
}) {
|
||||
const body = readFile(
|
||||
"./md/help articles/" + decodeURIComponent(params.article),
|
||||
"utf-8",
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<section className="heading">
|
||||
<h2 className="strapline">Help</h2>
|
||||
<h1>How to use TTCMD</h1>
|
||||
</section>
|
||||
<Suspense>
|
||||
<TTCMD body={body} />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
32
app/help/page.tsx
Normal file
32
app/help/page.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { QuestionMarkCircleIcon } from "@heroicons/react/24/solid";
|
||||
import { readdir } from "fs/promises";
|
||||
import Link from "next/link";
|
||||
|
||||
export default async function HelpHome() {
|
||||
const articles = await readdir("./md/help articles");
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="heading">
|
||||
<h2 className="strapline">Help</h2>
|
||||
<h1>Table of Contents</h1>
|
||||
</section>
|
||||
<section className="my-6">
|
||||
<ul className="grid md:grid-cols-5 gap-x-8 gap-y-6">
|
||||
{articles.map((a) => (
|
||||
<li key={a} className="card flex gap-4 items-center">
|
||||
<QuestionMarkCircleIcon className="w-8 h-8" />
|
||||
<Link
|
||||
className="font-bold text-xl hover:text-primary-300 transition-colors"
|
||||
href={"/help/" + encodeURI(a)}
|
||||
>
|
||||
{a.replace(".md", "")}
|
||||
→
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user