Skip to content

fix(web): open menu settings onClick of acc. info & overlay fix #1649

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

Merged
merged 12 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion web/src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const Overlay = styled.div`
width: 100vw;
height: 100vh;
background-color: ${({ theme }) => theme.blackLowOpacity};
z-index: 1;
z-index: 30;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ const Template: React.FC<ITemplate> = ({
});

return (
<>
<Overlay />
<Overlay>
<Container ref={containerRef} isVisible={isVisible}>
<LeftContainer>
<LeftContainerHeader>
Expand All @@ -187,7 +186,7 @@ const Template: React.FC<ITemplate> = ({
</LeftContainer>
<RightContainer>{RightContent}</RightContainer>
</Container>
</>
</Overlay>
);
};

Expand Down
5 changes: 2 additions & 3 deletions web/src/components/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ const Popup: React.FC<PopupProps & IPopup> = ({
}

return (
<>
<Overlay />
<Overlay>
<Container ref={containerRef}>
{popupType === PopupType.SWAP_SUCCESS && (
<SVGContainer>
Expand Down Expand Up @@ -270,7 +269,7 @@ const Popup: React.FC<PopupProps & IPopup> = ({
/>
)}
</Container>
</>
</Overlay>
);
};
export default Popup;
20 changes: 15 additions & 5 deletions web/src/layout/Header/DesktopHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { responsiveSize } from "styles/responsiveSize";

import ConnectWallet from "components/ConnectWallet";
import LightButton from "components/LightButton";
import { Overlay } from "components/Overlay";
import Onboarding from "components/Popup/MiniGuides/Onboarding";

import Logo from "./Logo";
Expand All @@ -22,6 +21,7 @@ import Explore from "./navbar/Explore";
import Menu from "./navbar/Menu";
import Help from "./navbar/Menu/Help";
import Settings from "./navbar/Menu/Settings";
import { useAccount } from "wagmi";

const Container = styled.div`
display: none;
Expand Down Expand Up @@ -73,10 +73,19 @@ const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
fill: ${({ theme }) => theme.white} !important;
`;

const ConnectWalletContainer = styled.div`
const ConnectWalletContainer = styled.div<{ isConnected: boolean }>`
label {
color: ${({ theme }) => theme.white};
}

${({ isConnected }) =>
isConnected &&
css`
cursor: pointer;
& > * {
pointer-events: none;
}
`}
`;

const PopupContainer = styled.div`
Expand All @@ -85,7 +94,8 @@ const PopupContainer = styled.div`
left: 0;
width: 100%;
height: 100%;
z-index: 30;
z-index: 1;
background-color: ${({ theme }) => theme.blackLowOpacity};
`;

const DesktopHeader: React.FC = () => {
Expand All @@ -95,6 +105,7 @@ const DesktopHeader: React.FC = () => {
const [isOnboardingMiniGuidesOpen, toggleIsOnboardingMiniGuidesOpen] = useToggle(false);
const [initialTab, setInitialTab] = useState<number>(0);
const location = useLocation();
const { isConnected } = useAccount();

const initializeFragmentURL = useCallback(() => {
const hash = location.hash;
Expand Down Expand Up @@ -130,15 +141,14 @@ const DesktopHeader: React.FC = () => {
</MiddleSide>

<RightSide>
<ConnectWalletContainer>
<ConnectWalletContainer isConnected={isConnected} onClick={isConnected ? toggleIsSettingsOpen : undefined}>
<ConnectWallet />
</ConnectWalletContainer>
<Menu {...{ toggleIsHelpOpen, toggleIsSettingsOpen }} />
</RightSide>
</Container>
{(isDappListOpen || isHelpOpen || isSettingsOpen) && (
<PopupContainer>
<Overlay />
{isDappListOpen && <DappList {...{ toggleIsDappListOpen, isDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen, isHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen, isSettingsOpen, initialTab }} />}
Expand Down
28 changes: 11 additions & 17 deletions web/src/layout/Header/navbar/Menu/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { Tabs } from "@kleros/ui-components-library";
import { landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";

import { Overlay } from "components/Overlay";

import { ISettings } from "../../index";

import General from "./General";
Expand All @@ -27,7 +25,6 @@ const Container = styled.div`
left: 50%;
transform: translateX(-50%);
z-index: 1;
background-color: ${({ theme }) => theme.whiteBackground};
border: 1px solid ${({ theme }) => theme.stroke};
border-radius: 3px;
overflow-y: auto;
Expand Down Expand Up @@ -85,20 +82,17 @@ const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen, initialTab }) =>
});

return (
<>
<Overlay />
<Container ref={containerRef}>
<StyledSettingsText>Settings</StyledSettingsText>
<StyledTabs
currentValue={currentTab}
items={TABS}
callback={(n: number) => {
setCurrentTab(n);
}}
/>
{currentTab === 0 ? <General /> : <NotificationSettings toggleIsSettingsOpen={toggleIsSettingsOpen} />}
</Container>
</>
<Container ref={containerRef}>
<StyledSettingsText>Settings</StyledSettingsText>
<StyledTabs
currentValue={currentTab}
items={TABS}
callback={(n: number) => {
setCurrentTab(n);
}}
/>
{currentTab === 0 ? <General /> : <NotificationSettings toggleIsSettingsOpen={toggleIsSettingsOpen} />}
</Container>
);
};

Expand Down
55 changes: 28 additions & 27 deletions web/src/layout/Header/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Wrapper = styled.div<{ isOpen: boolean }>`
left: 0;
width: 100vw;
height: 100vh;
z-index: 30;
z-index: 1;
`;

const StyledOverlay = styled(Overlay)`
Expand Down Expand Up @@ -77,7 +77,8 @@ const PopupContainer = styled.div`
left: 0;
width: 100%;
height: 100%;
z-index: 30;
z-index: 1;
background-color: ${({ theme }) => theme.blackLowOpacity};
`;

export interface ISettings {
Expand All @@ -104,34 +105,34 @@ const NavBar: React.FC = () => {
return (
<>
<Wrapper {...{ isOpen }}>
<StyledOverlay />
<Container {...{ isOpen }}>
<LightButton
text="Kleros Solutions"
onClick={() => {
toggleIsDappListOpen();
}}
Icon={KlerosSolutionsIcon}
/>
<hr />
<Explore />
<hr />
<WalletContainer>
<ConnectWallet />
{isConnected && (
<DisconnectWalletButtonContainer>
<DisconnectWalletButton />
</DisconnectWalletButtonContainer>
)}
</WalletContainer>
<hr />
<Menu {...{ toggleIsHelpOpen, toggleIsSettingsOpen }} />
<br />
</Container>
<StyledOverlay>
<Container {...{ isOpen }}>
<LightButton
text="Kleros Solutions"
onClick={() => {
toggleIsDappListOpen();
}}
Icon={KlerosSolutionsIcon}
/>
<hr />
<Explore />
<hr />
<WalletContainer>
<ConnectWallet />
{isConnected && (
<DisconnectWalletButtonContainer>
<DisconnectWalletButton />
</DisconnectWalletButtonContainer>
)}
</WalletContainer>
<hr />
<Menu {...{ toggleIsHelpOpen, toggleIsSettingsOpen }} />
<br />
</Container>
</StyledOverlay>
</Wrapper>
{(isDappListOpen || isHelpOpen || isSettingsOpen) && (
<PopupContainer>
<Overlay />
{isDappListOpen && <DappList {...{ toggleIsDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen }} />}
Expand Down
Loading