-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Inline price control create alert (#8835)
* inline price control create alert * update * revert podlock file * new screen * with Edit Alert flow * price update * remove section * updated with PR * AlertPriceRangeScreen to AlertPriceRange
- Loading branch information
Sam Raj
authored
Jun 20, 2023
1 parent
50465dc
commit 707a3b4
Showing
9 changed files
with
316 additions
and
93 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
63 changes: 40 additions & 23 deletions
63
src/app/Scenes/SavedSearchAlert/CreateSavedSearchAlert.tsx
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 |
---|---|---|
@@ -1,41 +1,58 @@ | ||
import { Box } from "@artsy/palette-mobile" | ||
import { NavigationContainer } from "@react-navigation/native" | ||
import { createStackNavigator, TransitionPresets } from "@react-navigation/stack" | ||
import { SearchCriteriaAttributes } from "app/Components/ArtworkFilter/SavedSearch/types" | ||
import { FancyModal } from "app/Components/FancyModal/FancyModal" | ||
import { | ||
savedSearchModel, | ||
SavedSearchStoreProvider, | ||
} from "app/Scenes/SavedSearchAlert/SavedSearchStore" | ||
import { CreateSavedSearchAlertContentQueryRenderer } from "app/Scenes/SavedSearchAlert/containers/CreateSavedSearchContentContainer" | ||
import { AlertPriceRangeScreen } from "app/Scenes/SavedSearchAlert/screens/AlertPriceRangeScreen" | ||
import { | ||
CreateSavedSearchAlertNavigationStack, | ||
CreateSavedSearchAlertProps, | ||
} from "./SavedSearchAlertModel" | ||
import { CreateSavedSearchAlertScreen } from "./screens/CreateSavedSearchAlertScreen" | ||
import { EmailPreferencesScreen } from "./screens/EmailPreferencesScreen" | ||
|
||
const Stack = createStackNavigator<CreateSavedSearchAlertNavigationStack>() | ||
|
||
export const CreateSavedSearchAlert: React.FC<CreateSavedSearchAlertProps> = (props) => { | ||
const { visible, params } = props | ||
const { attributes, aggregations, entity } = params | ||
|
||
return ( | ||
<NavigationContainer independent> | ||
<FancyModal visible={visible} fullScreen> | ||
<Box flex={1}> | ||
<Stack.Navigator | ||
// force it to not use react-native-screens, which is broken inside a react-native Modal for some reason | ||
detachInactiveScreens={false} | ||
screenOptions={{ | ||
...TransitionPresets.SlideFromRightIOS, | ||
headerShown: false, | ||
cardStyle: { backgroundColor: "white" }, | ||
}} | ||
> | ||
<Stack.Screen | ||
name="CreateSavedSearchAlert" | ||
component={CreateSavedSearchAlertScreen} | ||
initialParams={params} | ||
/> | ||
<Stack.Screen name="EmailPreferences" component={EmailPreferencesScreen} /> | ||
</Stack.Navigator> | ||
</Box> | ||
</FancyModal> | ||
</NavigationContainer> | ||
<SavedSearchStoreProvider | ||
runtimeModel={{ | ||
...savedSearchModel, | ||
attributes: attributes as SearchCriteriaAttributes, | ||
aggregations, | ||
entity, | ||
}} | ||
> | ||
<NavigationContainer independent> | ||
<FancyModal visible={visible} fullScreen> | ||
<Box flex={1}> | ||
<Stack.Navigator | ||
// force it to not use react-native-screens, which is broken inside a react-native Modal for some reason | ||
detachInactiveScreens={false} | ||
screenOptions={{ | ||
...TransitionPresets.SlideFromRightIOS, | ||
headerShown: false, | ||
cardStyle: { backgroundColor: "white" }, | ||
}} | ||
> | ||
<Stack.Screen | ||
name="CreateSavedSearchAlert" | ||
component={CreateSavedSearchAlertContentQueryRenderer} | ||
initialParams={params} | ||
/> | ||
<Stack.Screen name="EmailPreferences" component={EmailPreferencesScreen} /> | ||
<Stack.Screen name="AlertPriceRange" component={AlertPriceRangeScreen} /> | ||
</Stack.Navigator> | ||
</Box> | ||
</FancyModal> | ||
</NavigationContainer> | ||
</SavedSearchStoreProvider> | ||
) | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/app/Scenes/SavedSearchAlert/EditSavedSearchAlertContent.tsx
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,27 @@ | ||
import { RouteProp, useRoute } from "@react-navigation/native" | ||
import { PageWithSimpleHeader } from "app/Components/PageWithSimpleHeader" | ||
import { SavedSearchAlertForm } from "app/Scenes/SavedSearchAlert/SavedSearchAlertForm" | ||
import { EditSavedSearchAlertNavigationStack } from "app/Scenes/SavedSearchAlert/SavedSearchAlertModel" | ||
|
||
export const EditSavedSearchAlertContent = () => { | ||
const route = | ||
useRoute<RouteProp<EditSavedSearchAlertNavigationStack, "EditSavedSearchAlertContent">>() | ||
const { userAlertSettings, savedSearchAlertId, userAllowsEmails, onComplete, onDeleteComplete } = | ||
route.params | ||
|
||
return ( | ||
<PageWithSimpleHeader title="Edit your Alert"> | ||
<SavedSearchAlertForm | ||
initialValues={{ | ||
name: userAlertSettings?.name ?? "", | ||
email: userAlertSettings?.email ?? false, | ||
push: userAlertSettings?.push ?? false, | ||
}} | ||
savedSearchAlertId={savedSearchAlertId} | ||
userAllowsEmails={userAllowsEmails} | ||
onComplete={onComplete} | ||
onDeleteComplete={onDeleteComplete} | ||
/> | ||
</PageWithSimpleHeader> | ||
) | ||
} |
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
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
Oops, something went wrong.