From 55336a6c8a64966064445e712f856578f016f538 Mon Sep 17 00:00:00 2001 From: Malik Zulqurnain Date: Tue, 8 Oct 2024 21:23:41 +0500 Subject: [PATCH] Hide token launch cta elements behind feature flag --- .../CreateContentDrawer.tsx | 13 +++++++--- .../CreateContentMenu/CreateContentMenu.tsx | 26 ++++++++++++++----- .../views/pages/user_dashboard/index.tsx | 7 +++-- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/packages/commonwealth/client/scripts/views/components/MobileNavigation/CreateContentDrawer/CreateContentDrawer.tsx b/packages/commonwealth/client/scripts/views/components/MobileNavigation/CreateContentDrawer/CreateContentDrawer.tsx index 354ead52026..625068bbd56 100644 --- a/packages/commonwealth/client/scripts/views/components/MobileNavigation/CreateContentDrawer/CreateContentDrawer.tsx +++ b/packages/commonwealth/client/scripts/views/components/MobileNavigation/CreateContentDrawer/CreateContentDrawer.tsx @@ -7,6 +7,7 @@ import { CWIcon } from 'views/components/component_kit/cw_icons/cw_icon'; import { CWText } from 'views/components/component_kit/cw_text'; import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton'; +import { useFlag } from 'hooks/useFlag'; import useUserStore from 'state/ui/user'; import './CreateContentDrawer.scss'; @@ -19,6 +20,8 @@ const CreateContentDrawer = ({ onClose }: CreateContentDrawerProps) => { const user = useUserStore(); const scopedPage = app.activeChainId(); + const tokenizedCommunityEnabled = useFlag('tokenizedCommunity'); + const handleCreateThread = () => { navigate('/new/discussion'); }; @@ -55,10 +58,12 @@ const CreateContentDrawer = ({ onClose }: CreateContentDrawerProps) => { Create community -
- - Launch Token -
+ {tokenizedCommunityEnabled && ( +
+ + Launch Token +
+ )} diff --git a/packages/commonwealth/client/scripts/views/menus/CreateContentMenu/CreateContentMenu.tsx b/packages/commonwealth/client/scripts/views/menus/CreateContentMenu/CreateContentMenu.tsx index fd824e4afd4..43a05517773 100644 --- a/packages/commonwealth/client/scripts/views/menus/CreateContentMenu/CreateContentMenu.tsx +++ b/packages/commonwealth/client/scripts/views/menus/CreateContentMenu/CreateContentMenu.tsx @@ -1,4 +1,5 @@ import { ChainBase, ChainNetwork } from '@hicommonwealth/shared'; +import { useFlag } from 'hooks/useFlag'; import { uuidv4 } from 'lib/util'; import { useCommonNavigate } from 'navigation/helpers'; import React from 'react'; @@ -42,6 +43,7 @@ const getCreateContentMenuItems = ( options?: NavigateOptions & { action?: string }, prefix?: null | string, ) => void, + tokenizedCommunityEnabled: boolean, createDiscordBotConfig?: ReturnType< typeof useCreateDiscordBotConfigMutation >['mutateAsync'], @@ -99,10 +101,14 @@ const getCreateContentMenuItems = ( navigate('/createCommunity', {}, null); }, }, - { - type: 'element', - element: , - }, + ...(tokenizedCommunityEnabled + ? [ + { + type: 'element', + element: , + } as PopoverMenuItem, + ] + : []), ]; const getDiscordBotConnectionItems = (): PopoverMenuItem[] => { @@ -192,6 +198,8 @@ export const CreateContentSidebar = ({ const { mutateAsync: createDiscordBotConfig } = useCreateDiscordBotConfigMutation(); + const tokenizedCommunityEnabled = useFlag('tokenizedCommunity'); + return ( ); }; @@ -226,6 +238,8 @@ export const CreateContentPopover = () => { const navigate = useCommonNavigate(); const user = useUserStore(); + const tokenizedCommunityEnabled = useFlag('tokenizedCommunity'); + if ( !user.isLoggedIn || !app.chain || @@ -237,7 +251,7 @@ export const CreateContentPopover = () => { return ( ( { const { isAddedToHomeScreen } = useAppStatus(); + const tokenizedCommunityEnabled = useFlag('tokenizedCommunity'); + useBrowserAnalyticsTrack({ payload: { event: MixpanelPageViewEvent.DASHBOARD_VIEW, @@ -141,12 +144,12 @@ const UserDashboard = ({ type }: UserDashboardProps) => { {isWindowExtraSmall ? ( <> - + {tokenizedCommunityEnabled && } ) : (
- + {tokenizedCommunityEnabled && }
)}