🚸(frontend) hide back button when a user is ejected by an admin
Avoid showing a back button when a user is kicked out of a meeting by an admin, to prevent them from repeatedly rejoining the room.
This commit is contained in:
committed by
aleb_the_flash
parent
69d92e6f30
commit
594bd5a692
@@ -22,6 +22,11 @@ const Heading = styled('h1', {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
enum DisconnectReasonKey {
|
||||||
|
DuplicateIdentity = 'duplicateIdentity',
|
||||||
|
ParticipantRemoved = 'participantRemoved',
|
||||||
|
}
|
||||||
|
|
||||||
export const FeedbackRoute = () => {
|
export const FeedbackRoute = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms')
|
||||||
const [, setLocation] = useLocation()
|
const [, setLocation] = useLocation()
|
||||||
@@ -32,21 +37,25 @@ export const FeedbackRoute = () => {
|
|||||||
if (!state?.reason) return
|
if (!state?.reason) return
|
||||||
switch (state.reason) {
|
switch (state.reason) {
|
||||||
case DisconnectReason.DUPLICATE_IDENTITY:
|
case DisconnectReason.DUPLICATE_IDENTITY:
|
||||||
return 'duplicateIdentity'
|
return DisconnectReasonKey.DuplicateIdentity
|
||||||
case DisconnectReason.PARTICIPANT_REMOVED:
|
case DisconnectReason.PARTICIPANT_REMOVED:
|
||||||
return 'participantRemoved'
|
return DisconnectReasonKey.ParticipantRemoved
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const showBackButton = reasonKey !== DisconnectReasonKey.ParticipantRemoved
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Screen layout="centered" footer={false}>
|
<Screen layout="centered" footer={false}>
|
||||||
<Center>
|
<Center>
|
||||||
<VStack>
|
<VStack>
|
||||||
<Heading>{t(`feedback.heading.${reasonKey || 'normal'}`)}</Heading>
|
<Heading>{t(`feedback.heading.${reasonKey || 'normal'}`)}</Heading>
|
||||||
<HStack>
|
<HStack>
|
||||||
<Button variant="secondary" onPress={() => window.history.back()}>
|
{showBackButton && (
|
||||||
{t('feedback.back')}
|
<Button variant="secondary" onPress={() => window.history.back()}>
|
||||||
</Button>
|
{t('feedback.back')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button variant="primary" onPress={() => setLocation('/')}>
|
<Button variant="primary" onPress={() => setLocation('/')}>
|
||||||
{t('feedback.home')}
|
{t('feedback.home')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user