Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

AlwaysOnLabels.tsx 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import React, { useCallback } from 'react';
  2. import { TouchableOpacity } from 'react-native';
  3. import { useDispatch, useSelector } from 'react-redux';
  4. import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
  5. import { openHighlightDialog } from '../../../recording/actions.native';
  6. import HighlightButton from '../../../recording/components/Recording/native/HighlightButton';
  7. import RecordingLabel from '../../../recording/components/native/RecordingLabel';
  8. import { isLiveStreamingRunning } from '../../../recording/functions';
  9. import VisitorsCountLabel from '../../../visitors/components/native/VisitorsCountLabel';
  10. import RaisedHandsCountLabel from './RaisedHandsCountLabel';
  11. import {
  12. LABEL_ID_RAISED_HANDS_COUNT,
  13. LABEL_ID_RECORDING,
  14. LABEL_ID_STREAMING,
  15. LABEL_ID_VISITORS_COUNT,
  16. LabelHitSlop
  17. } from './constants';
  18. interface IProps {
  19. /**
  20. * Creates a function to be invoked when the onPress of the touchables are
  21. * triggered.
  22. */
  23. createOnPress: Function;
  24. }
  25. const AlwaysOnLabels = ({ createOnPress }: IProps) => {
  26. const dispatch = useDispatch();
  27. const isStreaming = useSelector(isLiveStreamingRunning);
  28. const openHighlightDialogCallback = useCallback(() =>
  29. dispatch(openHighlightDialog()), [ dispatch ]);
  30. return (<>
  31. <TouchableOpacity
  32. hitSlop = { LabelHitSlop }
  33. onPress = { createOnPress(LABEL_ID_RECORDING) } >
  34. <RecordingLabel mode = { JitsiRecordingConstants.mode.FILE } />
  35. </TouchableOpacity>
  36. {
  37. isStreaming
  38. && <TouchableOpacity
  39. hitSlop = { LabelHitSlop }
  40. onPress = { createOnPress(LABEL_ID_STREAMING) } >
  41. <RecordingLabel mode = { JitsiRecordingConstants.mode.STREAM } />
  42. </TouchableOpacity>
  43. }
  44. <TouchableOpacity
  45. hitSlop = { LabelHitSlop }
  46. onPress = { openHighlightDialogCallback }>
  47. <HighlightButton />
  48. </TouchableOpacity>
  49. <TouchableOpacity
  50. hitSlop = { LabelHitSlop }
  51. onPress = { createOnPress(LABEL_ID_RAISED_HANDS_COUNT) } >
  52. <RaisedHandsCountLabel />
  53. </TouchableOpacity>
  54. <TouchableOpacity
  55. hitSlop = { LabelHitSlop }
  56. onPress = { createOnPress(LABEL_ID_VISITORS_COUNT) } >
  57. <VisitorsCountLabel />
  58. </TouchableOpacity>
  59. </>);
  60. };
  61. export default AlwaysOnLabels;