2023-02-14 09:24:38 -06:00
|
|
|
import React from 'react';
|
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
|
|
import { IReduxState } from '../../../app/types';
|
|
|
|
|
import { IconUsers } from '../../../base/icons/svg';
|
|
|
|
|
import Label from '../../../base/label/components/native/Label';
|
|
|
|
|
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
|
2024-06-28 15:29:41 +03:00
|
|
|
import { getVisitorsCount, getVisitorsShortText, iAmVisitor } from '../../functions';
|
2023-02-14 09:24:38 -06:00
|
|
|
|
|
|
|
|
const styles = {
|
|
|
|
|
raisedHandsCountLabel: {
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
backgroundColor: BaseTheme.palette.warning02,
|
|
|
|
|
borderRadius: BaseTheme.shape.borderRadius,
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
marginLeft: BaseTheme.spacing[0],
|
|
|
|
|
marginBottom: BaseTheme.spacing[0]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
raisedHandsCountLabelText: {
|
|
|
|
|
color: BaseTheme.palette.uiBackground,
|
|
|
|
|
paddingLeft: BaseTheme.spacing[2]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const VisitorsCountLabel = () => {
|
2023-02-23 12:43:16 -06:00
|
|
|
const visitorsMode = useSelector((state: IReduxState) => iAmVisitor(state));
|
2024-06-28 15:29:41 +03:00
|
|
|
const visitorsCount = useSelector(getVisitorsCount);
|
2023-02-14 09:24:38 -06:00
|
|
|
|
2023-05-09 12:10:46 +03:00
|
|
|
return !visitorsMode && visitorsCount > 0 ? (
|
2023-02-14 09:24:38 -06:00
|
|
|
<Label
|
|
|
|
|
icon = { IconUsers }
|
|
|
|
|
iconColor = { BaseTheme.palette.uiBackground }
|
|
|
|
|
style = { styles.raisedHandsCountLabel }
|
|
|
|
|
text = { `${getVisitorsShortText(visitorsCount)}` }
|
|
|
|
|
textStyle = { styles.raisedHandsCountLabelText } />
|
2023-05-09 12:10:46 +03:00
|
|
|
) : null;
|
2023-02-14 09:24:38 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default VisitorsCountLabel;
|