mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
42 lines
963 B
TypeScript
42 lines
963 B
TypeScript
import { useLoaderData } from "react-router";
|
|
import { Main } from "~/components/Main";
|
|
import { useTimeFormat } from "~/hooks/useTimeFormat";
|
|
import { databaseTimestampToDate } from "~/utils/dates";
|
|
|
|
import { loader } from "../loaders/suspended.server";
|
|
export { loader };
|
|
|
|
export default function SuspendedPage() {
|
|
const data = useLoaderData<typeof loader>();
|
|
const { formatDateTime } = useTimeFormat();
|
|
|
|
const ends = (() => {
|
|
if (!data.banned || data.banned === 1) return null;
|
|
|
|
return databaseTimestampToDate(data.banned);
|
|
})();
|
|
|
|
return (
|
|
<Main>
|
|
<h2>Account suspended</h2>
|
|
{data.reason ? <div>Reason: {data.reason}</div> : null}
|
|
{ends ? (
|
|
<div suppressHydrationWarning>
|
|
Ends:{" "}
|
|
{formatDateTime(ends, {
|
|
month: "long",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
hour: "numeric",
|
|
minute: "numeric",
|
|
})}
|
|
</div>
|
|
) : (
|
|
<div>
|
|
Ends: <i>no end time set</i>
|
|
</div>
|
|
)}
|
|
</Main>
|
|
);
|
|
}
|