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

12345678910111213141516171819202122232425262728293031323334353637383940
  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 { getVisitorsCount, 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(getVisitorsCount);
  25. return !visitorsMode && visitorsCount > 0 ? (
  26. <Label
  27. icon = { IconUsers }
  28. iconColor = { BaseTheme.palette.uiBackground }
  29. style = { styles.raisedHandsCountLabel }
  30. text = { `${getVisitorsShortText(visitorsCount)}` }
  31. textStyle = { styles.raisedHandsCountLabelText } />
  32. ) : null;
  33. };
  34. export default VisitorsCountLabel;