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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 1x | import Alert from "components/Alert"; import CenteredSpinner from "components/CenteredSpinner/CenteredSpinner"; import HtmlMeta from "components/HtmlMeta"; import { ProfileUserProvider } from "features/profile/hooks/useProfileUser"; import Overview from "features/profile/view/Overview"; import useCurrentUser from "features/userQueries/useCurrentUser"; import { useTranslation } from "i18n"; import { GLOBAL, PROFILE } from "i18n/namespaces"; import { useRouter } from "next/router"; import { routeToProfile, UserTab } from "routes"; import makeStyles from "utils/makeStyles"; import UserCard from "./UserCard"; export const useProfileStyles = makeStyles((theme) => ({ root: { padding: theme.spacing(1), [theme.breakpoints.up("sm")]: { display: "grid", gridTemplateColumns: "2fr 3fr", gap: theme.spacing(3), margin: theme.spacing(0, 3), padding: 0, paddingTop: theme.spacing(3), paddingBottom: theme.spacing(3), }, [theme.breakpoints.up("md")]: { gridTemplateColumns: "2fr 4fr", maxWidth: "61.5rem", margin: "0 auto", }, }, })); export default function ProfilePage({ tab = "about" }: { tab?: UserTab }) { const { t } = useTranslation([GLOBAL, PROFILE]); const classes = useProfileStyles(); const router = useRouter(); const { data: user, error, isLoading } = useCurrentUser(); return ( <> <HtmlMeta title={t("global:nav.profile")} /> {error && <Alert severity="error">{error}</Alert>} {isLoading ? ( <CenteredSpinner /> ) : user ? ( <ProfileUserProvider user={user}> <div className={classes.root}> <Overview setIsRequesting={() => { /* TODO: not needed here*/ }} tab={tab} /> <UserCard tab={tab} onTabChange={(newTab) => { router.push(routeToProfile(newTab)); }} /> </div> </ProfileUserProvider> ) : null} </> ); } |