diff --git a/components/DesktopNav.tsx b/components/DesktopNav.tsx deleted file mode 100644 index b2b69f6ee..000000000 --- a/components/DesktopNav.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import { useFlags } from "components/featureFlags" -import { useTranslation } from "next-i18next" -import React from "react" -import { SignInWithButton, signOutAndRedirectToHome, useAuth } from "./auth" -import { Container, Dropdown, Nav, NavDropdown } from "./bootstrap" - -import { - Avatar, - NavbarLinkAI, - NavbarLinkBills, - NavbarLinkEditProfile, - NavbarLinkEffective, - NavbarLinkFAQ, - NavbarLinkGoals, - NavbarLinkLogo, - NavbarLinkNewsfeed, - NavbarLinkProcess, - NavbarLinkSignOut, - NavbarLinkSupport, - NavbarLinkTeam, - NavbarLinkTestimony, - NavbarLinkViewProfile, - NavbarLinkWhyUse -} from "./NavbarComponents" - -export const DesktopNav: React.FC> = () => { - const { authenticated } = useAuth() - const { notifications } = useFlags() - const { t } = useTranslation(["common", "auth"]) - - return ( - - - -
- -
- -
- -
- -
- -
- - {authenticated && notifications ? ( -
- -
- ) : ( - <> - )} - -
- - - {t("about")} - - - - - - - - - -
- -
- - - {t("learn")} - - - - - - - -
- - {authenticated ? ( -
- - - - - - - - - - - - - { - void signOutAndRedirectToHome() - }} - /> - - - -
- ) : ( -
- -
- )} -
- ) -} diff --git a/components/EditProfilePage/EditProfileHeader.tsx b/components/EditProfilePage/EditProfileHeader.tsx index 08dbf9f01..b5c02f5b7 100644 --- a/components/EditProfilePage/EditProfileHeader.tsx +++ b/components/EditProfilePage/EditProfileHeader.tsx @@ -1,7 +1,8 @@ import { useTranslation } from "next-i18next" import { Role } from "../auth" import { Col, Row } from "../bootstrap" -import { FillButton, GearIcon, OutlineButton } from "../buttons" +import { GearIcon, OutlineButton } from "../buttons" +import { ProfileEditToggle } from "components/ProfilePage/ProfileButtons" export const EditProfileHeader = ({ formUpdated, @@ -28,15 +29,7 @@ export const EditProfileHeader = ({ Icon={GearIcon} onClick={() => onSettingsModalOpen()} /> - + ) diff --git a/components/EditProfilePage/EditProfilePage.tsx b/components/EditProfilePage/EditProfilePage.tsx index d0ed0a249..de6b02c57 100644 --- a/components/EditProfilePage/EditProfilePage.tsx +++ b/components/EditProfilePage/EditProfilePage.tsx @@ -1,7 +1,5 @@ -import { useFlags } from "components/featureFlags" -import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" import { useTranslation } from "next-i18next" -import { useState } from "react" +import { useContext, useState } from "react" import { TabPane } from "react-bootstrap" import TabContainer from "react-bootstrap/TabContainer" import { useAuth } from "../auth" @@ -25,6 +23,9 @@ import { TabNavWrapper } from "./StyledEditProfileComponents" import { TestimoniesTab } from "./TestimoniesTab" +import { useFlags } from "components/featureFlags" +import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" +import { TabContext } from "components/shared/ProfileTabsContext" export function EditProfile() { const { user } = useAuth() @@ -62,11 +63,11 @@ export function EditProfileForm({ notificationFrequency: notificationFrequency }: Profile = profile - const [key, setKey] = useState("AboutYou") + const { tabStatus, setTabStatus } = useContext(TabContext) const [formUpdated, setFormUpdated] = useState(false) const [settingsModal, setSettingsModal] = useState<"show" | null>(null) const [notifications, setNotifications] = useState< - "Daily" | "Weekly" | "Monthly" | "None" + "Weekly" | "Monthly" | "None" >(notificationFrequency ? notificationFrequency : "Monthly") const [isProfilePublic, setIsProfilePublic] = useState( isPublic ? isPublic : false @@ -146,8 +147,8 @@ export function EditProfileForm({ /> setKey(k)} + activeKey={tabStatus} + onSelect={(k: any) => setTabStatus(k)} > {tabs.map((t, i) => ( diff --git a/components/EditProfilePage/ProfileSettingsModal.tsx b/components/EditProfilePage/ProfileSettingsModal.tsx index 8121156dc..f721ec08f 100644 --- a/components/EditProfilePage/ProfileSettingsModal.tsx +++ b/components/EditProfilePage/ProfileSettingsModal.tsx @@ -15,9 +15,7 @@ type Props = Pick & { role: Role setIsProfilePublic: Dispatch> notifications: Frequency - setNotifications: Dispatch< - SetStateAction<"Daily" | "Weekly" | "Monthly" | "None"> - > + setNotifications: Dispatch> onSettingsModalClose: () => void } @@ -100,8 +98,16 @@ export default function ProfileSettingsModal({ aria-labelledby="notifications-modal" centered > - + {t("setting")} + {t("navigation.closeNavMenu")}
@@ -140,9 +146,6 @@ export default function ProfileSettingsModal({ variant="outline-secondary" /> - setNotifications("Daily")}> - {t("email.daily")} - setNotifications("Weekly")}> {t("email.weekly")} diff --git a/components/MobileNav.tsx b/components/Navbar.tsx similarity index 51% rename from components/MobileNav.tsx rename to components/Navbar.tsx index cb3432366..99372dad1 100644 --- a/components/MobileNav.tsx +++ b/components/Navbar.tsx @@ -1,10 +1,12 @@ -import { useFlags } from "components/featureFlags" import { useTranslation } from "next-i18next" -import React, { useState } from "react" +import React, { useContext, useState } from "react" import Image from "react-bootstrap/Image" import styled from "styled-components" +import { useMediaQuery } from "usehooks-ts" import { SignInWithButton, signOutAndRedirectToHome, useAuth } from "./auth" -import { Col, Nav, Navbar, NavDropdown } from "./bootstrap" +import { Col, Container, Dropdown, Nav, Navbar, NavDropdown } from "./bootstrap" +import { TabContext } from "./shared/ProfileTabsContext" + import { Avatar, NavbarLinkAI, @@ -24,7 +26,13 @@ import { NavbarLinkWhyUse } from "./NavbarComponents" -export const MobileNav: React.FC> = () => { +export const MainNavbar: React.FC> = () => { + const isMobile = useMediaQuery("(max-width: 768px)") + + return <>{isMobile ? : } +} + +const MobileNav: React.FC> = () => { const BlackCollapse = styled(() => { return ( @@ -42,14 +50,25 @@ export const MobileNav: React.FC> = () => { } ` + const { tabStatus, setTabStatus } = useContext(TabContext) + const ProfileLinks = () => { return (