From 2eb8ba2eacb38c9431711fc89d7299eedc50aad2 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 4 Jun 2024 17:33:24 -0700 Subject: [PATCH] add a notification type --- src/state/queries/notifications/types.ts | 3 ++- src/view/com/notifications/Feed.tsx | 32 ++++++++++++++++++++++++ src/view/com/notifications/FeedItem.tsx | 21 +++++++++++++++- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/state/queries/notifications/types.ts b/src/state/queries/notifications/types.ts index 812236cf06..3a9316050c 100644 --- a/src/state/queries/notifications/types.ts +++ b/src/state/queries/notifications/types.ts @@ -1,6 +1,6 @@ import { - AppBskyNotificationListNotifications, AppBskyFeedDefs, + AppBskyNotificationListNotifications, } from '@atproto/api' export type NotificationType = @@ -11,6 +11,7 @@ export type NotificationType = | 'reply' | 'quote' | 'follow' + | 'starter-pack-signup' | 'unknown' export interface FeedNotification { diff --git a/src/view/com/notifications/Feed.tsx b/src/view/com/notifications/Feed.tsx index c632ed5dc9..2f24ef274c 100644 --- a/src/view/com/notifications/Feed.tsx +++ b/src/view/com/notifications/Feed.tsx @@ -78,6 +78,38 @@ export function Feed({ } else { arr.push(LOADING_ITEM) } + + // TODO remove this temp plc + arr = [ + { + type: 'starter-pack-signup', + _reactKey: 'plc', + notification: { + uri: 'https://blueskyweb.xyz', + cid: 'abcdefg', + author: { + did: 'did:plc:temp', + handle: 'hailey alt', + avatar: undefined, + viewer: { + muted: false, + blockedBy: false, + }, + labels: [], + description: '', + indexedAt: '2024-05-27T21:52:22.554Z', + }, + reason: 'starter-pack-signup', + reasonSubject: 'at://did:plc:temp/app.bsky.starterpack/abcdefg', + record: {}, + isRead: true, + indexedAt: '2024-06-04T23:57:19.521Z', + labels: [], + }, + subjectUri: 'at://did:plc:temp/app.bsky.starterpack/abcdefg', + }, + ...arr, + ] return arr }, [isFetched, isError, isEmpty, data]) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index d6c38ea61c..0ad8ed89a5 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -51,6 +51,7 @@ import {TimeElapsed} from '../util/TimeElapsed' import {PreviewableUserAvatar, UserAvatar} from '../util/UserAvatar' import hairlineWidth = StyleSheet.hairlineWidth +import {StarterPackIcon} from '#/components/icons/StarterPackIcon' const MAX_AUTHORS = 5 @@ -92,6 +93,10 @@ let FeedItem = ({ const urip = new AtUri(item.subjectUri) return `/profile/${urip.host}/feed/${urip.rkey}` } + } else if (item.type === 'starter-pack-signup') { + // TODO create the right href for navigating to the starterpack + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const urip = '/' } return '' }, [item]) @@ -119,7 +124,12 @@ let FeedItem = ({ ] }, [item, moderationOpts]) - if (item.subjectUri && !item.subject && item.type !== 'feedgen-like') { + if ( + item.subjectUri && + !item.subject && + item.type !== 'feedgen-like' && + item.type !== 'starter-pack-signup' + ) { // don't render anything if the target post was deleted or unfindable return } @@ -174,6 +184,14 @@ let FeedItem = ({ icon = } else if (item.type === 'feedgen-like') { action = _(msg`liked your custom feed`) + } else if (item.type === 'starter-pack-signup') { + console.log('has one') + icon = ( + + + + ) + action = _(msg`signed up with your starter pack`) } else { return null } @@ -287,6 +305,7 @@ let FeedItem = ({ showLikes /> ) : null} + {item.type === 'starter-pack-signup' ? <> : null} )