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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 4x 74x 2x 35x 2x 4x 39x 39x 18x 35x 35x 35x 35x 35x | import { useFeatureValue } from "@growthbook/growthbook-react";
import { LocalPostOfficeOutlined, LockOutlined, SmartphoneOutlined, VerifiedUser } from "@mui/icons-material";
import { Box, GlobalStyles, keyframes, styled, Typography } from "@mui/material";
import Alert from "components/Alert";
import CenteredSpinner from "components/CenteredSpinner/CenteredSpinner";
import Divider from "components/Divider";
import HtmlMeta from "components/HtmlMeta";
import StyledLink from "components/StyledLink";
import useAccountInfo from "features/auth/useAccountInfo";
import { Trans, useTranslation } from "i18n";
import { AUTH } from "i18n/namespaces";
import { helpCenterStrongVerificationDataUrl } from "routes";
import PhoneVerificationSection from "./PhoneVerificationSection";
import PostalVerificationSection from "./PostalVerificationSection";
import StrongVerificationSection from "./StrongVerificationSection";
// Matches the nav bar's paper background. `html body` outranks CssBaseline's `body`
// rule whichever stylesheet is inserted first.
export const paperBackground = (
<GlobalStyles styles={{ "html body": { backgroundColor: "var(--mui-palette-background-paper)" } }} />
);
export const PageWidth = styled("div")(({ theme }) => ({
width: "100%",
maxWidth: 900,
marginInline: "auto",
paddingInline: theme.spacing(2),
boxSizing: "border-box",
}));
const float = keyframes({
"0%, 100%": { transform: "translateY(0) rotate(var(--tilt, 0deg))" },
"50%": { transform: "translateY(-8px) rotate(var(--tilt, 0deg))" },
});
const HeroArt = styled("div")(({ theme }) => ({
flex: "0 0 auto",
position: "relative",
width: 188,
height: 132,
// Decorative only, so it goes rather than squeezing the intro copy.
[theme.breakpoints.down("md")]: { display: "none" },
}));
const FloatingTile = styled("span")({
position: "absolute",
display: "grid",
placeItems: "center",
backgroundColor: "var(--mui-palette-background-paper)",
border: "1px solid var(--mui-palette-divider)",
animation: `${float} var(--float-duration) ease-in-out var(--float-delay, 0s) infinite`,
"@media (prefers-reduced-motion: reduce)": { animation: "none" },
});
function HeroTiles() {
return (
<HeroArt aria-hidden>
<FloatingTile
sx={{
"--tilt": "-8deg",
"--float-duration": "5.5s",
left: 0,
top: 24,
width: 66,
height: 66,
borderRadius: "18px",
"& .MuiSvgIcon-root": { fontSize: 30, color: "var(--mui-palette-primary-main)" },
}}
>
<VerifiedUser />
</FloatingTile>
<FloatingTile
sx={{
"--tilt": "7deg",
"--float-duration": "6.4s",
"--float-delay": "0.6s",
right: 6,
top: 0,
width: 62,
height: 62,
borderRadius: "18px",
"& .MuiSvgIcon-root": { fontSize: 28, color: "var(--mui-palette-secondary-main)" },
}}
>
<SmartphoneOutlined />
</FloatingTile>
<FloatingTile
sx={{
"--tilt": "-3deg",
"--float-duration": "7.2s",
"--float-delay": "1.1s",
left: 58,
bottom: 0,
width: 72,
height: 72,
borderRadius: "20px",
"& .MuiSvgIcon-root": { fontSize: 32, color: "var(--mui-palette-primary-dark)" },
}}
>
<LocalPostOfficeOutlined />
</FloatingTile>
</HeroArt>
);
}
export function DataUseSection() {
const { t } = useTranslation(AUTH);
return (
<Box
component="section"
sx={(theme) => ({
border: "1px solid var(--mui-palette-divider)",
borderRadius: "10px",
padding: theme.spacing(2.5),
display: "flex",
flexDirection: "column",
gap: 1.25,
})}
>
<Box sx={{ display: "flex", alignItems: "center", gap: 1.25 }}>
<LockOutlined sx={{ fontSize: 24, color: "var(--mui-palette-primary-main)" }} />
{/* footnote target for the "¹" in the verification descriptions */}
<Typography variant="h2">
<span aria-hidden="true">¹ </span>
{t("verification_page.data_use.header")}
</Typography>
</Box>
<Typography variant="body1" sx={{ textWrap: "pretty" }}>
<Trans
t={t}
i18nKey="verification_page.data_use.body"
components={{ helpCenterLink: <StyledLink href={helpCenterStrongVerificationDataUrl} target="_blank" /> }}
/>
</Typography>
</Box>
);
}
export default function VerificationPage() {
const { t } = useTranslation(AUTH);
const isPostalVerificationEnabled = useFeatureValue("postal_verification_enabled", false);
const { data: accountInfo, error: accountInfoError, isLoading: isAccountInfoLoading } = useAccountInfo();
return (
<>
<HtmlMeta title={t("verification_page.title")} />
{paperBackground}
<PageWidth
sx={(theme) => ({
paddingBlock: theme.spacing(3, 1),
display: "flex",
gap: 3,
alignItems: "center",
justifyContent: "space-between",
flexWrap: "wrap",
})}
>
<Box sx={{ flex: "1 1 340px", display: "flex", flexDirection: "column", gap: 1.5 }}>
<Typography variant="h1">{t("verification_page.title")}</Typography>
<Typography variant="body1" sx={{ color: "var(--mui-palette-text-secondary)", textWrap: "pretty" }}>
{t("verification_page.intro")}
</Typography>
</Box>
<HeroTiles />
</PageWidth>
<PageWidth
sx={(theme) => ({
paddingBlock: theme.spacing(3, 4),
display: "flex",
flexDirection: "column",
gap: 4,
})}
>
{isAccountInfoLoading ? (
<CenteredSpinner />
) : accountInfoError ? (
<Alert severity="error">{accountInfoError.message}</Alert>
) : accountInfo ? (
<>
<StrongVerificationSection hasStrongVerification={accountInfo.hasStrongVerification} />
<Divider spacing={0} />
<PhoneVerificationSection accountInfo={accountInfo} />
{isPostalVerificationEnabled && (
<>
<Divider spacing={0} />
<PostalVerificationSection hasDonated={accountInfo.hasDonated} />
</>
)}
</>
) : null}
<DataUseSection />
</PageWidth>
</>
);
}
|