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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 14x 7x 7x 7x 5x 7x 7x | import { TabContext, TabPanel } from "@mui/lab"; import { Box, Button, Card, Link, styled } from "@mui/material"; import HtmlMeta from "components/HtmlMeta"; import IconButton from "components/IconButton"; import { BackIcon, CouchIcon, PersonIcon } from "components/Icons"; import PageTitle from "components/PageTitle"; import TabBar from "components/TabBar"; import { useRouter } from "next/router"; import React from "react"; import { useTranslation } from "react-i18next"; import { EditUserTab, routeToEditProfile, routeToProfile, settingsRoute, } from "routes"; import { theme } from "theme"; import EditHostingPreference from "./EditHostingPreference"; import EditProfile from "./EditProfile"; const DetailsCard = styled(Card)(({ theme }) => ({ [theme.breakpoints.down("md")]: { margin: 0, width: "100%", }, flexGrow: 1, marginRight: 0, padding: 0, backgroundColor: "transparent", boxShadow: "none", border: "none", })); const Root = styled("div")(({ theme }) => ({ paddingTop: theme.spacing(3), [theme.breakpoints.up("md")]: { paddingTop: 0, display: "flex", }, })); const TabPanelStyled = styled(TabPanel)(({ theme }) => ({ padding: 0, })); const HeaderContainer = styled("div")(({ theme }) => ({ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: theme.spacing(3), })); const LeftHeader = styled("div")(({ theme }) => ({ display: "flex", alignItems: "center", gap: theme.spacing(2), })); const BackButton = styled(IconButton)(({ theme }) => ({ minWidth: "auto", padding: theme.spacing(1), borderRadius: "50%", color: theme.palette.text.secondary, "&:hover": { backgroundColor: theme.palette.action.hover, color: theme.palette.text.primary, }, })); export default function EditProfilePage({ tab = "about", }: { tab?: EditUserTab; }) { const { t } = useTranslation(); const router = useRouter(); return ( <> <HtmlMeta title={t("profile:heading.edit_profile")} /> <HeaderContainer> <LeftHeader> <BackButton onClick={() => router.push(routeToProfile())} aria-label={t("global:back")} > <BackIcon /> </BackButton> <PageTitle>{t("profile:heading.edit_profile")}</PageTitle> </LeftHeader> <Button component={Link} variant="contained" color="primary" href={settingsRoute} > {t("global:nav.account_settings")} </Button> </HeaderContainer> <Root> <DetailsCard> <TabContext value={tab}> <TabBar setValue={(newTab) => router.push(routeToEditProfile(newTab))} labels={{ about: ( <Box sx={{ display: "flex", alignItems: "center" }}> <PersonIcon sx={{ mr: 1, fontSize: 22 }} /> {t("profile:heading.about_me")} </Box> ), home: ( <Box sx={{ display: "flex", alignItems: "center" }}> <CouchIcon sx={{ mr: 1, fontSize: 22 }} /> {t("profile:heading.home")} </Box> ), }} ariaLabel={t("profile:edit_profile_tab_bar_a11y_label")} tabListSx={{ minHeight: 64, "& .MuiTabs-indicator": { display: "none", }, }} tabSx={{ fontSize: "1.125rem", fontWeight: 600, textTransform: "none", minHeight: 56, padding: theme.spacing(1.5, 3), borderRadius: theme.spacing(1.5, 1.5, 0, 0), transition: "all 0.2s ease-in-out", color: theme.palette.text.secondary, "&.Mui-selected": { color: theme.palette.primary.main, borderBottom: `3px solid ${theme.palette.primary.main}`, fontWeight: 700, }, "&:hover": { color: theme.palette.primary.main, }, [theme.breakpoints.down("md")]: { fontSize: "1rem", padding: theme.spacing(1, 2), minHeight: 48, }, }} /> <TabPanelStyled value="about"> <EditProfile /> </TabPanelStyled> <TabPanelStyled value="home"> <EditHostingPreference /> </TabPanelStyled> </TabContext> </DetailsCard> </Root> </> ); } |