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.

VisitorsCountLabel.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import { useSelector } from 'react-redux';
  3. import { IReduxState } from '../../../app/types';
  4. import { IconUsers } from '../../../base/icons/svg';
  5. import Label from '../../../base/label/components/native/Label';
  6. import BaseTheme from '../../../base/ui/components/BaseTheme.native';
  7. import { getVisitorsShortText, iAmVisitor } from '../../functions';
  8. const styles = {
  9. raisedHandsCountLabel: {
  10. alignItems: 'center',
  11. backgroundColor: BaseTheme.palette.warning02,
  12. borderRadius: BaseTheme.shape.borderRadius,
  13. flexDirection: 'row',
  14. marginLeft: BaseTheme.spacing[0],
  15. marginBottom: BaseTheme.spacing[0]
  16. },
  17. raisedHandsCountLabelText: {
  18. color: BaseTheme.palette.uiBackground,
  19. paddingLeft: BaseTheme.spacing[2]
  20. }
  21. };
  22. const VisitorsCountLabel = () => {
  23. const visitorsMode = useSelector((state: IReduxState) => iAmVisitor(state));
  24. const visitorsCount = useSelector((state: IReduxState) =>
  25. state['features/visitors'].count || 0);
  26. return !visitorsMode && visitorsCount > 0 ? (
  27. <Label
  28. icon = { IconUsers }
  29. iconColor = { BaseTheme.palette.uiBackground }
  30. style = { styles.raisedHandsCountLabel }
  31. text = { `${getVisitorsShortText(visitorsCount)}` }
  32. textStyle = { styles.raisedHandsCountLabelText } />
  33. ) : null;
  34. };
  35. export default VisitorsCountLabel;