import { LoaderFunctionArgs, redirect, json, MetaFunction } from "@remix-run/node"; import i18n from "~/i18next.server"; import serverRequest, { getToken } from "~/lib/request.server"; import { User } from "~/lib/api/user"; import { useTranslation } from "react-i18next"; import { Link, useLoaderData } from "@remix-run/react"; import { Button } from "react-bootstrap"; export const meta: MetaFunction = ({ data }) => { return [{ title: `${data?.meta.title || "Welcome"} • pronouns.cc` }]; }; export const loader = async ({ request }: LoaderFunctionArgs) => { const t = await i18n.getFixedT(request); const token = getToken(request); let user: User; if (token) { try { user = await serverRequest("GET", "/users/@me", { token }); } catch (e) { return redirect("/auth/log-in"); } } else { return redirect("/auth/log-in"); } return json({ meta: { title: t("welcome.title") }, user }); }; export default function WelcomePage() { const { t } = useTranslation(); const { user } = useLoaderData(); return (

{t("welcome.header")}

{t("welcome.blurb")}

{t("welcome.customize-profile")}

{t("welcome.customize-profile-blurb")}

{t("welcome.create-members")}

{t("welcome.create-members-blurb")}

{t("welcome.custom-preferences")}

{t("welcome.custom-preferences-blurb")}

); }