-
Notifications
You must be signed in to change notification settings - Fork 582
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: navigate to create alert modal on create alert press
- Loading branch information
1 parent
3d5b0b1
commit 2a383ba
Showing
5 changed files
with
139 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/app/Components/Artist/ArtistArtworks/hooks/useCreateSavedSearchModalFilters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ScreenOwnerType } from "@artsy/cohesion" | ||
import { getUnitedSelectedAndAppliedFilters } from "app/Components/ArtworkFilter/ArtworkFilterHelpers" | ||
import { ArtworksFiltersStore } from "app/Components/ArtworkFilter/ArtworkFilterStore" | ||
import { getSearchCriteriaFromFilters } from "app/Components/ArtworkFilter/SavedSearch/searchCriteriaHelpers" | ||
import { SavedSearchEntity } from "app/Components/ArtworkFilter/SavedSearch/types" | ||
|
||
// A hook that returns the required props to be injected in order to use the CreateSavedSearchModal | ||
export const useCreateSavedSearchModalFilters = ({ | ||
entityId, | ||
entitySlug, | ||
entityName, | ||
entityOwnerType, | ||
}: { | ||
entityId: string | ||
entitySlug: string | ||
entityName: string | ||
entityOwnerType: ScreenOwnerType | ||
}) => { | ||
const savedSearchEntity: SavedSearchEntity = { | ||
artists: [{ id: entityId!, name: entityName! }], | ||
owner: { | ||
type: entityOwnerType, | ||
id: entityId!, | ||
slug: entitySlug!, | ||
}, | ||
} | ||
|
||
const filterState = ArtworksFiltersStore.useStoreState((state) => state) | ||
const unitedFilters = getUnitedSelectedAndAppliedFilters(filterState) | ||
const attributes = getSearchCriteriaFromFilters(savedSearchEntity, unitedFilters) | ||
|
||
return { | ||
attributes, | ||
savedSearchEntity, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters