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 | import { Favorite, Language, Star } from "@mui/icons-material";
import { Box, Divider, Skeleton, Typography, useMediaQuery } from "@mui/material";
import { useTranslation } from "i18n";
import { localizeRelativeTime } from "i18n/datetimes";
import { GLOBAL, LANDING } from "i18n/namespaces";
import { Temporal } from "temporal-polyfill";
import { theme } from "theme";
import useSignupPageInfo from "utils/useSignupPageInfo";
const SocialProof = () => {
const {
t,
i18n: { language: locale },
} = useTranslation([GLOBAL, LANDING]);
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
const { signupInfo, isLoading } = useSignupPageInfo();
return (
<Box
sx={{
maxWidth: "lg",
padding: theme.spacing(8, 4),
textAlign: "center",
}}
>
<Typography
sx={{
fontSize: "4rem",
fontWeight: "bold",
[theme.breakpoints.down("md")]: {
fontSize: "2rem",
},
}}
>
{t("landing:what_couchsurfing_title")}
</Typography>
<Typography
sx={{
marginTop: 2,
fontSize: "1.2rem",
padding: isMobile ? undefined : theme.spacing(0, 20),
marginBottom: "16px",
}}
>
{t("landing:what_couchsurfing_description")}
</Typography>
<Divider
sx={{
backgroundColor: "var(--mui-palette-divider)",
marginTop: 4,
}}
/>
<Box
sx={{
display: "flex",
flexDirection: isMobile ? "column" : "row",
alignItems: "center",
justifyContent: "center",
gap: 3,
marginTop: 4,
width: "100%",
}}
>
<Box
sx={{
display: "flex",
alignItems: "center",
}}
>
<Favorite
sx={{
marginRight: 1,
fontSize: "30px",
color: theme.palette.primary.main,
}}
/>
{isLoading ? (
<Box sx={{ width: 120 }}>
<Typography sx={{ fontSize: "1.5rem", fontWeight: 500 }}>
<Box component="span" sx={{ display: "inline-block", width: "100%" }}>
<Skeleton variant="text" width="100%" height={36} />
</Box>
</Typography>
</Box>
) : (
<Typography sx={{ fontSize: "1.5rem", fontWeight: 500 }}>
{t("landing:num_users2", {
// Number(...) returns NaN on bad input, and || treats it as false
count: Number(signupInfo?.userCount) || 56000,
})}
</Typography>
)}
</Box>
<Box
sx={{
display: "flex",
alignItems: "center",
}}
>
<Language
sx={{
marginRight: 1,
fontSize: "30px",
color: theme.palette.primary.main,
}}
/>
<Typography sx={{ fontSize: "1.5rem", fontWeight: 500 }}>
{t("landing:num_countries2", { count: 180 })}
</Typography>
</Box>
<Box
sx={{
display: "flex",
alignItems: isMobile ? "flex-start" : "center",
}}
>
<Star
sx={{
marginRight: 1,
fontSize: "30px",
color: theme.palette.primary.main,
}}
/>
{isLoading ? (
<Box sx={{ width: 220 }}>
<Typography sx={{ fontSize: "1.5rem", fontWeight: 500 }}>
<Box component="span" sx={{ display: "inline-block", width: "100%" }}>
<Skeleton variant="text" width="100%" height={36} />
</Box>
</Typography>
</Box>
) : (
signupInfo &&
signupInfo.lastSignup && (
<Typography
sx={{
fontSize: "1.5rem",
fontWeight: 500,
}}
>
{t("landing:last_signup", {
timeAgo: localizeRelativeTime(Temporal.Instant.from(signupInfo.lastSignup), locale),
})}
</Typography>
)
)}
</Box>
</Box>
</Box>
);
};
export default SocialProof;
|