From cf58fc9fd43d37b908ef931da7f3245a3557691a Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sun, 28 Aug 2022 20:59:14 -0700 Subject: [PATCH] Remove Groups from sidebar --- web/components/nav/sidebar.tsx | 73 +++------------------------------- 1 file changed, 5 insertions(+), 68 deletions(-) diff --git a/web/components/nav/sidebar.tsx b/web/components/nav/sidebar.tsx index 3e1ecb83..7e9b7941 100644 --- a/web/components/nav/sidebar.tsx +++ b/web/components/nav/sidebar.tsx @@ -20,10 +20,7 @@ import NotificationsIcon from 'web/components/notifications-icon' import React from 'react' import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' import { CreateQuestionButton } from 'web/components/create-question-button' -import { useMemberGroups } from 'web/hooks/use-group' -import { groupPath } from 'web/lib/firebase/groups' import { trackCallback, withTracking } from 'web/lib/service/analytics' -import { Group } from 'common/group' import { Spacer } from '../layout/spacer' import { CHALLENGES_ENABLED } from 'common/challenge' import { buildArray } from 'common/util/array' @@ -68,9 +65,11 @@ function getMoreNavigation(user?: User | null) { } if (!user) { + // Signed out "More" return buildArray( CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' }, [ + { name: 'Groups', href: '/groups' }, { name: 'Leaderboards', href: '/leaderboards' }, { name: 'Tournaments', href: '/tournaments' }, { name: 'Charity', href: '/charity' }, @@ -81,9 +80,11 @@ function getMoreNavigation(user?: User | null) { ) } + // Signed in "More" return buildArray( CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' }, [ + { name: 'Groups', href: '/groups' }, { name: 'Referrals', href: '/referrals' }, { name: 'Leaderboards', href: '/leaderboards' }, { name: 'Charity', href: '/charity' }, @@ -143,6 +144,7 @@ function getMoreMobileNav() { return buildArray( CHALLENGES_ENABLED && { name: 'Challenges', href: '/challenges' }, [ + { name: 'Groups', href: '/groups' }, { name: 'Referrals', href: '/referrals' }, { name: 'Leaderboards', href: '/leaderboards' }, { name: 'Charity', href: '/charity' }, @@ -225,15 +227,6 @@ export default function Sidebar(props: { className?: string }) { ? signedOutMobileNavigation : signedInMobileNavigation - const memberItems = ( - useMemberGroups(user?.id, undefined, { - by: 'mostRecentContractAddedTime', - }) ?? [] - ).map((group: Group) => ({ - name: group.name, - href: `${groupPath(group.slug)}`, - })) - return ( ) } - -function GroupsList(props: { currentPage: string; memberItems: Item[] }) { - const { currentPage, memberItems } = props - - // const preferredNotifications = useUnseenPreferredNotifications( - // privateUser, - // { - // customHref: '/group/', - // }, - // memberItems.length > 0 ? memberItems.length : undefined - // ) - // const notifIsForThisItem = useMemo( - // () => (itemHref: string) => - // preferredNotifications.some( - // (n) => - // !n.isSeen && - // (n.isSeenOnHref === itemHref || - // n.isSeenOnHref?.replace('/chat', '') === itemHref) - // ), - // [preferredNotifications] - // ) - - return ( - <> - - -
- {memberItems.map((item) => ( - - {item.name} - - ))} -
- - ) -}