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.

VirtualBackgroundTab.tsx 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { withStyles } from '@mui/styles';
  2. import React from 'react';
  3. import { WithTranslation } from 'react-i18next';
  4. import AbstractDialogTab, {
  5. IProps as AbstractDialogTabProps
  6. } from '../../../base/dialog/components/web/AbstractDialogTab';
  7. import { translate } from '../../../base/i18n/functions';
  8. import VirtualBackgrounds from '../../../virtual-background/components/VirtualBackgrounds';
  9. /**
  10. * The type of the React {@code Component} props of {@link VirtualBackgroundTab}.
  11. */
  12. export interface IProps extends AbstractDialogTabProps, WithTranslation {
  13. /**
  14. * Returns the jitsi track that will have background effect applied.
  15. */
  16. _jitsiTrack: Object;
  17. /**
  18. * CSS classes object.
  19. */
  20. classes: any;
  21. /**
  22. * Virtual background options.
  23. */
  24. options: any;
  25. /**
  26. * The selected thumbnail identifier.
  27. */
  28. selectedThumbnail: string;
  29. }
  30. const styles = () => {
  31. return {
  32. container: {
  33. width: '100%',
  34. display: 'flex',
  35. flexDirection: 'column' as const
  36. }
  37. };
  38. };
  39. /**
  40. * React {@code Component} for modifying language and moderator settings.
  41. *
  42. * @augments Component
  43. */
  44. class VirtualBackgroundTab extends AbstractDialogTab<IProps, any> {
  45. /**
  46. * Initializes a new {@code ModeratorTab} instance.
  47. *
  48. * @param {Object} props - The read-only properties with which the new
  49. * instance is to be initialized.
  50. */
  51. constructor(props: IProps) {
  52. super(props);
  53. // Bind event handler so it is only bound once for every instance.
  54. this._onOptionsChanged = this._onOptionsChanged.bind(this);
  55. }
  56. /**
  57. * Callback invoked to select if follow-me mode
  58. * should be activated.
  59. *
  60. * @param {Object} options - The new background options.
  61. *
  62. * @returns {void}
  63. */
  64. _onOptionsChanged(options: any) {
  65. super._onChange({ options });
  66. }
  67. /**
  68. * Implements React's {@link Component#render()}.
  69. *
  70. * @inheritdoc
  71. * @returns {ReactElement}
  72. */
  73. render() {
  74. const {
  75. classes,
  76. options,
  77. selectedThumbnail,
  78. _jitsiTrack
  79. } = this.props;
  80. return (
  81. <div
  82. className = { classes.container }
  83. id = 'virtual-background-dialog'
  84. key = 'virtual-background'>
  85. <VirtualBackgrounds
  86. _jitsiTrack = { _jitsiTrack }
  87. onOptionsChange = { this._onOptionsChanged }
  88. options = { options }
  89. selectedThumbnail = { selectedThumbnail } />
  90. </div>
  91. );
  92. }
  93. }
  94. export default withStyles(styles)(translate(VirtualBackgroundTab));