add a notification type

This commit is contained in:
Hailey
2024-06-04 17:33:24 -07:00
parent 1c28bf47f2
commit 2eb8ba2eac
3 changed files with 54 additions and 2 deletions
+2 -1
View File
@@ -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 {
+32
View File
@@ -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])
+20 -1
View File
@@ -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 <View />
}
@@ -174,6 +184,14 @@ let FeedItem = ({
icon = <PersonPlusIcon size="xl" style={{color: t.palette.primary_500}} />
} else if (item.type === 'feedgen-like') {
action = _(msg`liked your custom feed`)
} else if (item.type === 'starter-pack-signup') {
console.log('has one')
icon = (
<View style={{height: 30, width: 30}}>
<StarterPackIcon />
</View>
)
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}
</View>
</Link>
)