@@ -8,48 +8,57 @@ type Props = {
88 channelname : string
99 isAdHoc : boolean
1010 isBigTeam : boolean
11- joiners : ReadonlyArray < string >
12- leavers : ReadonlyArray < string >
11+ joiners ? : ReadonlyArray < string >
12+ leavers ? : ReadonlyArray < string >
1313 onAuthorClick : ( username : string ) => void
1414 onManageChannels : ( ) => void
1515 onManageNotifications : ( ) => void
1616 teamname : string
1717 timestamp : number
1818}
1919
20+ const none = new Array < string > ( )
2021const Joined = ( props : Props ) => (
2122 < Kb . Box2 direction = "vertical" style = { styles . container } fullWidth = { true } alignSelf = "flex-start" >
22- { props . joiners . length ? < MultiUserJoinedNotice { ...props } joiners = { props . joiners } leavers = { [ ] } /> : null }
23- { props . leavers . length ? < MultiUserJoinedNotice { ...props } joiners = { [ ] } leavers = { props . leavers } /> : null }
23+ { props . joiners ?. length ? (
24+ < MultiUserJoinedNotice { ...props } joiners = { props . joiners } leavers = { none } />
25+ ) : null }
26+ { props . leavers ?. length ? (
27+ < MultiUserJoinedNotice { ...props } joiners = { none } leavers = { props . leavers } />
28+ ) : null }
2429 </ Kb . Box2 >
2530)
2631
27- const MultiUserJoinedNotice = ( props : Props ) => (
28- < Kb . Box2 direction = "vertical" fullWidth = { true } alignSelf = "flex-start" >
29- < UserNotice >
30- < Kb . Text type = "BodySmall" style = { { paddingBottom : Kb . Styles . globalMargins . xxtiny } } lineClamp = { 2 } >
31- { props . joiners . length > 0 ? getAddedUsernames ( props . joiners ) : getAddedUsernames ( props . leavers ) }
32- { ` ${ props . leavers . length > props . joiners . length ? 'left' : 'joined' } ${
33- props . isBigTeam ? `#${ props . channelname } .` : `${ props . teamname } .`
34- } `}
35- { props . timestamp ? (
36- < Kb . Text type = "BodyTiny" style = { styles . timestamp } >
37- { ' ' + formatTimeForChat ( props . timestamp ) }
38- </ Kb . Text >
39- ) : null }
40- </ Kb . Text >
41- < Kb . Box2 direction = "horizontal" alignSelf = "flex-start" style = { styles . avatarLine } >
42- < Kb . AvatarLine
43- usernames = { props . joiners . length > 0 ? props . joiners : props . leavers }
44- maxShown = { 3 }
45- size = { 32 }
46- layout = "horizontal"
47- alignSelf = "flex-start"
48- />
49- </ Kb . Box2 >
50- </ UserNotice >
51- </ Kb . Box2 >
52- )
32+ const MultiUserJoinedNotice = ( props : Props ) => {
33+ return (
34+ < Kb . Box2 direction = "vertical" fullWidth = { true } alignSelf = "flex-start" >
35+ < UserNotice >
36+ < Kb . Text type = "BodySmall" style = { { paddingBottom : Kb . Styles . globalMargins . xxtiny } } lineClamp = { 2 } >
37+ { ( props . joiners ?. length ?? 0 ) > 0
38+ ? getAddedUsernames ( props . joiners )
39+ : getAddedUsernames ( props . leavers ) }
40+ { ` ${ ( props . leavers ?. length ?? 0 ) > ( props . joiners ?. length ?? 0 ) ? 'left' : 'joined' } ${
41+ props . isBigTeam ? `#${ props . channelname } .` : `${ props . teamname } .`
42+ } `}
43+ { props . timestamp ? (
44+ < Kb . Text type = "BodyTiny" style = { styles . timestamp } >
45+ { ' ' + formatTimeForChat ( props . timestamp ) }
46+ </ Kb . Text >
47+ ) : null }
48+ </ Kb . Text >
49+ < Kb . Box2 direction = "horizontal" alignSelf = "flex-start" style = { styles . avatarLine } >
50+ < Kb . AvatarLine
51+ usernames = { ( ( props . joiners ?. length ?? 0 ) > 0 ? props . joiners : props . leavers ) ?? none }
52+ maxShown = { 3 }
53+ size = { 32 }
54+ layout = "horizontal"
55+ alignSelf = "flex-start"
56+ />
57+ </ Kb . Box2 >
58+ </ UserNotice >
59+ </ Kb . Box2 >
60+ )
61+ }
5362
5463const styles = Kb . Styles . styleSheetCreate (
5564 ( ) =>
0 commit comments