Skip to content

Commit

Permalink
feat: migrate HomeViewSectionShows section placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
MounirDhahri committed Sep 13, 2024
1 parent 16885be commit 6c0dcbb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/app/Scenes/Home/Components/ShowsRail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const ShowsRailContainer: React.FC<ShowsRailContainerProps> = ({
)
}

const ShowsRailPlaceholder: React.FC = () => {
export const ShowsRailPlaceholder: React.FC = () => {
return (
<Flex ml={2} mt={2} testID="show-rail-placeholder">
<RandomWidthPlaceholderText minWidth={100} maxWidth={200} marginBottom={20} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/Scenes/HomeView/HomeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Suspense, useState } from "react"
import { RefreshControl } from "react-native"
import { fetchQuery, graphql, useLazyLoadQuery, usePaginationFragment } from "react-relay"

const NUMBER_OF_SECTIONS_TO_LOAD = 10
const NUMBER_OF_SECTIONS_TO_LOAD = 100
// Hard coding the value here because 30px is not a valid value for the spacing unit
// and we need it to be consistent with 60px spacing between sections
export const HOME_VIEW_SECTIONS_SEPARATOR_HEIGHT = "30px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,5 @@ export const HomeViewSectionMarketingCollectionsQueryRenderer: React.FC<{
return null
}

// // return <HomeViewSectionMarketingCollectionsPlaceholder />

// return (
// <>
// <HomeViewSectionMarketingCollectionsPlaceholder />
// <HomeViewSectionMarketingCollections section={data.homeView.section} />
// </>
// )
return <HomeViewSectionMarketingCollections section={data.homeView.section} />
}, HomeViewSectionMarketingCollectionsPlaceholder)
16 changes: 13 additions & 3 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionShows.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Flex } from "@artsy/palette-mobile"
import { Flex, Skeleton } from "@artsy/palette-mobile"
import { HomeViewSectionShowsQuery } from "__generated__/HomeViewSectionShowsQuery.graphql"
import { HomeViewSectionShows_section$key } from "__generated__/HomeViewSectionShows_section.graphql"
import { ShowsRailContainer } from "app/Scenes/Home/Components/ShowsRail"
import { ShowsRailContainer, ShowsRailPlaceholder } from "app/Scenes/Home/Components/ShowsRail"
import { HOME_VIEW_SECTIONS_SEPARATOR_HEIGHT } from "app/Scenes/HomeView/HomeView"
import { useHomeViewTracking } from "app/Scenes/HomeView/useHomeViewTracking"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
Expand Down Expand Up @@ -40,6 +40,16 @@ const fragment = graphql`
}
`

const HomeViewSectionShowsPlaceholder: React.FC = () => {
return (
<Skeleton>
<Flex mx={2} my={HOME_VIEW_SECTIONS_SEPARATOR_HEIGHT}>
<ShowsRailPlaceholder />
</Flex>
</Skeleton>
)
}

const homeViewSectionShowsQuery = graphql`
query HomeViewSectionShowsQuery($id: String!) {
homeView {
Expand All @@ -62,4 +72,4 @@ export const HomeViewSectionShowsQueryRenderer: React.FC<{
}

return <HomeViewSectionShows section={data.homeView.section} />
})
}, HomeViewSectionShowsPlaceholder)

0 comments on commit 6c0dcbb

Please sign in to comment.