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(hack-15): activity panel notification for saved artwork price or availability changes #15115

Draft
wants to merge 1 commit 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
170 changes: 97 additions & 73 deletions data/schema.graphql

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/Components/Notifications/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type {
} from "__generated__/NotificationQuery.graphql"
import { Suspense, useEffect } from "react"
import { graphql, useLazyLoadQuery } from "react-relay"

import { SavedArtworkChangesNotification } from "./SavedArtworkChangesNotification"
const logger = createLogger("NotificationItem")

// FIXME: Should probably be a column span
Expand All @@ -40,6 +40,7 @@ export const SUPPORTED_NOTIFICATION_TYPES: NotificationTypesEnum[] = [
"VIEWING_ROOM_PUBLISHED",
"PARTNER_SHOW_OPENED",
"COLLECTOR_PROFILE_UPDATE_PROMPT",
"SAVED_ARTWORK_CHANGES",
]

interface NotificationProps {
Expand Down Expand Up @@ -122,6 +123,9 @@ const Notification: React.FC<React.PropsWithChildren<NotificationProps>> = ({
case "VIEWING_ROOM_PUBLISHED":
return <ViewingRoomPublishedNotification notification={notification} />

case "SAVED_ARTWORK_CHANGES":
return <SavedArtworkChangesNotification notification={notification} />

default:
return null
}
Expand Down Expand Up @@ -161,6 +165,7 @@ const notificationQuery = graphql`
...PartnerOfferCreatedNotification_notification
...PartnerShowOpenedNotification_notification
...ViewingRoomPublishedNotification_notification
...SavedArtworkChangesNotification_notification
id
internalID
notificationType
Expand Down
48 changes: 48 additions & 0 deletions src/Components/Notifications/SavedArtworkChangesNotification.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Spacer, Text } from "@artsy/palette"
import { NotificationArtworkList } from "Components/Notifications/NotificationArtworkList"
import { NotificationErrorMessage } from "Components/Notifications/NotificationErrorMessage"
import { NotificationTypeLabel } from "Components/Notifications/NotificationTypeLabel"
import type { SavedArtworkChangesNotification_notification$key } from "__generated__/SavedArtworkChangesNotification_notification.graphql"
import type { FC } from "react"
import { graphql, useFragment } from "react-relay"

interface SavedArtworkChangesNotificationProps {
notification: SavedArtworkChangesNotification_notification$key
}

export const SavedArtworkChangesNotification: FC<
React.PropsWithChildren<SavedArtworkChangesNotificationProps>
> = ({ notification }) => {
const notificationData = useFragment(
SavedArtworkChangesNotificationFragment,
notification,
)

const { artworksConnection, headline } = notificationData

return (
<>
<Text variant="lg-display">{headline}</Text>

<Spacer y={1} />

<NotificationTypeLabel notification={notificationData} />

<Spacer y={4} />

<NotificationArtworkList artworksConnection={artworksConnection} />
</>
)
}

export const SavedArtworkChangesNotificationFragment = graphql`
fragment SavedArtworkChangesNotification_notification on Notification {
artworksConnection(first: 10) {
...NotificationArtworkList_artworksConnection
totalCount
}
headline
notificationType
...NotificationTypeLabel_notification
}
`
4 changes: 2 additions & 2 deletions src/__generated__/AlertNotification_notification.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/__generated__/NotificationItem_notification.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/__generated__/NotificationItem_test_Query.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions src/__generated__/NotificationQuery.graphql.ts

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/__generated__/NotificationsListNextQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/__generated__/NotificationsListQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/__generated__/NotificationsList_test_Query.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/__generated__/NotificationsList_viewer.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.