Skip to content

Commit

Permalink
feat: scroll back to artworks grid (#9423)
Browse files Browse the repository at this point in the history
  • Loading branch information
MounirDhahri authored and MrSltun committed Oct 13, 2023
1 parent 319a2a1 commit 07a639c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/app/Scenes/Search/components/AutosuggestSearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ArtistTabs = "Insights" | "Artworks"

type PassedProps = {
initialTab: ArtistTabs
scrollToArtworksGrid?: boolean
}

type HandleResultPress = (passProps?: PassedProps) => void
Expand Down Expand Up @@ -199,13 +200,20 @@ function navigateToResult(result: AutosuggestResult, props?: PassedProps) {
} else if (result.displayType === "Fair") {
navigateToEntity(result.href!, EntityType.Fair, SlugType.ProfileID)
} else if (result.__typename === "Artist") {
if (props?.initialTab === "Insights") {
navigate(`${result.href!}/auction-results`, { passProps: props })
switch (props?.initialTab) {
case "Insights":
navigate(`${result.href!}/auction-results`, { passProps: props })
break
case "Artworks":
navigate(`${result.href!}/artworks`, {
passProps: props,
})
break

default:
navigate(result.href!)
break
}
if (props?.initialTab === "Artworks") {
navigate(`${result.href!}/artworks`, { passProps: props })
}
navigate(result.href!)
} else {
navigate(result.href!)
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function getDomainMap(): Record<string, RouteMatcher[] | null> {
})),
addRoute("/artist/:artistID/artworks", "Artist", (params) => ({
...params,
initialTab: "Insights",
initialTab: "Artworks",
scrollToArtworksGrid: true,
})),
addRoute("/artist/:artistID/shows", "ArtistShows"),

Expand Down

0 comments on commit 07a639c

Please sign in to comment.