You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnsafeRoomWarning.tsx 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch, useSelector } from 'react-redux';
  4. import { makeStyles } from 'tss-react/mui';
  5. import { IReduxState } from '../../../../app/types';
  6. import { withPixelLineHeight } from '../../../styles/functions.web';
  7. import Checkbox from '../../../ui/components/web/Checkbox';
  8. import getUnsafeRoomText from '../../../util/getUnsafeRoomText.web';
  9. import { setUnsafeRoomConsent } from '../../actions.web';
  10. const useStyles = makeStyles()(theme => {
  11. return {
  12. warning: {
  13. backgroundColor: theme.palette.warning01,
  14. color: theme.palette.text04,
  15. ...withPixelLineHeight(theme.typography.bodyShortRegular),
  16. padding: theme.spacing(3),
  17. borderRadius: theme.shape.borderRadius,
  18. marginBottom: theme.spacing(3)
  19. },
  20. consent: {
  21. padding: `0 ${theme.spacing(3)}`,
  22. '@media (max-width: 720px)': {
  23. marginBottom: theme.spacing(3)
  24. }
  25. }
  26. };
  27. });
  28. const UnsafeRoomWarning = () => {
  29. const { t } = useTranslation();
  30. const { classes } = useStyles();
  31. const dispatch = useDispatch();
  32. const { unsafeRoomConsent } = useSelector((state: IReduxState) => state['features/base/premeeting']);
  33. const toggleConsent = useCallback(
  34. () => dispatch(setUnsafeRoomConsent(!unsafeRoomConsent))
  35. , [ unsafeRoomConsent, dispatch ]);
  36. return (
  37. <>
  38. <div className = { classes.warning }>
  39. {getUnsafeRoomText(t, 'prejoin')}
  40. </div>
  41. <Checkbox
  42. checked = { unsafeRoomConsent }
  43. className = { classes.consent }
  44. label = { t('prejoin.unsafeRoomConsent') }
  45. onChange = { toggleConsent } />
  46. </>
  47. );
  48. };
  49. export default UnsafeRoomWarning;