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
2023-10-11 14:23:11 +00:00
const base64 =
' data :image / png ; base64 , iVBORw0KGgoAAAANSUhEUgAAAKkAAADcCAIAAACEWBYKAAAAA3NCSVQICAjb4U / gAAAgAElEQVR4nO29aZAc13WoeXOtrMza967qHd1ooAGRBLQNTcnUxmHMmPo3CjvGEdZo7PAP / fDzs2fscbw / Hr14EYrwNhMeWZbMkCY0YZJiaB4FkwxRFkiAIgACDZAAutFbVXft + 55 Vua / z40g9EJaWWN0Al8rvR0d1Va735M177jnnnoPZto0cxhL8 / b4Ah / cNR / bjiyP78cWR / fjiyH58cWQ / vjiyH18c2Y8vjuzHF0f244sj + / H F k f 3 4 4 s h + f H F k P 7 6 M L n t L k g / x O h w e P i P K 3 p K V 0 v L T p f / + f x y 8 f p 4 / e 0 7 e 2 P p N 9 l J 3 c 3 d + s 5 P 9 l c O K k t 5 q 3 7 G N 3 m y Z o j j a d T r s w 4 i y x 9 0 M 8 z 8 / 4 / u T r z H H l t h H H z F F q f Y f / 5 M l K w g h J Z s X L l + 1 V W 3 w x p v C 2 y s I I b 3 V 7 r 3 0 s l 6 r i + d + r t U b l i C K 1 2 8 O L 1 1 B C H W + + X / q 3 R 5 C S N 7 c 7 r / 6 m l a t D V 7 5 6 f D C 2 w g h r V L l f 3 Z O 3 k o r O 9 n + S 6 8 c 2 h 0 7 / J I R Z a + V K + z n n m A / c Z r w c M g y q U g o / l / + U / c H z y O E h L P n y V C w 9 9 K / u e b n M I o a n n u r + 5 3 / O / D f P Y X R t J 4 t C u f e U k t l Z e V d Y y c 3 f H u F P L 5 I h Y J 6 r S F d u + 7 7 / J P I s n G f B 1 m 2 c P l a / / n / 1 / v E f 8 N / / 3 k M x 1 3 H j h 7 q X T s g N L L s M Z J E N k K 6 g T A M v k A 2 w m g a I Y Q s i z l 6 B C P J X 5 4 B Q x i y b Y Q s G 6 N p S x B s X c d D Q f a 3 P s U u H 0 e 6 Y a u a 0 e 0 i h B C y b d M g k x P U R N z W N I R h C M O Q b S P L w u H I D o c K N n K 8 X v O b / 0 f s f / t T t V T B X b R a L I m v v R H 7 i / + A 0 Z S y l X Y t H s E I Y v D G m 7 j b 7 X n 8 U 3 q r L V 6 6 w j 3 + K W s w x L 0 e D C e U Q s H s 9 P x P f 1 G 8 s Y o T J B E N W 0 N B y e x 6 P v V x 2 z A w l w t Z t q U o 8 s Y m F Y u 5 j x 0 d / v y i 7 6 n P H + 6 d O 4 w o e 0 s Q y 5 / 7 C v O V p 9 k n f 8 u 2 b T q Z c M 1 M H / r F O T x Q R u / 3 D h 9 2 H N v O + O L I f n x x Z D + + O L I f X x z Z j y + O 7 M c X R / b j y 4 i y b 7 f b 3 / n O d / a x D T z / / P P 3 / P 7 F F 1 / s 9 / v 3 2 y u X y / 3 5 n / / 5 P u c 9 c + a M a Z o I I d M 0 z 5 w 5 c / P m z f X 1 9 b 1 f 3 3 n n n V a r d c 8 d e Z 6 / c O H C P k e + G 9 u 2 X 3 j h h f e 0 y 4 e L E W X / + u u v v / z y y 1 t b W 7 Z t v / n m m 2 f O n C k U C p Z l / f j H P z 5 / / j x C 6 L v f / e 7 2 9 n a 3 2 y 2 X y 9 l s d n 1 9 / Y U X X u B 5 f m 5 u z u V y X b t 2 7 c U X X x w O h 3 C 0 f / / 3 f 3 / t t d c Q Q t / 4 x j f m 5 u Y Q Q o I g X L h w 4 c U X X 2 y 3 2 4 V C o V g s 1 u v 1 Y r H 4 x h t v n D 9 / / q 2 3 3 s J x / P n n n w + H w 8 F g M J v N P v f c c 7 D l l S t X f v z j H y O E m s 3 m c 8 8 9 V 6 / X E U K v v v r q x Y s X 1 9 b W 9 k 7 3 6 q u v I o T O n T t 3 / v z 5 a 9 e u a Z p 2 4 c K F H / 3 o R 4 1 G w z C M f / u 3 f 3 v 9 9 d c x D P v e 9 7 5 3 w P b 9 I D O i 7 L / 9 7 W / / 4 A c / e O W V V x B C X / / 6 1 z / x i U / 8 y Z / 8 i S z L E x M T P / z h D 4 v F Y i w W w 3 H 8 7 b f f P n P m D M d x J 0 + e P H L k y H A 4 v H j x Y q 1 W + + p X v z o 7 O z s Y D B B C r 7 / + u m E Y B E G 8 / v r r v / 3 b v / 3 E E 0 8 g h A R B + K d / + q f P f / 7 z f / q n f 1 o u l 8 v l c q v V y m Q y N E 3 P z 8 / / 7 G c / 2 9 n Z i U a j 2 W y 2 2 W z + 3 u / 9 3 p E j R 7 r d L k m S L p e r 1 + v d u H H j D / 7 g D 0 6 e P P m 7 v / u 7 7 7 7 7 b r / f D 4 V C B E E g h C R J 4 j j u 1 q 1 b a 2 t r 3 / z m N 4 8 d O / b P / / z P 2 W z 2 W 9 / 6 1 h e + 8 I U / / u M / X l l Z y W Q y D M N Y l h W J R A 6 v q T 9 w j C L 7 b D b r 8 X i e f f b Z Z 5 9 9 V p K k z 3 z m M 6 l U i q b p S 5 c u N Z v N Z D J p m m a r 1 V p c X P z J T 3 6 S y + X i 8 f j l y 5 e r 1 e q Z M 2 d o m q Z p + v v f / 3 4 6 n T 5 7 9 i x C S B C E a D Q a j U Z F U X S 5 X B 6 P B y G E Y V g q l Y p G o 9 1 u F 8 O w w W D Q 6 X R w H F c U J R w O x + N x V V U 1 T c M w T F X V f / m X f 5 E k 6 T v f + Q 5 C a H 5 + f n 5 + X l G U w W D g 8 X j + 7 M / + b D g c R q P R c D i s 6 z p C a G N j Y 2 N j I x q N W p b l 8 / k i k U g 8 H t c 0 L Z V K h U K h d D p 9 8 u T J J 5 5 4 4 t v f / n a 9 X v + j P / q j Q 2 3 t D x a j y L 5 S q X z r W 9 / 6 i 7 / 4 i + 9 + 9 7 v V a v W L X / w i Q u i Z Z 5 5 Z X l 7 O Z r N H j x 7 l O O 7 3 f / / 3 E U K P P f Y Y / J r P 5 3 d 2 d r 7 8 5 S / D r + l 0 u t V q P f X U U w i h 3 / m d 3 1 l Z W X n r r b e e e e a Z q a k p j u P g L K q q / u 3 f / u 0 / / M M / n D 5 9 + u b N m / 1 + P 5 F I f O l L X 3 r 1 1 V d Z l j 1 x 4 s S T T z 4 Z i U R i s V i z 2 b x 2 7 d o f / u E f J p N J t 9 s N X z 7 7 7 L M v v P B C K B R 6 8 s k n 1 9 f X b 9 6 8 e f L k S Y T Q 7 O y s I A h e r z c c D n M c 9 6 / / + q + n T 5 + e m Z l R V f X v / u 7 v X n r p J c M w L l 2 6 9 K U v f S k e j 6 f T 6 c N q 6 A 8 i 9 g N j d 3 f 3 q 1 / 9 q i z L I + x b q 9 X + / u / / / t A v 6 Q 6 + 8 p W v w I d W q / U 3 f / M 3 D / p 0 H z Q c P 9 7 4 4 s z v x x d H 9 u O L I / v x x Z H 9 + O L I f n x x Z D + + O L I f X x z Z j y + O 7 M e X U W R v X L u u P f d f r e a v L J g 1 V z f + / 8 8 7 d 6 6 3 / Z X d z / 2 m f n R 7 M N z / U A 4 H g f z 1 m 9 y F t b W D T S W t Y t l 4 + d + J T z 6 m f / 9 F 1 3 / + X 6 1 K z d r J W b 0 + P j d t / N f X q P / p f 7 D e X c e X 5 s 0 b 6 1 g 4 i B S V + M y n r P U 0 8 n F W J k d + / j P a c y 9 h s R A i c L t Q J T / / h P 7 K z / C T S 9 S T v 6 V + 9 / / B P B w i c J s f E s t H r W L Z 5 n l r d Y v + 2 u 8 d + s 2 P O S O 9 8 z W d P P W o V S w T T 3 z S v L W F P 3 4 K 8 3 B 2 f 2 D 3 e O p 3 n k K i h D 9 6 z M o W U N B n t T r k F 5 6 w L Z P 6 y p e N N y 5 a r b a 1 t Y N s h B C y C y V r a w f 3 + + 1 W 2 7 i 0 g n A M q R q y b Y Q h W 1 X s L k 9 9 + b 8 1 d 3 P 4 8 a P m G 5 f w k 8 4 6 3 M N n F F + O 1 e 7 i k R B C y N z Y I o 4 t W b 0 e H g 7 Z 3 R 6 y b c z r s R X V H g 7 x a N T M 5 v C Z a W R Z t q L g f p 8 t S l a 7 i 4 c C t m H i 0 b D V a C L d w M J B q 1 g h l h b M z C 6 e m s B Y 1 q o 3 E U V i G I Y 8 n C 2 I G E W p 3 / y / m P / 9 f 0 H k K K 8 o h 3 3 4 M P j x N B 3 R 1 P t 9 E R 9 B R n n n d z q d Q q E A 0 X a a p t 3 + 9 B i G M d p 1 y P L 9 s / f c R / C q q u 5 / T A j U e f h o m o Y Q U h Q F r h D + 3 e d q m 8 3 m P b 9 X V f X u Z t m v o d 4 j x F / / 9 V + / 1 3 1 Y l m 2 3 2 7 q u V y o V D M N k W W 4 2 m 8 F g s N P p r K 6 u B g K B f D 7 P s u z u 7 q 6 u 6 w z D 1 G q 1 U q n U 7 / c p i i q V S j i O 7 + 7 u 4 j h + + f L l u b m 5 T q f T a r V I k q x U K o 1 G Q 1 V V n u c 1 T e M 4 7 v X X X w 8 E A u V y O R w O D 4 f D Y r G o 6 7 p t 2 8 P h s N F o y L J s m q Y s y 5 I k d b v d 1 d X V Y D B Y K B S C w W C 1 W u 3 3 + 9 v b 2 w z D 9 H o 9 C N T Z 3 t 6 W J M k 0 z V q t J s t y v 9 + v V q v d b p e m 6 W K x i G F Y L p e j a b p c L u M 4 v r O z Q x B E v V 4 3 D K P d b q u q 6 v F 4 i s W i K I q N R s P r 9 f b 7 f Q z D m s 1 m r V b D M K x a r Z q m S Z K k K I o r K y t e r 7 f V a h m G 0 W g 0 e J 5 v t 9 s I o c F g U K l U a J r O 5 / M U R d E 0 v b 2 9 T V H U 2 t r a 7 O x s u V x W F K V S q c i y D L s I g k B R V L P Z l C R p M B j o u n 7 l y p V o N N r v 9 z u d D l w J h m G t V s v v 9 4 8 g + 1 H z 7 e A 4 h m E L C w s Q 1 Q Q P Y 7 f b n Z u b K 5 V K S 0 t L Z 8 + e P X b s m K q q q q q W S q V E I u H z + d L p t C A I g i C E Q i F J k m Z n Z x F C k i S V S i U I 1 m M Y R t M 0 H M d F U U Q I z c 3 N 9 X o 9 r 9 e r 6 3 o 2 m y U I Q t f 1 7 e 1 t k B 9 B E N A K s i w X i 8 X p 6 e l i s Q i t z 3 F c I B C Y m Z n R N C 2 b z U q S h B C y b Z s g i H Q 6 b R i G L M s U R a V S q U g k k k 6 n 4 X G c m 5 t b W 1 v T d X 0 w G A Q C g V a r 5 X K 5 f D 5 f L p e D G z R N E 9 4 l F E V 1 u 1 1 4 5 u b n 5 z O Z z M L C w s 7 O j q q q 3 W 5 3 e n p a E A Q I M 7 R t W 1 G U o 0 e P b m 1 t D Y f D y c n J z c 3 N + f l 5 Q R B q t d r S 0 l K n 0 5 m e n k Y I K Y p S L p c J g j A M Q 9 d 1 r 9 c r S Z I o i p q m x W I x W Z a r 1 S r s C L d j G I b L 5 Y I G H E 2 I I 4 7 3 o i j i O O 5 y u X i e p y i
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
/ >
2023-10-11 14:23:11 +00:00
< Message
attachments = { [
{
title : 'Base64 Attachment' ,
description : 'This is a description for Base64 Attachment :nyan_rocket:' ,
image_url : base64
}
] }
/ >
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 : ''
}
] }
/ >
2023-04-28 18:29:54 +00:00
< Message
msg = 'Yes, I am'
attachments = { [
{
author_name : 'rocket.cat' ,
attachments : [
{
author_name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
description : 'Are you seeing this mario :marioparty: ?' ,
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
2023-03-17 18:37:34 +00:00
export const URLImagePreview = ( ) = > (
< >
< Message
urls = { [
{
url : 'https://www.google.com/logos/doodles/2022/seasonal-holidays-2022-6753651837109831.4-law.gif' ,
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://www.google.com/logos/doodles/2022/seasonal-holidays-2022-6753651837109831.4-law.gif'
}
] }
/ >
< / >
) ;
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-10-21 20:09:05 +00:00
< Message msg = 'rocket.cat' type = 'removed-user-from-team' isInfo / >
< Message msg = 'rocket.cat' type = 'added-user-to-team' isInfo / >
2022-02-23 20:31:14 +00:00
< 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 = ( ) = > (
2023-05-10 21:39:56 +00:00
< >
< Message
attachments = { [
{
text : 'Test Button' ,
actions : [
{
type : 'button' ,
text : 'Text button' ,
msg : 'Response message' ,
msg_in_chat_window : true
}
]
}
] }
/ >
< Message
attachments = { [
{
text : ':avocado: **Message with markdown**\n\n_Some text_\n\nThis is a test' ,
actions : [
{
type : 'button' ,
text : 'Text button' ,
msg : 'Response message' ,
msg_in_chat_window : true
}
]
}
] }
/ >
< / >
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
) ;