Skip to content

Commit

Permalink
chore(web): update-contact-support-link
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich committed Nov 4, 2024
1 parent 0fcef50 commit d71993d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
14 changes: 12 additions & 2 deletions web/src/layout/Header/DesktopHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useCallback, useEffect, useState } from "react";
import styled, { css } from "styled-components";
import { landscapeStyle } from "styles/landscapeStyle";
import { useToggle } from "react-use";
Expand Down Expand Up @@ -89,8 +89,18 @@ const DesktopHeader = () => {
const [isDappListOpen, toggleIsDappListOpen] = useToggle(false);
const [isHelpOpen, toggleIsHelpOpen] = useToggle(false);
const [isSettingsOpen, toggleIsSettingsOpen] = useToggle(false);
const [initialTab, setInitialTab] = useState<number>(0);
const { isConnected, chain } = useAccount();
const isDefaultChain = chain?.id === DEFAULT_CHAIN;

const initializeFragmentURL = useCallback(() => {
const hasNotificationsPath = location.hash.includes("#notifications");
toggleIsSettingsOpen(hasNotificationsPath);
setInitialTab(hasNotificationsPath ? 1 : 0);
}, [toggleIsSettingsOpen, location.hash]);

useEffect(initializeFragmentURL, [initializeFragmentURL]);

useLockOverlayScroll(isDappListOpen || isHelpOpen || isSettingsOpen);

return (
Expand Down Expand Up @@ -129,7 +139,7 @@ const DesktopHeader = () => {
<PopupContainer>
{isDappListOpen && <DappList {...{ toggleIsDappListOpen, isDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen, isHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen, isSettingsOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen, isSettingsOpen, initialTab }} />}
</PopupContainer>
)}
</>
Expand Down
4 changes: 2 additions & 2 deletions web/src/layout/Header/navbar/Menu/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const TABS = [
},
];

const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
const [currentTab, setCurrentTab] = useState<number>(0);
const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen, initialTab }) => {
const [currentTab, setCurrentTab] = useState<number>(initialTab || 0);
const containerRef = useRef(null);
const location = useLocation();
const navigate = useNavigate();
Expand Down
2 changes: 1 addition & 1 deletion web/src/layout/Header/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import DappList from "./DappList";
import Explore from "./Explore";
import ConnectWallet from "components/ConnectWallet";
import LightButton from "components/LightButton";
import { Overlay } from "components/Overlay";
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
import Menu from "./Menu";
import Help from "./Menu/Help";
Expand Down Expand Up @@ -54,6 +53,7 @@ const DisconnectWalletButtonContainer = styled.div`

export interface ISettings {
toggleIsSettingsOpen: () => void;
initialTab?: number;
}

export interface IHelp {
Expand Down
12 changes: 6 additions & 6 deletions web/src/pages/Settings/EmailConfirmation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useMemo, useState } from "react";
import styled, { css } from "styled-components";

import { useNavigate, useSearchParams } from "react-router-dom";
import { Link, useSearchParams } from "react-router-dom";
import { isAddress } from "viem";

import { Button } from "@kleros/ui-components-library";
Expand Down Expand Up @@ -96,15 +96,15 @@ const messageConfigs = {
headerMsg: "Invalid Link!",
subtitleMsg: "Oops, seems like you followed an invalid link.",
buttonMsg: "Contact Support",
buttonTo: "/",
buttonTo: "https://t.me/kleros",
Icon: InvalidIcon,
color: "primaryText",
},
error: {
headerMsg: "Something went wrong",
subtitleMsg: "Oops, seems like something went wrong in our systems",
buttonMsg: "Contact Support",
buttonTo: "/",
buttonTo: "https://t.me/kleros",
Icon: WarningIcon,
color: "error",
},
Expand Down Expand Up @@ -139,8 +139,6 @@ const EmailConfirmation: React.FC = () => {
const address = searchParams.get("address");
const token = searchParams.get("token");

const navigate = useNavigate();

useEffect(() => {
if (address && isAddress(address) && token) {
setIsConfirming(true);
Expand Down Expand Up @@ -174,7 +172,9 @@ const EmailConfirmation: React.FC = () => {
</HeaderIconContainer>
<Header fontColor={color}>{headerMsg}</Header>
<Subtitle>{subtitleMsg}</Subtitle>
<Button text={buttonMsg} onClick={() => navigate(buttonTo)} />
<Link to={buttonTo}>
<Button text={buttonMsg} />
</Link>
</InfoWrapper>
<IconContainer>
<Icon />
Expand Down

0 comments on commit d71993d

Please sign in to comment.