rename item to message
This commit is contained in:
@@ -10,10 +10,10 @@ import {atoms as a, useTheme} from '#/alf'
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export function MessageItem({
|
export function MessageItem({
|
||||||
item,
|
message,
|
||||||
next,
|
next,
|
||||||
}: {
|
}: {
|
||||||
item: ChatBskyConvoDefs.MessageView
|
message: ChatBskyConvoDefs.MessageView
|
||||||
next:
|
next:
|
||||||
| ChatBskyConvoDefs.MessageView
|
| ChatBskyConvoDefs.MessageView
|
||||||
| ChatBskyConvoDefs.DeletedMessageView
|
| ChatBskyConvoDefs.DeletedMessageView
|
||||||
@@ -22,7 +22,7 @@ export function MessageItem({
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
|
|
||||||
const isFromSelf = item.sender?.did === currentAccount?.did
|
const isFromSelf = message.sender?.did === currentAccount?.did
|
||||||
|
|
||||||
const isNextFromSelf =
|
const isNextFromSelf =
|
||||||
ChatBskyConvoDefs.isMessageView(next) &&
|
ChatBskyConvoDefs.isMessageView(next) &&
|
||||||
@@ -36,7 +36,7 @@ export function MessageItem({
|
|||||||
|
|
||||||
// or, if there's a 10 minute gap between this message and the next
|
// or, if there's a 10 minute gap between this message and the next
|
||||||
if (ChatBskyConvoDefs.isMessageView(next)) {
|
if (ChatBskyConvoDefs.isMessageView(next)) {
|
||||||
const thisDate = new Date(item.sentAt)
|
const thisDate = new Date(message.sentAt)
|
||||||
const nextDate = new Date(next.sentAt)
|
const nextDate = new Date(next.sentAt)
|
||||||
|
|
||||||
const diff = nextDate.getTime() - thisDate.getTime()
|
const diff = nextDate.getTime() - thisDate.getTime()
|
||||||
@@ -46,7 +46,7 @@ export function MessageItem({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}, [item, next, isFromSelf, isNextFromSelf])
|
}, [message, next, isFromSelf, isNextFromSelf])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
@@ -74,11 +74,11 @@ export function MessageItem({
|
|||||||
a.leading_snug,
|
a.leading_snug,
|
||||||
isFromSelf && {color: t.palette.white},
|
isFromSelf && {color: t.palette.white},
|
||||||
]}>
|
]}>
|
||||||
{item.text}
|
{message.text}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Metadata
|
<Metadata
|
||||||
message={item}
|
message={message}
|
||||||
isLastInGroup={isLastInGroup}
|
isLastInGroup={isLastInGroup}
|
||||||
style={isFromSelf ? a.text_right : a.text_left}
|
style={isFromSelf ? a.text_right : a.text_left}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function MaybeLoader({isLoading}: {isLoading: boolean}) {
|
|||||||
|
|
||||||
function renderItem({item}: {item: ConvoItem}) {
|
function renderItem({item}: {item: ConvoItem}) {
|
||||||
if (item.type === 'message') {
|
if (item.type === 'message') {
|
||||||
return <MessageItem item={item.message} next={item.nextMessage} />
|
return <MessageItem message={item.message} next={item.nextMessage} />
|
||||||
} else if (item.type === 'deleted-message') {
|
} else if (item.type === 'deleted-message') {
|
||||||
return <Text>Deleted message</Text>
|
return <Text>Deleted message</Text>
|
||||||
} else if (item.type === 'pending-message') {
|
} else if (item.type === 'pending-message') {
|
||||||
|
|||||||
Reference in New Issue
Block a user