Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Quick Links home view section #11373

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/app/Navigation/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1503,8 +1503,18 @@ export const artsyDotNetRoutes = defineRoutes([
path: "/:slug",
name: "VanityURLEntity",
Component: VanityURLEntityRenderer,
options: {
screenOptions: {
headerShown: false,
},
},
},
webViewRoute({ path: "/*" }),
webViewRoute({
path: "/*",
screenOptions: {
headerShown: false,
},
Comment on lines +1514 to +1516
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

}),
])

export const liveDotArtsyRoutes = defineRoutes([
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { fireEvent, screen } from "@testing-library/react-native"
import {
HomeViewSectionQuickLinks,
Pills,
} from "app/Scenes/HomeView/Sections/HomeViewSectionQuickLinks"
import { navigate } from "app/system/navigation/navigate"
import { renderWithWrappers } from "app/utils/tests/renderWithWrappers"

describe("HomeViewSectionQuickLinks", () => {
it("renders a list of pills", () => {
renderWithWrappers(<HomeViewSectionQuickLinks />)

Pills.forEach((pill) => {
expect(screen.getByText(pill.title)).toBeTruthy()
})
})

it("navigates to the pill href", () => {
renderWithWrappers(<HomeViewSectionQuickLinks />)

Pills.forEach((pill) => {
fireEvent.press(screen.getByText(pill.title))
expect(navigate).toHaveBeenCalledWith(pill.href)
})
})
})
49 changes: 49 additions & 0 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionQuickLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Pill, Spacer, Text, useSpace } from "@artsy/palette-mobile"
import { navigate } from "app/system/navigation/navigate"
import { FlatList } from "react-native-gesture-handler"

export const HomeViewSectionQuickLinks: React.FC<{}> = () => {
const space = useSpace()

return (
<FlatList
data={Pills}
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={{
paddingHorizontal: space(2),
}}
ItemSeparatorComponent={() => <Spacer x={0.5} />}
renderItem={({ item: pill }) => (
<Pill
key={pill.title}
accessibilityLabel={pill.title}
accessibilityRole="link"
testID={`pill-${pill.title}`}
variant="link"
onPress={() => {
navigate(pill.href)
}}
>
<Text variant="xs" color="black100">
{pill.title}
</Text>
</Pill>
)}
/>
)
}

type QuickLinkPill = {
title: string
href: string
}

export const Pills: Array<QuickLinkPill> = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is somewhat important, I believe it could also be placed above the component 🤷

Suggested change
export const Pills: Array<QuickLinkPill> = [
export const PILLS: Array<QuickLinkPill> = [

{ title: "Follows", href: "/favorites" },
{ title: "Auctions", href: "/auctions" },
{ title: "Saves", href: "/favorites/saves" },
{ title: "Art under $1000", href: "/collect?price_range=%2A-1000" },
{ title: "Price Database", href: "/price-database" },
{ title: "Editorial", href: "/news" },
]
5 changes: 5 additions & 0 deletions src/app/store/config/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ export const features = {
showInDevMenu: true,
echoFlagKey: "AREnableViewPortPrefetching",
},
AREnableHomeViewQuickLinks: {
description: "Enable Home View Quick Links",
readyForRelease: false,
showInDevMenu: true,
},
} satisfies { [key: string]: FeatureDescriptor }

export interface DevToggleDescriptor {
Expand Down