-
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: add activity card for collector update notification (#10672)
* feat: add activity card for collector update notification * feat: address review requests * feat: cleanup and organization
- Loading branch information
1 parent
1b27a7c
commit cc7b21c
Showing
12 changed files
with
316 additions
and
128 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
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
19 changes: 19 additions & 0 deletions
19
src/app/Scenes/Activity/components/CollectorProfilePrompt.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,19 @@ | ||
import { MyProfileEditModal_me$key } from "__generated__/MyProfileEditModal_me.graphql" | ||
import { MyProfileEditModal } from "app/Scenes/MyProfile/MyProfileEditModal" | ||
import { FC } from "react" | ||
|
||
interface CompleteProfilePromptProps { | ||
me: MyProfileEditModal_me$key | ||
visible: boolean | ||
onDismiss: () => void | ||
} | ||
|
||
export const CollectorProfilePrompt: FC<CompleteProfilePromptProps> = ({ me, ...rest }) => { | ||
return ( | ||
<MyProfileEditModal | ||
me={me} | ||
message="Tell us a few more details about yourself to complete your profile." | ||
{...rest} | ||
/> | ||
) | ||
} |
99 changes: 99 additions & 0 deletions
99
src/app/Scenes/Activity/components/CollectorUpdateNotification.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,99 @@ | ||
import { Flex, Text, Touchable } from "@artsy/palette-mobile" | ||
import { CollectorUpdateNotification_item$key } from "__generated__/CollectorUpdateNotification_item.graphql" | ||
import { CollectorUpdateNotification_notification$key } from "__generated__/CollectorUpdateNotification_notification.graphql" | ||
import { MyCollectionBottomSheetModalArtistsPrompt } from "app/Scenes/MyCollection/Components/MyCollectionBottomSheetModals/MyCollectionBottomSheetModalArtistsPrompt" | ||
import { FC, useState } from "react" | ||
import { graphql, useFragment } from "react-relay" | ||
import { CollectorProfilePrompt } from "./CollectorProfilePrompt" | ||
|
||
interface CollectorUpdateNotificationProps { | ||
notification: CollectorUpdateNotification_notification$key | ||
item: CollectorUpdateNotification_item$key | ||
} | ||
|
||
export const CollectorUpdateNotification: FC<CollectorUpdateNotificationProps> = ({ | ||
notification: _notification, | ||
item: _item, | ||
}) => { | ||
const [promptVisible, setPromptVisible] = useState(false) | ||
const notification = useFragment(NOTIFICATION_FRAGMENT, _notification) | ||
const item = useFragment(ITEM_FRAGMENT, _item) | ||
|
||
if (!notification || !item) { | ||
return null | ||
} | ||
|
||
const hasEmptyCollection = | ||
item.me.myCollectionInfo.artworksCount === 0 && item.me.myCollectionInfo.artistsCount === 0 | ||
const itemInfo = hasEmptyCollection ? addArtistsToCollectiontInfo : collectorProfileInfo | ||
|
||
return ( | ||
<> | ||
<Touchable onPress={() => setPromptVisible(true)}> | ||
<Flex flex={1} py={2} pr={2}> | ||
<Text variant="sm-display" fontWeight={500}> | ||
{itemInfo.title} | ||
</Text> | ||
<Text variant="xs">{itemInfo.body}</Text> | ||
|
||
<Text variant="xs" fontWeight={500}> | ||
Artsy Message • | ||
<Text variant="xs" fontWeight="normal">{` ${notification.publishedAt}`}</Text> | ||
</Text> | ||
</Flex> | ||
</Touchable> | ||
|
||
{itemInfo.prompt === "AddArtistsToCollection" ? ( | ||
<MyCollectionBottomSheetModalArtistsPrompt | ||
title="Tell us about the artists in your collection." | ||
visible={promptVisible} | ||
onDismiss={() => setPromptVisible(true)} | ||
/> | ||
) : ( | ||
<CollectorProfilePrompt | ||
me={item.me} | ||
visible={promptVisible} | ||
onDismiss={() => setPromptVisible(true)} | ||
/> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
const NOTIFICATION_FRAGMENT = graphql` | ||
fragment CollectorUpdateNotification_notification on Notification { | ||
publishedAt(format: "RELATIVE") @required(action: NONE) | ||
} | ||
` | ||
|
||
const ITEM_FRAGMENT = graphql` | ||
fragment CollectorUpdateNotification_item on CollectorProfileUpdatePromptNotificationItem { | ||
me @required(action: NONE) { | ||
...MyProfileEditModal_me | ||
profession | ||
location { | ||
city | ||
} | ||
myCollectionInfo @required(action: NONE) { | ||
artistsCount | ||
artworksCount | ||
} | ||
} | ||
collectorProfile @required(action: NONE) { | ||
lastUpdatePromptAt | ||
} | ||
} | ||
` | ||
|
||
const addArtistsToCollectiontInfo = { | ||
title: "Tell us about the artists in your collection.", | ||
body: "Show off your collection and make a great impression.", | ||
prompt: "AddArtistsToCollection", | ||
} | ||
|
||
const collectorProfileInfo = { | ||
title: "Tell us a little bit more about you.", | ||
body: "By completing your profile, you’re more likely to receive quick responses from galleries.", | ||
prompt: "CollectorProfile", | ||
} |
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.