Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link to Edit Profile - Following Tab #1662

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 0 additions & 121 deletions components/DesktopNav.tsx

This file was deleted.

13 changes: 3 additions & 10 deletions components/EditProfilePage/EditProfileHeader.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -28,15 +29,7 @@ export const EditProfileHeader = ({
Icon={GearIcon}
onClick={() => onSettingsModalOpen()}
/>
<FillButton
disabled={!!formUpdated}
href={`/profile?id=${uid}`}
label={
role === "organization" || role === "pendingUpgrade"
? t("viewOrgProfile")
: t("viewMyProfile")
}
/>
<ProfileEditToggle formUpdated={formUpdated} role={role} uid={uid} />
</Col>
</Row>
)
Expand Down
15 changes: 8 additions & 7 deletions components/EditProfilePage/EditProfilePage.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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()
Expand Down Expand Up @@ -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<false | true>(
isPublic ? isPublic : false
Expand Down Expand Up @@ -146,8 +147,8 @@ export function EditProfileForm({
/>
<TabContainer
defaultActiveKey="AboutYou"
activeKey={key}
onSelect={(k: any) => setKey(k)}
activeKey={tabStatus}
onSelect={(k: any) => setTabStatus(k)}
>
<TabNavWrapper>
{tabs.map((t, i) => (
Expand Down
17 changes: 10 additions & 7 deletions components/EditProfilePage/ProfileSettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ type Props = Pick<ModalProps, "show" | "onHide"> & {
role: Role
setIsProfilePublic: Dispatch<SetStateAction<false | true>>
notifications: Frequency
setNotifications: Dispatch<
SetStateAction<"Daily" | "Weekly" | "Monthly" | "None">
>
setNotifications: Dispatch<SetStateAction<"Weekly" | "Monthly" | "None">>
onSettingsModalClose: () => void
}

Expand Down Expand Up @@ -100,8 +98,16 @@ export default function ProfileSettingsModal({
aria-labelledby="notifications-modal"
centered
>
<Modal.Header closeButton>
<Modal.Header>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bootstrap's closeButton function was throwing an illegal error when the modal was invoked from the "View Profile" page

swapped it out for something that didn't throw errors

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to double check here - should the settings modal even be visible from the "View Profile" page? And if we're talking about the "Edit Profile" page, what was the error? Doesn't have to block this PR - but I suspect we'll run into this again with other modals down the line so I am curious.

<Modal.Title id="notifications-modal">{t("setting")}</Modal.Title>
<Image
src="/x_cancel.png"
alt={t("navigation.closeNavMenu")}
width="30"
height="30"
className="ms-2"
onClick={handleCancel}
/>
</Modal.Header>
<Modal.Body className={`p-3`}>
<Form>
Expand Down Expand Up @@ -140,9 +146,6 @@ export default function ProfileSettingsModal({
variant="outline-secondary"
/>
<Dropdown.Menu className={`col-12 bg-white `}>
<Dropdown.Item onClick={() => setNotifications("Daily")}>
{t("email.daily")}
</Dropdown.Item>
<Dropdown.Item onClick={() => setNotifications("Weekly")}>
{t("email.weekly")}
</Dropdown.Item>
Expand Down
Loading
Loading