2023-11-04 10:14:00 +01:00
|
|
|
import { Entity, MegalodonInterface } from 'megalodon'
|
|
|
|
import Status from '../status/Status'
|
|
|
|
import Reaction from './Reaction'
|
|
|
|
import Follow from './Follow'
|
2023-12-11 16:00:44 +01:00
|
|
|
import { Account } from '@/db'
|
2023-11-04 10:14:00 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
notification: Entity.Notification
|
2023-12-11 16:00:44 +01:00
|
|
|
account: Account
|
2023-11-04 10:14:00 +01:00
|
|
|
client: MegalodonInterface
|
|
|
|
onRefresh: (status: Entity.Status) => void
|
2024-03-09 07:00:27 +01:00
|
|
|
openMedia: (media: Array<Entity.Attachment>, index: number) => void
|
2024-02-27 12:49:27 +01:00
|
|
|
filters: Array<Entity.Filter>
|
2023-11-04 10:14:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function Notification(props: Props) {
|
|
|
|
switch (props.notification.type) {
|
|
|
|
case 'mention': {
|
|
|
|
if (props.notification.status) {
|
2023-12-11 16:00:44 +01:00
|
|
|
return (
|
|
|
|
<Status
|
|
|
|
account={props.account}
|
|
|
|
client={props.client}
|
|
|
|
status={props.notification.status}
|
|
|
|
onRefresh={props.onRefresh}
|
|
|
|
openMedia={props.openMedia}
|
2024-02-27 12:49:27 +01:00
|
|
|
filters={props.filters}
|
2023-12-11 16:00:44 +01:00
|
|
|
/>
|
|
|
|
)
|
2023-11-04 10:14:00 +01:00
|
|
|
} else {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 'favourite':
|
|
|
|
case 'reblog':
|
|
|
|
case 'poll_expired':
|
|
|
|
case 'poll_vote':
|
|
|
|
case 'quote':
|
|
|
|
case 'status':
|
|
|
|
case 'update':
|
|
|
|
case 'emoji_reaction':
|
|
|
|
case 'reaction': {
|
|
|
|
if (props.notification.status) {
|
2024-08-30 16:53:32 +02:00
|
|
|
return (
|
|
|
|
<Reaction
|
|
|
|
client={props.client}
|
|
|
|
notification={props.notification}
|
|
|
|
onRefresh={props.onRefresh}
|
|
|
|
openMedia={props.openMedia}
|
|
|
|
account={props.account}
|
|
|
|
/>
|
|
|
|
)
|
2023-11-04 10:14:00 +01:00
|
|
|
} else {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 'follow':
|
|
|
|
case 'follow_request':
|
|
|
|
return <Follow notification={props.notification} />
|
|
|
|
|
|
|
|
default: {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|