Skip to content

Commit

Permalink
Make Create communities configurable (#60)
Browse files Browse the repository at this point in the history
## Motivation
We want to hide the create community button by default and enable it only for Noom employees.

## Changes
Make the button configurable so the web app can control if it's visible or not using the user metadata.
  • Loading branch information
djerbic authored Dec 12, 2024
1 parent acdb744 commit a35d597
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/social/components/SideSectionMyCommunity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SideSectionMyCommunity = ({
currentUserId,
}) => {
const { connected } = useSDK();
const { socialCommunityCreationButtonVisible } = useConfig();
const { socialCommunityCreationButtonVisible , showCreateCommunity} = useConfig();
const { onCommunityCreated } = useNavigation();
const [isOpen, setIsOpen] = useState(false);
const { user } = useUser(currentUserId, [currentUserId]);
Expand All @@ -39,10 +39,6 @@ const SideSectionMyCommunity = ({
communityId && onCommunityCreated(communityId);
};

const canCreateCommunity =
socialCommunityCreationButtonVisible &&
(userType !== 'user' || user?.metadata?.[BUSINESS_TYPE_METADATA] !== 'B2B');

return (
<Box bg="white" h="100%" pb={2} pt={1}>
<ListHeading>
Expand All @@ -54,7 +50,7 @@ const SideSectionMyCommunity = ({
<CommunityCount ml="auto" count={communityListProps?.communities?.length} />
</ListHeading>
<Box h="calc(100% - 50px)" minH={0} overflow="auto">
{canCreateCommunity && (
{showCreateCommunity && (
<SideMenuActionItem
icon={<Plus height={20} />}
element="button"
Expand Down
1 change: 1 addition & 0 deletions src/social/providers/ConfigProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const defaultConfig = {
showCreatePublicCommunityOption: false,
showUserProfileMetadata: false,
showOldStyleComments: false,
showCreateCommunity: false,
manateeUrl: null,
dashboardUrl: null,
isUserCurrentlyInStingDashCallback: async (_uac: string) => false,
Expand Down

0 comments on commit a35d597

Please sign in to comment.