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 | 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 21x 24x 24x 24x 24x | import { Card, CardActions, Typography } from "@mui/material"; import Avatar from "components/Avatar"; import BarWithHelp from "components/Bar/BarWithHelp"; import Divider from "components/Divider"; import { CouchIcon, LocationIcon } from "components/Icons"; import IconText from "components/IconText"; import StrongVerificationBadge from "components/StrongVerificationBadge"; import { hostingStatusLabels, meetupStatusLabels, } from "features/profile/constants"; import { useTranslation } from "i18n"; import { GLOBAL, PROFILE } from "i18n/namespaces"; import { HostingStatus, MeetupStatus } from "proto/api_pb"; import React from "react"; import makeStyles from "utils/makeStyles"; import { useProfileUser } from "../hooks/useProfileUser"; import { Badges } from "./Badges"; import { ReferencesLastActiveLabels, ResponseRateLabel } from "./userLabels"; const useStyles = makeStyles((theme) => ({ card: { flexShrink: 0, borderRadius: theme.shape.borderRadius * 2, padding: theme.spacing(3), [theme.breakpoints.down("sm")]: { marginBottom: theme.spacing(1), width: "100%", }, }, info: { marginTop: theme.spacing(0.5), }, intro: { display: "flex", justifyContent: "center", wordBreak: "break-word", overflowWrap: "break-word", textAlign: "center", }, wrapper: { marginTop: theme.spacing(2), "& h1": { textAlign: "center", marginBottom: theme.spacing(0.5), }, }, cardActions: { flexDirection: "column", justifyContent: "center", alignItems: "stretch", padding: theme.spacing(0.5), "& > *": { margin: theme.spacing(0.5), }, "& > :not(:first-child)": { marginLeft: theme.spacing(0.5), }, }, avatarContainer: { maxWidth: "75%", margin: "0 auto", }, strongVerificationBadge: { display: "flex", alignItems: "center", marginLeft: theme.spacing(0.5), }, })); type UserOverviewProps = { showHostAndMeetAvailability: boolean; actions?: React.ReactNode; }; // @todo: move this into /components and decouple it from features/profile because it's used // from the dashboard as well export default function UserOverview({ showHostAndMeetAvailability, actions, }: UserOverviewProps) { const { t } = useTranslation([GLOBAL, PROFILE]); const classes = useStyles(); const user = useProfileUser(); return ( <Card className={classes.card}> <div className={classes.avatarContainer}> <Avatar user={user} grow /> </div> <div className={classes.wrapper}> <Typography variant="h1" className={classes.intro}> <span> {user.name} {user.hasStrongVerification ? <StrongVerificationBadge /> : null} </span> </Typography> <Typography variant="body1" className={classes.intro}> {user.city} </Typography> <Badges user={user} /> </div> <Divider /> {actions && ( <CardActions className={classes.cardActions}>{actions}</CardActions> )} {showHostAndMeetAvailability && ( <> <IconText icon={CouchIcon} text={ hostingStatusLabels(t)[ user.hostingStatus || HostingStatus.HOSTING_STATUS_UNKNOWN ] } /> <IconText icon={LocationIcon} text={ meetupStatusLabels(t)[ user.meetupStatus || MeetupStatus.MEETUP_STATUS_UNKNOWN ] } /> </> )} {Boolean(showHostAndMeetAvailability || actions) && ( <Divider spacing={3} /> )} {process.env.NEXT_PUBLIC_IS_VERIFICATION_ENABLED && ( <> <BarWithHelp value={user.communityStanding || 0} label={t("global:community_standing")} description={t("global:community_standing_description")} /> <BarWithHelp value={user.verification || 0} label={t("global:verification_score")} description={t("global:verification_score_description")} /> </> )} <div className={classes.info}> <ReferencesLastActiveLabels user={user} /> <ResponseRateLabel user={user} /> </div> </Card> ); } |