-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-native): add lobby footer component (#1091)
In adding a meeting UI, I found I couldn't customise the text above the button in the Lobby component. As we will be using the channelId for the callId, I didn't like that it said they were joining this seemingly random ID. This would likely be confusing to the user as they have no reference to this. Changes - - Add a LobbyFooter component to the Lobby and the ability to customise it - Updated the documentation Tested - - I've tested this causes no changes in behaviour in the DogFood app and that I customise it Note - I've also updated the translation as there was a random capital "J" in join. I can revert if this was intentional.
- Loading branch information
Showing
6 changed files
with
102 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
packages/react-native-sdk/src/components/Call/Lobby/LobbyFooter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react'; | ||
import { LobbyProps } from './Lobby'; | ||
import { View, StyleSheet, Text } from 'react-native'; | ||
import { | ||
useCall, | ||
useCallStateHooks, | ||
useI18n, | ||
} from '@stream-io/video-react-bindings'; | ||
import { useTheme } from '../../../contexts/ThemeContext'; | ||
|
||
/** | ||
* Props for the Lobby Footer in the Lobby component. | ||
*/ | ||
export type LobbyFooterProps = Pick< | ||
LobbyProps, | ||
'onJoinCallHandler' | 'JoinCallButton' | ||
>; | ||
|
||
/** | ||
* The default Lobby Footer to be used in the Lobby component. | ||
*/ | ||
export const LobbyFooter = ({ | ||
onJoinCallHandler, | ||
JoinCallButton, | ||
}: LobbyFooterProps) => { | ||
const { | ||
theme: { colors, lobby, typefaces }, | ||
} = useTheme(); | ||
const { useCallSession } = useCallStateHooks(); | ||
|
||
const { t } = useI18n(); | ||
|
||
const call = useCall(); | ||
const session = useCallSession(); | ||
|
||
const participantsCount = session?.participants.length; | ||
|
||
return ( | ||
<View | ||
style={[ | ||
styles.infoContainer, | ||
{ backgroundColor: colors.static_overlay }, | ||
lobby.infoContainer, | ||
]} | ||
> | ||
<Text | ||
style={[ | ||
{ color: colors.static_white }, | ||
typefaces.subtitleBold, | ||
lobby.infoText, | ||
]} | ||
> | ||
{t('You are about to join a call with id {{ callId }}.', { | ||
callId: call?.id, | ||
}) + | ||
' ' + | ||
(participantsCount | ||
? t('{{ numberOfParticipants }} participant(s) are in the call.', { | ||
numberOfParticipants: participantsCount, | ||
}) | ||
: t('You are first to join the call.'))} | ||
</Text> | ||
{JoinCallButton && ( | ||
<JoinCallButton onJoinCallHandler={onJoinCallHandler} /> | ||
)} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
infoContainer: { | ||
padding: 12, | ||
borderRadius: 10, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './Lobby'; | ||
export * from './JoinCallButton'; | ||
export * from './LobbyFooter'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters