65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { LoaderFunctionArgs, MetaFunction } from "react-router";
|
|
|
|
import PublicFooter from "~/components/public/PublicFooter";
|
|
import PublicHeader from "~/components/public/PublicHeader";
|
|
import { getTranslations } from "~/locale/i18next.server";
|
|
import { getLinkTags } from "~/utils/seo/linkTags.server";
|
|
|
|
type FaqItem = {
|
|
question: string;
|
|
answer: string;
|
|
};
|
|
|
|
type FaqSection = {
|
|
title: string;
|
|
items: FaqItem[];
|
|
};
|
|
|
|
export const meta: MetaFunction<typeof loader> = ({ data }) => data?.metatags || [];
|
|
|
|
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
const { t } = await getTranslations(request);
|
|
return {
|
|
metatags: [{ title: `${t("help.faq.metaTitle")} | ${process.env.APP_NAME}` }, ...getLinkTags(request)],
|
|
};
|
|
};
|
|
|
|
export default function HelpRoute() {
|
|
const { t } = useTranslation();
|
|
const sections = t("help.faq.sections", { returnObjects: true }) as FaqSection[];
|
|
|
|
return (
|
|
<div className="min-h-screen bg-white text-gray-950 dark:bg-gray-950 dark:text-white">
|
|
<PublicHeader />
|
|
<main className="mx-auto max-w-4xl px-4 py-10 sm:px-6 lg:px-8">
|
|
<div className="mb-8">
|
|
<h1 className="text-3xl font-bold tracking-normal sm:text-4xl">{t("help.faq.title")}</h1>
|
|
<p className="mt-3 max-w-2xl text-base leading-7 text-gray-600 dark:text-gray-300">{t("help.faq.subtitle")}</p>
|
|
</div>
|
|
|
|
<div className="space-y-8">
|
|
{sections.map((section, index) => (
|
|
<section key={section.title} aria-labelledby={`faq-section-${index}`}>
|
|
<h2 id={`faq-section-${index}`} className="mb-3 text-lg font-semibold">
|
|
{section.title}
|
|
</h2>
|
|
<div className="divide-y divide-gray-200 border-y border-gray-200 dark:divide-gray-800 dark:border-gray-800">
|
|
{section.items.map((item) => (
|
|
<details key={item.question} className="group py-4">
|
|
<summary className="cursor-pointer list-none text-base font-medium">
|
|
<span>{item.question}</span>
|
|
</summary>
|
|
<p className="mt-3 text-sm leading-6 text-gray-600 dark:text-gray-300">{item.answer}</p>
|
|
</details>
|
|
))}
|
|
</div>
|
|
</section>
|
|
))}
|
|
</div>
|
|
</main>
|
|
<PublicFooter />
|
|
</div>
|
|
);
|
|
}
|