Skip to content

Commit

Permalink
chore: improve handling of feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Dec 17, 2024
1 parent 4da75ff commit 4540290
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export function App() {
useAnalyticsReporterCowSwap()
useInitializeUtm()

const featureFlags = useFeatureFlags()
const { isYieldEnabled } = featureFlags
const { isYieldEnabled, isChristmasEnabled, isHalloweenEnabled } = useFeatureFlags()

const isInjectedWidgetMode = isInjectedWidget()
const menuItems = useMenuItems()
Expand Down Expand Up @@ -98,14 +97,14 @@ export function App() {
const { pendingActivity } = useCategorizeRecentActivity()
const isMobile = useMediaQuery(Media.upToMedium(false))
const customTheme = useMemo(() => {
if (ACTIVE_CUSTOM_THEME === CustomTheme.HALLOWEEN && darkMode && featureFlags.isHalloweenEnabled) {
if (ACTIVE_CUSTOM_THEME === CustomTheme.HALLOWEEN && darkMode && isHalloweenEnabled) {
return 'darkHalloween' as CowSwapTheme
}
if (ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && featureFlags.isChristmasEnabled) {
if (ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && isChristmasEnabled) {
return darkMode ? ('darkChristmas' as CowSwapTheme) : ('lightChristmas' as CowSwapTheme)
}
return undefined
}, [darkMode, featureFlags.isHalloweenEnabled, featureFlags.isChristmasEnabled])
}, [darkMode, isHalloweenEnabled, isChristmasEnabled])

const persistentAdditionalContent = (
<HeaderControls>
Expand All @@ -116,7 +115,7 @@ export function App() {
</HeaderControls>
)

const isChristmasTheme = ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && featureFlags.isChristmasEnabled
const isChristmasTheme = ACTIVE_CUSTOM_THEME === CustomTheme.CHRISTMAS && isChristmasEnabled

return (
<ErrorBoundary>
Expand Down

0 comments on commit 4540290

Please sign in to comment.