From c46858df0a99fefeef7c2c1483bb40e21425f298 Mon Sep 17 00:00:00 2001 From: Anxo Rodriguez Date: Tue, 17 Dec 2024 12:07:01 +0000 Subject: [PATCH] chore: remove unnecessary casting --- .../modules/application/containers/App/index.tsx | 4 ++-- .../modules/application/containers/App/styled.ts | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx b/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx index c070a948fd..ca59c0b0af 100644 --- a/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx +++ b/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx @@ -98,10 +98,10 @@ export function App() { const isMobile = useMediaQuery(Media.upToMedium(false)) const customTheme = useMemo(() => { if (ACTIVE_CUSTOM_THEME === CustomTheme.HALLOWEEN && darkMode && isHalloweenEnabled) { - return 'darkHalloween' as CowSwapTheme + return 'darkHalloween' } if (ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && isChristmasEnabled) { - return darkMode ? ('darkChristmas' as CowSwapTheme) : ('lightChristmas' as CowSwapTheme) + return darkMode ? 'darkChristmas' : 'lightChristmas' } return undefined }, [darkMode, isHalloweenEnabled, isChristmasEnabled]) diff --git a/apps/cowswap-frontend/src/modules/application/containers/App/styled.ts b/apps/cowswap-frontend/src/modules/application/containers/App/styled.ts index 3fac7bbbfb..97bd38ee85 100644 --- a/apps/cowswap-frontend/src/modules/application/containers/App/styled.ts +++ b/apps/cowswap-frontend/src/modules/application/containers/App/styled.ts @@ -48,12 +48,9 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>` const backgroundColor = theme.darkMode ? '#0E0F2D' : '#65D9FF' let backgroundImage - if (customTheme === ('darkHalloween' as CowSwapTheme)) { + if (customTheme === 'darkHalloween') { backgroundImage = `url(${IMAGE_BACKGROUND_DARK_HALLOWEEN})` - } else if ( - customTheme === ('darkChristmas' as CowSwapTheme) || - customTheme === ('lightChristmas' as CowSwapTheme) - ) { + } else if (customTheme === 'darkChristmas' || customTheme === 'lightChristmas') { backgroundImage = theme.darkMode ? `url(${IMAGE_BACKGROUND_DARK_CHRISTMAS})` : `url(${IMAGE_BACKGROUND_LIGHT_CHRISTMAS})` @@ -72,13 +69,13 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>` background-size: auto; ${({ customTheme }) => - customTheme === ('darkHalloween' as CowSwapTheme) && + customTheme === 'darkHalloween' && ` background-image: url(${IMAGE_BACKGROUND_DARK_HALLOWEEN_MEDIUM}); `} ${({ customTheme, theme }) => - (customTheme === ('darkChristmas' as CowSwapTheme) || customTheme === ('lightChristmas' as CowSwapTheme)) && + (customTheme === 'darkChristmas' || customTheme === 'lightChristmas') && ` background-image: url(${theme.darkMode ? IMAGE_BACKGROUND_DARK_CHRISTMAS_MEDIUM : IMAGE_BACKGROUND_LIGHT_CHRISTMAS_MEDIUM}); `} @@ -89,13 +86,13 @@ export const BodyWrapper = styled.div<{ customTheme?: CowSwapTheme }>` min-height: ${({ theme }) => (theme.isInjectedWidgetMode ? 'initial' : 'calc(100vh - 100px)')}; ${({ customTheme }) => - customTheme === ('darkHalloween' as CowSwapTheme) && + customTheme === 'darkHalloween' && ` background-image: url(${IMAGE_BACKGROUND_DARK_HALLOWEEN_SMALL}); `} ${({ customTheme, theme }) => - (customTheme === ('darkChristmas' as CowSwapTheme) || customTheme === ('lightChristmas' as CowSwapTheme)) && + (customTheme === 'darkChristmas' || customTheme === 'lightChristmas') && ` background-image: url(${theme.darkMode ? IMAGE_BACKGROUND_DARK_CHRISTMAS_SMALL : IMAGE_BACKGROUND_LIGHT_CHRISTMAS_SMALL}); `}