2018-09-11 16:32:52 +00:00
import React from 'react' ;
2022-08-19 19:53:40 +00:00
import { ScrollView } from 'react-native' ;
import { NavigationContainer } from '@react-navigation/native' ;
2018-09-11 16:32:52 +00:00
2022-08-19 19:53:40 +00:00
import MessageComponent from './Message' ;
import { E2E_MESSAGE_TYPE , messagesStatus , themes } from '../../lib/constants' ;
import MessageSeparator from '../../views/RoomView/Separator' ;
import MessageContext from './Context' ;
2019-12-04 16:39:53 +00:00
2021-04-19 16:57:19 +00:00
const _theme = 'light' ;
2019-12-04 16:39:53 +00:00
2018-09-11 16:32:52 +00:00
const user = {
id : 'y8bd77ptZswPj3EW8' ,
username : 'diego.mello' ,
2022-08-19 19:53:40 +00:00
token : 'abc'
2018-09-11 16:32:52 +00:00
} ;
const author = {
_id : 'userid' ,
username : 'diego.mello'
} ;
2022-05-27 17:27:43 +00:00
const longNameAuthor = {
_id : 'userid' ,
username : 'Long name user looooong name user'
} ;
2018-09-11 16:32:52 +00:00
const baseUrl = 'https://open.rocket.chat' ;
const date = new Date ( 2017 , 10 , 10 , 10 ) ;
2021-09-13 20:41:05 +00:00
const longText =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ;
2018-09-11 16:32:52 +00:00
2022-08-19 19:53:40 +00:00
const getCustomEmoji = ( content : string ) = > {
2019-05-20 20:43:50 +00:00
const customEmoji = {
marioparty : { name : content , extension : 'gif' } ,
react_rocket : { name : content , extension : 'png' } ,
nyan_rocket : { name : content , extension : 'png' }
} [ content ] ;
return customEmoji ;
} ;
2022-08-19 19:53:40 +00:00
export default {
title : 'Message' ,
decorators : [
( Story : any ) = > (
< NavigationContainer >
< ScrollView style = { { backgroundColor : themes [ _theme ] . backgroundColor } } >
< MessageContext.Provider
value = { {
user ,
baseUrl ,
onPress : ( ) = > { } ,
onLongPress : ( ) = > { } ,
reactionInit : ( ) = > { } ,
onErrorPress : ( ) = > { } ,
replyBroadcast : ( ) = > { } ,
onReactionPress : ( ) = > { } ,
onDiscussionPress : ( ) = > { } ,
onReactionLongPress : ( ) = > { } ,
threadBadgeColor : themes.light.tunreadColor
} }
>
< Story / >
< / MessageContext.Provider >
< / ScrollView >
< / NavigationContainer >
)
]
} ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Message = ( props : any ) = > (
2020-05-18 16:25:13 +00:00
< MessageComponent
baseUrl = { baseUrl }
user = { user }
author = { author }
ts = { date }
timeFormat = 'LT'
isHeader
getCustomEmoji = { getCustomEmoji }
theme = { _theme }
{ . . . props }
/ >
2018-09-11 16:32:52 +00:00
) ;
2022-08-19 19:53:40 +00:00
export const Basic = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = 'Message' / >
< Message msg = { longText } / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const GroupedMessages = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = '...' / >
< Message
msg = 'Different user'
author = { {
. . . author ,
username : longText
} }
/ >
< Message msg = 'This is the third message' isHeader = { false } / >
< Message msg = 'This is the second message' isHeader = { false } / >
< Message msg = 'This is the first message' / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithoutHeader = ( ) = > < Message msg = 'Message' isHeader = { false } / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithAlias = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = 'Message' alias = 'Diego Mello' / >
< Message
msg = 'Message'
author = { {
. . . author ,
username : longText
} }
alias = 'Diego Mello'
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Edited = ( ) = > (
2022-05-10 17:40:08 +00:00
< >
< Message msg = 'Message header' isEdited / >
< Message msg = 'Message without header' isEdited isHeader = { false } / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Encrypted = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message msg = 'Message' type = 'e2e' / >
< Message msg = 'Message Encrypted without Header' isHeader = { false } type = 'e2e' / >
2021-04-19 16:57:19 +00:00
< Message
msg = 'Message Encrypted with Reactions'
2021-09-13 20:41:05 +00:00
reactions = { [
{
emoji : ':joy:' ,
usernames : [ user . username ]
} ,
{
emoji : ':marioparty:' ,
usernames : [ user . username ]
} ,
{
emoji : ':thinking:' ,
usernames : [ user . username ]
}
] }
2021-04-19 16:57:19 +00:00
onReactionPress = { ( ) = > { } }
type = 'e2e'
/ >
2021-09-13 20:41:05 +00:00
< Message msg = 'Thread reply encrypted' tmid = '1' tmsg = 'Thread with emoji :) :joy:' isThreadReply type = 'e2e' / >
< Message msg = 'Temp message encrypted' status = { messagesStatus . TEMP } isTemp type = 'e2e' / >
< Message msg = 'Message Edited encrypted' edited type = 'e2e' / >
2021-04-19 16:57:19 +00:00
< Message
hasError
msg = 'This message has error and is encrypted'
status = { messagesStatus . ERROR }
onErrorPress = { ( ) = > alert ( 'Error pressed' ) }
type = 'e2e'
/ >
2021-09-13 20:41:05 +00:00
< Message msg = 'Read Receipt encrypted with Header' isReadReceiptEnabled read type = 'e2e' / >
< Message msg = 'Read Receipt encrypted without Header' isReadReceiptEnabled read isHeader = { false } type = 'e2e' / >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const BlockQuote = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = '> Testing block quote' / >
< Message msg = { '> Testing block quote\nTesting block quote' } / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Lists = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = { '* Dogs\n * cats\n - cats' } / >
< Message msg = { '1. Dogs \n 2. Cats' } / >
< Message msg = '1. Dogs' / >
< Message msg = '2. Cats' isHeader = { false } / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const StaticAvatar = ( ) = > (
2021-09-13 20:41:05 +00:00
< Message msg = 'Message' avatar = 'https://pbs.twimg.com/profile_images/1016397063649660929/14EIApTi_400x400.jpg' / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const FullName = ( ) = > (
2021-04-19 16:57:19 +00:00
< Message
msg = 'Message'
author = { {
. . . author ,
username : 'diego.mello' ,
name : 'Diego Mello'
} }
useRealName
/ >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Mentions = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
msg = '@rocket.cat @diego.mello @all @here #general'
2021-09-13 20:41:05 +00:00
mentions = { [
{
username : 'rocket.cat'
} ,
{
username : 'diego.mello'
} ,
{
username : 'all'
} ,
{
username : 'here'
}
] }
channels = { [
{
name : 'general'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message
msg = '@rocket.cat Lorem ipsum dolor @diego.mello sit amet, @all consectetur adipiscing @here elit, sed do eiusmod tempor #general incididunt ut labore et dolore magna aliqua.'
2021-09-13 20:41:05 +00:00
mentions = { [
{
username : 'rocket.cat'
} ,
{
username : 'diego.mello'
} ,
{
username : 'all'
} ,
{
username : 'here'
}
] }
channels = { [
{
name : 'general'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Emojis = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message msg = '👊🤙👏' / >
< Message msg = '👏' / >
< Message msg = ':react_rocket: :nyan_rocket: :marioparty:' / >
< Message msg = ':react_rocket:' / >
< Message msg = '🤙:react_rocket:' / >
< Message msg = '🤙:react_rocket:🤙🤙' / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const TimeFormat = ( ) = > < Message msg = 'Testing' timeFormat = 'DD MMMM YYYY' / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Reactions = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
msg = 'Reactions'
2021-09-13 20:41:05 +00:00
reactions = { [
{
emoji : ':joy:' ,
usernames : [ user . username ]
} ,
{
emoji : ':marioparty:' ,
usernames : new Array ( 99 )
} ,
{
emoji : ':thinking:' ,
usernames : new Array ( 999 )
} ,
{
emoji : ':thinking:' ,
usernames : new Array ( 9999 )
}
] }
2021-04-19 16:57:19 +00:00
onReactionPress = { ( ) = > { } }
/ >
< Message
msg = 'Multiple Reactions'
2021-09-13 20:41:05 +00:00
reactions = { [
{
emoji : ':marioparty:' ,
usernames : [ user . username ]
} ,
{
emoji : ':react_rocket:' ,
usernames : [ user . username ]
} ,
{
emoji : ':nyan_rocket:' ,
usernames : [ user . username ]
} ,
{
emoji : ':heart:' ,
usernames : [ user . username ]
} ,
{
emoji : ':dog:' ,
usernames : [ user . username ]
} ,
{
emoji : ':grinning:' ,
usernames : [ user . username ]
} ,
{
emoji : ':grimacing:' ,
usernames : [ user . username ]
} ,
{
emoji : ':grin:' ,
usernames : [ user . username ]
}
] }
2021-04-19 16:57:19 +00:00
onReactionPress = { ( ) = > { } }
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const DateAndUnreadSeparators = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
msg = 'Fourth message'
author = { {
. . . author ,
username : 'rocket.cat'
} }
/ >
2022-08-19 19:53:40 +00:00
< MessageSeparator ts = { date } unread / >
2021-04-19 16:57:19 +00:00
< Message msg = 'Third message' / >
2022-08-19 19:53:40 +00:00
< MessageSeparator unread ts = { null } / >
2021-04-19 16:57:19 +00:00
< Message
msg = 'Second message'
author = { {
. . . author ,
username : 'rocket.cat'
} }
isHeader = { false }
/ >
< Message
msg = 'Second message'
author = { {
. . . author ,
username : 'rocket.cat'
} }
/ >
2022-08-19 19:53:40 +00:00
< MessageSeparator ts = { date } unread = { false } / >
2021-04-19 16:57:19 +00:00
< Message msg = 'First message' / >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithImage = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description' ,
image_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description :nyan_rocket:' ,
image_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithVideo = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description :nyan_rocket:' ,
video_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
video_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithAudio = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description :nyan_rocket:' ,
audio_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message msg = 'First message' isHeader = { false } / >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description' ,
audio_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
isHeader = { false }
/ >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
audio_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
isHeader = { false }
/ >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
audio_url : '/dummypath'
}
] }
2021-04-19 16:57:19 +00:00
isHeader = { false }
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const WithFile = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
text : 'File.pdf' ,
description : 'This is a description :nyan_rocket:'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
text : 'File.pdf' ,
description : 'This is a description :nyan_rocket:'
}
] }
2021-04-19 16:57:19 +00:00
isHeader = { false }
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const MessageWithReply = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
msg = "I'm fine!"
2021-09-13 20:41:05 +00:00
attachments = { [
{
author_name : "I'm a very long long title and I'll break" ,
ts : date ,
timeFormat : 'LT' ,
text : 'How are you?'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message
msg = "I'm fine!"
2021-09-13 20:41:05 +00:00
attachments = { [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'How are you? :nyan_rocket:'
}
] }
2021-04-19 16:57:19 +00:00
/ >
2022-03-21 20:44:06 +00:00
< Message
msg = 'Looks cool!'
attachments = { [
{
author_name : 'rocket.cat' ,
attachments : [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
description : 'What you think about this one?' ,
image_url : 'https://octodex.github.com/images/yaktocat.png'
}
] ,
text : ''
}
] }
/ >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const MessageWithReadReceipt = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message msg = "I'm fine!" isReadReceiptEnabled unread / >
< Message msg = "I'm fine!" isReadReceiptEnabled unread isHeader = { false } / >
< Message msg = "I'm fine!" isReadReceiptEnabled read / >
< Message msg = "I'm fine!" isReadReceiptEnabled read isHeader = { false } / >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const MessageWithThread = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message msg = 'How are you?' tcount = { 1 } tlm = { date } / >
< Message msg = "I'm fine!" tmid = '1' tmsg = 'How are you?' isThreadReply / >
< Message msg = "I'm fine!" tmid = '1' tmsg = 'Thread with emoji :) :joy:' isThreadReply / >
< Message msg = "I'm fine!" tmid = '1' tmsg = { longText } isThreadReply / >
< Message msg = { longText } tmid = '1' tmsg = 'How are you?' isThreadReply / >
< Message msg = { longText } tmid = '1' tmsg = { longText } isThreadReply / >
2021-04-19 16:57:19 +00:00
< Message
tmid = '1'
tmsg = 'Thread with attachment'
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description :nyan_rocket:' ,
audio_url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
}
] }
2021-04-19 16:57:19 +00:00
isThreadReply
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const SequentialThreadMessagesFollowingThreadButton = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message msg = 'How are you?' tcount = { 1 } tlm = { date } / >
< Message msg = "I'm fine!" tmid = '1' isThreadSequential / >
< Message msg = { longText } tmid = '1' isThreadSequential / >
2021-04-19 16:57:19 +00:00
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description' ,
audio_url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
}
] }
2021-04-19 16:57:19 +00:00
tmid = '1'
isThreadSequential
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const SequentialThreadMessagesFollowingThreadReply = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message msg = "I'm fine!" tmid = '1' tmsg = 'How are you?' isThreadReply / >
< Message msg = 'Cool!' tmid = '1' isThreadSequential / >
< Message msg = { longText } tmid = '1' isThreadSequential / >
2021-04-19 16:57:19 +00:00
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
title : 'This is a title' ,
description : 'This is a description' ,
audio_url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
}
] }
2021-04-19 16:57:19 +00:00
tmid = '1'
isThreadSequential
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Discussion = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
2021-09-13 20:41:05 +00:00
< Message type = 'discussion-created' drid = 'aisduhasidhs' dcount = { null } dlm = { null } msg = 'This is a discussion' / >
< Message type = 'discussion-created' drid = 'aisduhasidhs' dcount = { 1 } dlm = { date } msg = 'This is a discussion' / >
< Message type = 'discussion-created' drid = 'aisduhasidhs' dcount = { 10 } dlm = { date } msg = { longText } / >
< Message type = 'discussion-created' drid = 'aisduhasidhs' dcount = { 1000 } dlm = { date } msg = 'This is a discussion' / >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const URL = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
2021-09-13 20:41:05 +00:00
urls = { [
{
url : 'https://rocket.chat' ,
image : 'https://rocket.chat/images/blog/post.jpg' ,
title : 'Rocket.Chat - Free, Open Source, Enterprise Team Chat' ,
description :
'Rocket.Chat is the leading open source team chat software solution. Free, unlimited and completely customizable with on-premises and SaaS cloud hosting.'
} ,
{
url : 'https://google.com' ,
title : 'Google' ,
description :
"Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
}
] }
/ >
< Message
urls = { [
{
url : 'https://google.com' ,
title : 'Google' ,
description :
"Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
}
] }
2021-04-19 16:57:19 +00:00
msg = 'Message :nyan_rocket:'
/ >
< Message
2021-09-13 20:41:05 +00:00
urls = { [
{
url : 'https://google.com' ,
title : 'Google' ,
description :
"Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
}
] }
2021-04-19 16:57:19 +00:00
isHeader = { false }
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const CustomFields = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message
msg = 'Message'
2021-09-13 20:41:05 +00:00
attachments = { [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1'
} ,
{
title : 'Field 2' ,
value : 'Value 2'
} ,
{
title : 'Field 3' ,
value : 'Value 3'
} ,
{
title : 'Field 4' ,
value : 'Value 4'
} ,
{
title : 'Field 5' ,
value : 'Value 5'
}
]
}
] }
2021-04-19 16:57:19 +00:00
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const TwoShortCustomFieldsWithMarkdown = ( ) = > (
2021-04-19 16:57:19 +00:00
< Message
msg = 'Message'
2021-09-13 20:41:05 +00:00
attachments = { [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} ,
{
title : 'Field 2' ,
value : '[Value 2](https://google.com/)' ,
short : true
}
]
} ,
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields 2' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} ,
{
title : 'Field 2' ,
value : '**Value 2**' ,
short : true
}
]
}
] }
2021-04-19 16:57:19 +00:00
/ >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const ColoredAttachments = ( ) = > (
2021-04-19 16:57:19 +00:00
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
color : 'red' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} ,
{
title : 'Field 2' ,
value : 'Value 2' ,
short : true
}
]
} ,
{
color : 'green' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} ,
{
title : 'Field 2' ,
value : 'Value 2' ,
short : true
}
]
} ,
{
color : 'blue' ,
fields : [
{
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} ,
{
title : 'Field 2' ,
value : 'Value 2' ,
short : true
}
]
}
] }
2021-04-19 16:57:19 +00:00
/ >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Broadcast = ( ) = > < Message msg = 'Broadcasted message' broadcast replyBroadcast = { ( ) = > alert ( 'broadcast!' ) } / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Archived = ( ) = > < Message msg = 'This message is inside an archived room' archived / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Error = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message hasError msg = 'This message has error' status = { messagesStatus . ERROR } onErrorPress = { ( ) = > alert ( 'Error pressed' ) } / >
2021-09-13 20:41:05 +00:00
< Message
hasError
msg = 'This message has error too'
status = { messagesStatus . ERROR }
onErrorPress = { ( ) = > alert ( 'Error pressed' ) }
isHeader = { false }
/ >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Temp = ( ) = > < Message msg = 'Temp message' status = { messagesStatus . TEMP } isTemp / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Editing = ( ) = > < Message msg = 'Message being edited' editing / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const SystemMessages = ( ) = > (
2021-04-19 16:57:19 +00:00
< >
< Message type = 'rm' isInfo / >
< Message type = 'uj' isInfo / >
< Message
msg = 'New name'
type = 'message_pinned'
isInfo
2021-09-13 20:41:05 +00:00
attachments = { [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'First message'
}
] }
2021-04-19 16:57:19 +00:00
/ >
< Message type = 'ul' isInfo / >
< Message msg = 'rocket.cat' type = 'ru' isInfo / >
< Message msg = 'rocket.cat' type = 'au' isInfo / >
< Message msg = 'rocket.cat' type = 'user-muted' isInfo / >
< Message msg = 'rocket.cat' type = 'user-unmuted' isInfo / >
2021-09-13 20:41:05 +00:00
< Message msg = 'rocket.cat' role = 'admin' type = 'subscription-role-added' isInfo / >
< Message msg = 'rocket.cat' role = 'admin' type = 'subscription-role-removed' isInfo / >
2021-04-19 16:57:19 +00:00
< Message msg = 'New name' type = 'r' isInfo / >
< Message msg = 'new description' type = 'room_changed_description' isInfo / >
< Message msg = 'new announcement' type = 'room_changed_announcement' isInfo / >
< Message msg = 'new topic' type = 'room_changed_topic' isInfo / >
< Message msg = 'public' type = 'room_changed_privacy' isInfo / >
< Message type = 'room_e2e_disabled' isInfo / >
< Message type = 'room_e2e_enabled' isInfo / >
2022-02-23 20:31:14 +00:00
< Message type = 'removed-user-from-team' isInfo / >
< Message type = 'added-user-to-team' isInfo / >
< Message type = 'user-added-room-to-team' isInfo msg = 'channel-name' / >
< Message type = 'user-converted-to-team' isInfo msg = 'channel-name' / >
< Message type = 'user-converted-to-channel' isInfo msg = 'channel-name' / >
< Message type = 'user-deleted-room-from-team' isInfo msg = 'channel-name' / >
< Message type = 'user-removed-room-from-team' isInfo msg = 'channel-name' / >
2021-04-19 16:57:19 +00:00
< / >
2022-08-19 19:53:40 +00:00
) ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const Ignored = ( ) = > < Message isIgnored / > ;
2021-04-19 16:57:19 +00:00
2022-08-19 19:53:40 +00:00
export const CustomStyle = ( ) = > < Message msg = 'Message' style = { [ { backgroundColor : '#ddd' } ] } / > ;
2021-08-27 14:07:16 +00:00
2022-08-19 19:53:40 +00:00
export const ShowButtonAsAttachment = ( ) = > (
2021-08-27 16:29:34 +00:00
< Message
2021-09-13 20:41:05 +00:00
attachments = { [
{
text : 'Test Button' ,
actions : [
{
type : 'button' ,
text : 'Text button' ,
msg : 'Response message' ,
msg_in_chat_window : true
}
]
}
] }
2021-08-27 16:29:34 +00:00
/ >
2022-08-19 19:53:40 +00:00
) ;
2021-08-27 16:29:34 +00:00
2022-08-19 19:53:40 +00:00
export const ThumbnailFromServer = ( ) = > (
2021-08-27 14:07:16 +00:00
< Message
msg = 'this is a thumbnail'
2021-09-13 20:41:05 +00:00
attachments = { [
{
text : 'Image text' ,
thumb_url : 'https://images-na.ssl-images-amazon.com/images/I/71jKxPAMFbL._AC_SL1500_.jpg' ,
title : 'Title' ,
title_link : 'https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/2975'
}
] }
2021-08-27 14:07:16 +00:00
/ >
2022-08-19 19:53:40 +00:00
) ;
2022-05-27 17:27:43 +00:00
2022-08-19 19:53:40 +00:00
export const LongNameUser = ( ) = > (
2022-05-27 17:27:43 +00:00
< >
< Message msg = { 'this is a normal message' } author = { longNameAuthor } / >
< Message msg = { 'Edited message' } author = { longNameAuthor } isEdited / >
< Message msg = { 'Encrypted message' } author = { longNameAuthor } type = { E2E_MESSAGE_TYPE } / >
< Message msg = { 'Error message' } author = { longNameAuthor } hasError / >
< Message msg = { 'Message with read receipt' } author = { longNameAuthor } isReadReceiptEnabled read / >
< Message msg = { 'Message with read receipt' } author = { longNameAuthor } isReadReceiptEnabled read type = { E2E_MESSAGE_TYPE } / >
< Message
msg = { 'Show all icons ' }
author = { longNameAuthor }
isEdited
type = { E2E_MESSAGE_TYPE }
hasError
isReadReceiptEnabled
read
/ >
< Message
msg = { longText }
author = { longNameAuthor }
isHeader = { false }
isEdited
type = { E2E_MESSAGE_TYPE }
hasError
isReadReceiptEnabled
read
/ >
< Message
msg = 'small message'
author = { longNameAuthor }
isHeader = { false }
isEdited
type = { E2E_MESSAGE_TYPE }
hasError
isReadReceiptEnabled
read
/ >
< / >
2022-08-19 19:53:40 +00:00
) ;