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

Remove halloween theme #376

Merged
merged 2 commits into from
Jul 7, 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
14 changes: 1 addition & 13 deletions packages/extension/src/components/atoms/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
import { FC, SVGProps, useMemo } from 'react';

import { useFeatureFlags } from '../../../hooks';

interface LogoProps extends SVGProps<SVGSVGElement> {
isAnimated?: boolean;
}

export const Logo: FC<LogoProps> = ({ isAnimated, ...rest }) => {
const { featureFlags } = useFeatureFlags();

const colors = useMemo(() => {
if ((featureFlags as any)['CITROUILLE_2K23']) {
return {
primary: '#FF7518',
secondary: '#FFA500',
tertiary: '#FFD700'
};
}
//TODO: In another MR these colors will need to come from the template
return {
primary: '#00A8EA',
secondary: '#33D3F4',
tertiary: '#40EEFF'
};
}, [featureFlags]);
}, []);

if (isAnimated) {
return (
Expand Down
41 changes: 13 additions & 28 deletions packages/extension/src/components/organisms/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import OutboundIcon from '@mui/icons-material/Outbound';
import { AppBar, Box, Button, IconButton, Toolbar, Tooltip, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import copyToClipboard from 'copy-to-clipboard';
import { GiHangingSpider } from 'react-icons/gi';
import { SiGhostery } from 'react-icons/si';
import { useNavigate } from 'react-router-dom';

import {
Expand All @@ -17,7 +15,7 @@ import {
SEND_PATH,
RECEIVE_PATH
} from '../../../constants';
import { useFeatureFlags, useTimeout } from '../../../hooks';
import { useTimeout } from '../../../hooks';
import { WalletLedger } from '../../../types';
import { truncateAddress, truncateWalletName } from '../../../utils';
import { WalletIcon } from '../../atoms';
Expand All @@ -40,16 +38,11 @@ export interface HeaderProps {
export const Header: FC<HeaderProps> = ({ wallet: { name, publicAddress } }) => {
const navigate = useNavigate();
const setTimeout = useTimeout(2000);
const { featureFlags } = useFeatureFlags();

const [isCopied, setIsCopied] = useState(false);

const truncatedAddress = useMemo(() => truncateAddress(publicAddress), [publicAddress]);

const isHalloween = useMemo(() => {
return (featureFlags as any)['CITROUILLE_2K23'];
}, [featureFlags]);

const handleShare = useCallback(() => {
copyToClipboard(publicAddress);
setIsCopied(true);
Expand Down Expand Up @@ -131,16 +124,12 @@ export const Header: FC<HeaderProps> = ({ wallet: { name, publicAddress } }) =>
alignItems: 'center'
}}
>
{isHalloween ? (
<SiGhostery size={20} color="white" />
) : (
<OutboundIcon
style={{
transform: 'rotate(-45deg)',
color: 'white'
}}
/>
)}
<OutboundIcon
style={{
transform: 'rotate(-45deg)',
color: 'white'
}}
/>
<Typography color="white" variant="caption">
Send
</Typography>
Expand All @@ -155,16 +144,12 @@ export const Header: FC<HeaderProps> = ({ wallet: { name, publicAddress } }) =>
}}
onClick={handleReceive}
>
{isHalloween ? (
<GiHangingSpider size={20} color="white" />
) : (
<OutboundIcon
style={{
transform: 'rotate(135deg)',
color: 'white'
}}
/>
)}
<OutboundIcon
style={{
transform: 'rotate(135deg)',
color: 'white'
}}
/>
<Typography color="white" variant="caption">
Receive
</Typography>
Expand Down
35 changes: 6 additions & 29 deletions packages/extension/src/components/organisms/NavMenu/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ import { CSSProperties, FC, MouseEvent, useEffect, useMemo } from 'react';

import { BottomNavigation, BottomNavigationAction } from '@mui/material';
import { styled } from '@mui/system';
import { FaGhost, FaHatWizard, FaSpider } from 'react-icons/fa';
import { GiPumpkinLantern } from 'react-icons/gi';
import { useNavigate } from 'react-router-dom';

import {
GEMWALLET_BLUE,
GEMWALLET_HALLOWEEN_ORANGE,
navigation as navigationConstant
} from '../../../constants';
import { GEMWALLET_BLUE, navigation as navigationConstant } from '../../../constants';
import { useNavBarPosition } from '../../../contexts';

const defaultDecoration = {
Expand All @@ -29,10 +23,10 @@ export interface NavMenuProps {

export const NavMenu: FC<NavMenuProps> = ({ indexDefaultNav }) => {
const navigate = useNavigate();
const { navBarPosition, setNavBarPosition, isHalloween } = useNavBarPosition();
const { navBarPosition, setNavBarPosition } = useNavBarPosition();

const StyledBottomNavigation = useMemo(() => {
const backgroundColor = isHalloween ? GEMWALLET_HALLOWEEN_ORANGE : GEMWALLET_BLUE;
const backgroundColor = GEMWALLET_BLUE;

return styled(BottomNavigation)`
${defaultDecoration}
Expand All @@ -52,28 +46,11 @@ export const NavMenu: FC<NavMenuProps> = ({ indexDefaultNav }) => {
border-radius: 2px;
}
`;
}, [isHalloween]);
}, []);

const navigation = useMemo(() => {
if (!isHalloween) {
return navigationConstant;
}
const navigationHalloween = [
<GiPumpkinLantern size={25} />,
<FaGhost size={25} />,
<FaHatWizard size={25} />,
<FaSpider size={25} />
];

if (navigationConstant.length !== navigationHalloween.length) {
throw new Error('navigation constant and navigation Halloween must have the same length');
}

return navigationConstant.map((navItem, index) => ({
...navItem,
icon: navigationHalloween[index]
}));
}, [isHalloween]);
return navigationConstant;
}, []);

useEffect(() => {
if (indexDefaultNav !== -1) {
Expand Down
16 changes: 3 additions & 13 deletions packages/extension/src/contexts/NavBarContext/NavBarContext.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { createContext, FC, useContext, useMemo, useState } from 'react';
import { createContext, FC, useContext, useState } from 'react';

import * as Sentry from '@sentry/react';

import { useFeatureFlags } from '../../hooks';

interface NavBarPosition {
left: string;
width: string;
Expand All @@ -12,7 +10,6 @@ interface NavBarPosition {
interface NavBarPositionContextType {
setNavBarPosition: (position: NavBarPosition) => void;
navBarPosition: NavBarPosition;
isHalloween: boolean;
}

interface Props {
Expand All @@ -26,22 +23,15 @@ const defaultPosition = {

const NavBarPositionContext = createContext<NavBarPositionContextType>({
setNavBarPosition: () => {},
navBarPosition: defaultPosition,
isHalloween: false
navBarPosition: defaultPosition
});

const NavBarPositionProvider: FC<Props> = ({ children }) => {
const [navBarPosition, setNavBarPosition] = useState<NavBarPosition>(defaultPosition);
const { featureFlags } = useFeatureFlags();

const isHalloween = useMemo<boolean>(() => {
return (featureFlags as any)['CITROUILLE_2K23'];
}, [featureFlags]);

const contextValue: NavBarPositionContextType = {
navBarPosition,
setNavBarPosition,
isHalloween
setNavBarPosition
};

return (
Expand Down
1 change: 0 additions & 1 deletion packages/extension/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './useBeforeUnload';
export * from './useFeatureFlags';
export * from './useFees';
export * from './useFetchFromSessionStorage';
export * from './useKeyUp';
Expand Down
1 change: 0 additions & 1 deletion packages/extension/src/hooks/useFeatureFlags/index.ts

This file was deleted.

68 changes: 0 additions & 68 deletions packages/extension/src/hooks/useFeatureFlags/useFeatureFlags.ts

This file was deleted.

24 changes: 3 additions & 21 deletions packages/extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'react-router-dom';

import App from './App';
import { GEMWALLET_HALLOWEEN_ORANGE, POPUP_HEIGHT, POPUP_WIDTH } from './constants';
import { POPUP_HEIGHT, POPUP_WIDTH } from './constants';
import {
BrowserProvider,
LedgerProvider,
Expand All @@ -23,26 +23,10 @@ import {
TransactionProgressProvider,
WalletProvider
} from './contexts';
import { useFeatureFlags } from './hooks';
import reportWebVitals from './reportWebVitals';
import './index.css';
import { createRoot } from 'react-dom/client';

const halloweenTheme = createTheme({
palette: {
mode: 'dark',
primary: {
main: GEMWALLET_HALLOWEEN_ORANGE
},
secondary: {
main: '#793D0D'
},
error: {
main: '#D32F2F'
}
}
});

Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
release: 'gemwallet-extension@' + process.env.REACT_APP_VERSION,
Expand All @@ -68,7 +52,6 @@ Sentry.init({
});

const GemWallet = () => {
const { featureFlags } = useFeatureFlags();
const theme = useMemo(
() =>
createTheme({
Expand All @@ -95,10 +78,9 @@ const GemWallet = () => {
}
}
}
},
...((featureFlags as any)['CITROUILLE_2K23'] ? halloweenTheme : {})
}
}),
[featureFlags]
[]
);

return (
Expand Down