Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import { styled } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import CenteredSpinner from "components/CenteredSpinner/CenteredSpinner";
import HtmlMeta from "components/HtmlMeta";
import Markdown from "components/Markdown";
import PageTitle from "components/PageTitle";
import { tosQueryKey } from "features/queryKeys";
import { RpcError } from "grpc-web";
import { useTranslation } from "i18n";
import { GLOBAL } from "i18n/namespaces";
import { GetTermsOfServiceRes } from "proto/resources_pb";
import { service } from "service";
const StyledWrapper = styled("div")(({ theme }) => ({
maxWidth: theme.breakpoints.values.lg,
margin: "0 auto",
padding: theme.spacing(2),
}));
export default function TOS() {
const { t } = useTranslation(GLOBAL);
const { data, error, isLoading } = useQuery<
GetTermsOfServiceRes.AsObject,
RpcError
>({
queryKey: [tosQueryKey],
queryFn: () => service.resources.getTermsOfService(),
});
Iif (error) {
// Re-throw error to trigger error boundary to encourage user to report it
// if they can't see the terms
throw error;
}
return isLoading ? (
<CenteredSpinner />
) : data ? (
<StyledWrapper>
<HtmlMeta title={t("terms_of_service")} />
<PageTitle>{t("terms_of_service")}</PageTitle>
<Markdown source={data?.termsOfService} />
</StyledWrapper>
) : null;
}
|