From 6f52df3c5589cb2b40531b3d924b998a01f76abb Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Wed, 22 Jan 2025 21:43:05 +0100 Subject: [PATCH] feat: banner to choose force cairo version option --- packages/starknet-snap/src/config.ts | 2 +- .../ui/Framework/Framework.style.ts | 12 ++-- .../ui/Framework/Framework.view.tsx | 64 ++++++++++++++++--- .../AccountSwitchModal.view.tsx | 4 +- 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/packages/starknet-snap/src/config.ts b/packages/starknet-snap/src/config.ts index ba34fe15..47d726d9 100644 --- a/packages/starknet-snap/src/config.ts +++ b/packages/starknet-snap/src/config.ts @@ -65,7 +65,7 @@ export const Config: SnapConfig = { }, account: { - maxAccountToCreate: 2, + maxAccountToCreate: 1, }, // eslint-disable-next-line no-restricted-globals diff --git a/packages/wallet-ui/src/components/ui/Framework/Framework.style.ts b/packages/wallet-ui/src/components/ui/Framework/Framework.style.ts index d6233c41..418aa1ec 100644 --- a/packages/wallet-ui/src/components/ui/Framework/Framework.style.ts +++ b/packages/wallet-ui/src/components/ui/Framework/Framework.style.ts @@ -14,7 +14,7 @@ export const Wrapper = styled.div` export const ColMiddle = styled.div` width: 1040px; margin: auto; - + margin-top: 40px; @media (max-width: 1024px) { width: 896px; } @@ -34,14 +34,16 @@ export const Content = styled.div` export const Banner = styled.div` position: fixed; left: 0px; - bottom: 0px; + top: 0px; width: 100%; - background-color: ${(props) => props.theme.palette.primary.main}; + background-color: red; + margin-bottom: 24px; color: ${(props) => props.theme.palette.grey.grey3}; display: flex; align-items: center; - padding: 13px 24px; - justify-content: space-between; + padding: 10px 24px; + justify-content: space-around; + z-index: 2; `; export const CloseIcon = styled(FontAwesomeIcon)` diff --git a/packages/wallet-ui/src/components/ui/Framework/Framework.view.tsx b/packages/wallet-ui/src/components/ui/Framework/Framework.view.tsx index c463df87..695cb278 100644 --- a/packages/wallet-ui/src/components/ui/Framework/Framework.view.tsx +++ b/packages/wallet-ui/src/components/ui/Framework/Framework.view.tsx @@ -1,8 +1,8 @@ -import { ReactNode, useState } from 'react'; +import { ReactNode } from 'react'; import { Footer } from 'components/ui/organism/Footer'; +import { Button, Stack, Typography } from '@mui/material'; // Importing MUI components import { Banner, - CloseIcon, ColMiddle, Content, MenuStyled, @@ -15,7 +15,29 @@ interface Props { } export const FrameworkView = ({ connected, children }: Props) => { - const [bannerOpen, setBannerOpen] = useState(true); + // Get the current `accountDiscovery` value from the URL + const urlParams = new URLSearchParams(window.location.search); + const accountDiscovery = urlParams.get('accountDiscovery'); + + const bannerMessage = + accountDiscovery === 'FORCE_CAIRO_1' + ? 'This is a special version for recovering funds on a Cairo 1 account.' + : accountDiscovery === 'FORCE_CAIRO_0' + ? 'This is a special version for recovering funds on a Cairo 0 account.' + : 'This is a special version of the dapp for account recovery purposes.'; + + const handleAccountChange = (version: string) => { + // Update the URL without reloading the page + const newParams = new URLSearchParams(window.location.search); + newParams.set('accountDiscovery', version); + window.history.replaceState( + {}, + '', + `${window.location.pathname}?${newParams.toString()}`, + ); + window.location.reload(); // Reload to apply the updated query parameter + }; + return ( @@ -23,12 +45,36 @@ export const FrameworkView = ({ connected, children }: Props) => { {children}