Skip to content

Commit

Permalink
chore(analytics): update HomeViewSectionScreenArtworks ownerType value
Browse files Browse the repository at this point in the history
  • Loading branch information
dblandin committed Sep 20, 2024
1 parent 014a4d1 commit a1501f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe("HomeViewSectionArtworks", () => {
component: {
title: "New Works for You",
},
ownerType: "newWorksForYou",
artworksConnection: {
edges: [
{
Expand Down Expand Up @@ -89,9 +90,9 @@ describe("HomeViewSectionArtworks", () => {
"action": "tappedMainArtworkGrid",
"context_module": "artworkGrid",
"context_screen": undefined,
"context_screen_owner_id": "home-view-section-new-works-for-you",
"context_screen_owner_id": undefined,
"context_screen_owner_slug": undefined,
"context_screen_owner_type": "home-view-section-new-works-for-you",
"context_screen_owner_type": "newWorksForYou",
"destination_screen_owner_id": "artwork-2-id",
"destination_screen_owner_slug": "artwork-2-slug",
"destination_screen_owner_type": "artwork",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ContextModule, ScreenOwnerType } from "@artsy/cohesion"
import { ScreenOwnerType } from "@artsy/cohesion"
import { Flex, Screen, SimpleMessage, Text } from "@artsy/palette-mobile"
import { HomeViewSectionScreenArtworksQuery } from "__generated__/HomeViewSectionScreenArtworksQuery.graphql"
import { HomeViewSectionScreenArtworks_section$key } from "__generated__/HomeViewSectionScreenArtworks_section.graphql"
Expand All @@ -15,12 +15,18 @@ interface ArtworksScreenHomeSection {
}

export const HomeViewSectionScreenArtworks: React.FC<ArtworksScreenHomeSection> = (props) => {
const { data, isLoadingNext, loadNext, refetch, hasNext } = usePaginationFragment<
const {
data: section,
isLoadingNext,
loadNext,
refetch,
hasNext,
} = usePaginationFragment<
HomeViewSectionScreenArtworksQuery,
HomeViewSectionScreenArtworks_section$key
>(artworksFragment, props.section)

const artworks = extractNodes(data?.artworksConnection)
const artworks = extractNodes(section?.artworksConnection)

const RefreshControl = useRefreshControl(refetch)

Expand All @@ -38,9 +44,9 @@ export const HomeViewSectionScreenArtworks: React.FC<ArtworksScreenHomeSection>
}
ListHeaderComponent={() => (
<Flex>
<Text variant="lg-display">{data.component?.title}</Text>
<Text variant="lg-display">{section.component?.title}</Text>
<Text variant="xs" pt={2}>
{data.artworksConnection?.totalCount} {pluralize("Artwork", artworks.length)}
{section.artworksConnection?.totalCount} {pluralize("Artwork", artworks.length)}
</Text>
</Flex>
)}
Expand All @@ -52,9 +58,7 @@ export const HomeViewSectionScreenArtworks: React.FC<ArtworksScreenHomeSection>
isLoading={isLoadingNext}
onScroll={scrollHandler}
style={{ paddingBottom: 120 }}
contextModule={data.internalID as ContextModule}
contextScreenOwnerType={data.internalID as ScreenOwnerType}
contextScreenOwnerId={data.internalID as string}
contextScreenOwnerType={section.ownerType as ScreenOwnerType}
/>
)
}
Expand Down

0 comments on commit a1501f7

Please sign in to comment.