From 5ea4db5355c4b2b0a4f47ec328daaf265c41942c Mon Sep 17 00:00:00 2001 From: Rohan-cp Date: Tue, 2 Apr 2024 19:04:57 -0400 Subject: [PATCH] some cleanup --- .../components/Feed/SuggestedProfileCard.tsx | 1 - .../src/components/Search/SearchDefault.tsx | 44 ++---------------- .../SearchFeaturedCollectionSection.tsx | 4 +- .../Search/SearchSuggestedUsersSection.tsx | 46 ++++++++++++++++--- 4 files changed, 46 insertions(+), 49 deletions(-) diff --git a/apps/web/src/components/Feed/SuggestedProfileCard.tsx b/apps/web/src/components/Feed/SuggestedProfileCard.tsx index c26c57a711..643c53dadb 100644 --- a/apps/web/src/components/Feed/SuggestedProfileCard.tsx +++ b/apps/web/src/components/Feed/SuggestedProfileCard.tsx @@ -178,7 +178,6 @@ const StyledSuggestedProfileCard = styled(GalleryLink)` @media only screen and ${breakpoints.desktop} { min-width: 200px; - min-height: 183px; } `; diff --git a/apps/web/src/components/Search/SearchDefault.tsx b/apps/web/src/components/Search/SearchDefault.tsx index 2af4a6f3fb..596e0ed146 100644 --- a/apps/web/src/components/Search/SearchDefault.tsx +++ b/apps/web/src/components/Search/SearchDefault.tsx @@ -1,15 +1,12 @@ -import { useMemo } from 'react'; import { graphql, useLazyLoadQuery } from 'react-relay'; import { SearchDefaultQuery } from '~/generated/SearchDefaultQuery.graphql'; import { CmsTypes } from '~/scenes/ContentPages/cms_types'; -import { HStack, VStack } from '../core/Spacer/Stack'; +import { VStack } from '../core/Spacer/Stack'; import SearchFeaturedCollectionSection from './SearchFeaturedCollectionSection'; import SearchSuggestedUsersSection from './SearchSuggestedUsersSection'; -import SearchResultsHeader from './SearchResultsHeader'; import { SearchItemType } from './types'; -import UserSearchResult from './User/UserSearchResult'; import SearchDefaultTrendingCuratorsSection from './SearchDefaultTrendingCurators'; type Props = { @@ -23,55 +20,20 @@ export default function SearchDefault({ variant = 'default', onSelect, pageConte const query = useLazyLoadQuery( graphql` query SearchDefaultQuery { - viewer @required(action: THROW) { - ... on Viewer { - suggestedUsers(first: 2) @required(action: THROW) { - __typename - edges { - node { - __typename - ... on GalleryUser { - id - __typename - } - ...SuggestedProfileCardFragment - } - } - } - } - } - ...SearchSuggestedUsersSectionFollowFragment + ...SearchSuggestedUsersSectionFragment ...SearchDefaultTrendingCuratorsSectionFragment } `, {} ); - // map edge nodes to an array of GalleryUsers - const nonNullProfiles = useMemo(() => { - const users = []; - - for (const edge of query.viewer?.suggestedUsers?.edges ?? []) { - if (edge?.node) { - users.push(edge.node); - } - } - - return users; - }, [query.viewer?.suggestedUsers?.edges]); - - if (query.viewer?.suggestedUsers?.__typename !== 'UsersConnection') { - return null; - } - const { featuredProfiles } = pageContent ?? []; - const featuredProfilesData = featuredProfiles?.slice(0, 2); return ( - + { + const users = []; + + for (const edge of query.viewer?.suggestedUsers?.edges ?? []) { + if (edge?.node) { + users.push(edge.node); + } + } + + return users; + }, [query.viewer?.suggestedUsers?.edges]); + + if (query.viewer?.suggestedUsers?.__typename !== 'UsersConnection') { + return null; + } + if (!nonNullProfiles) { + return null; } return ( <> Suggested Collectors and Creators - {profiles?.map((profile) => ( + {nonNullProfiles?.map((profile) => (