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 | import { TabContext, TabPanel } from "@mui/lab"; import HtmlMeta from "components/HtmlMeta"; import NotificationBadge from "components/NotificationBadge"; import PageTitle from "components/PageTitle"; import TabBar from "components/TabBar"; import useNotifications from "features/useNotifications"; import { CONNECTIONS } from "i18n/namespaces"; import { useRouter } from "next/router"; import { useTranslation } from "next-i18next"; import React from "react"; import { connectionsRoute } from "routes"; import { FriendsTab } from "./friends"; function FriendsNotification() { const { data } = useNotifications(); const { t } = useTranslation([CONNECTIONS]); return ( <NotificationBadge count={data?.pendingFriendRequestCount}> {t("connections:friends")} </NotificationBadge> ); } const labels = { friends: <FriendsNotification />, }; type ConnectionType = keyof typeof labels; function ConnectionsPage({ type }: { type: "friends" }) { const router = useRouter(); const connectionType = type in labels ? (type as ConnectionType) : "friends"; const { t } = useTranslation([CONNECTIONS]); return ( <> <HtmlMeta title={t("connections:my_connections")} /> <PageTitle>{t("connections:my_connections")}</PageTitle> <TabContext value={connectionType}> <TabBar ariaLabel="Tabs for different connection types" setValue={(newType) => router.push( `${connectionsRoute}/${newType !== "friends" ? newType : ""}` ) } labels={labels} /> <TabPanel value="friends"> <FriendsTab /> </TabPanel> </TabContext> </> ); } export default ConnectionsPage; |