2019-04-17 18:57:46 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2021-01-25 17:14:45 +00:00
|
|
|
import { withTheme } from '../../../theme';
|
|
|
|
import I18n from '../../../i18n';
|
|
|
|
import * as List from '../../../containers/List';
|
|
|
|
import { E2E_BANNER_TYPE } from '../../../lib/encryption/constants';
|
|
|
|
import { themes } from '../../../constants/colors';
|
2020-08-28 19:41:08 +00:00
|
|
|
|
|
|
|
import OmnichannelStatus from '../../../ee/omnichannel/containers/OmnichannelStatus';
|
2019-04-17 18:57:46 +00:00
|
|
|
|
|
|
|
const ListHeader = React.memo(({
|
2020-02-13 19:24:39 +00:00
|
|
|
searching,
|
|
|
|
sortBy,
|
|
|
|
toggleSort,
|
2020-09-11 14:31:38 +00:00
|
|
|
goEncryption,
|
2020-07-31 18:22:30 +00:00
|
|
|
goQueue,
|
|
|
|
queueSize,
|
2020-08-21 13:38:50 +00:00
|
|
|
inquiryEnabled,
|
2020-09-11 14:31:38 +00:00
|
|
|
encryptionBanner,
|
2021-01-25 17:14:45 +00:00
|
|
|
user,
|
|
|
|
theme
|
|
|
|
}) => {
|
|
|
|
const sortTitle = I18n.t('Sorting_by', { key: I18n.t(sortBy === 'alphabetical' ? 'name' : 'activity') });
|
|
|
|
|
|
|
|
if (searching) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{encryptionBanner
|
|
|
|
? (
|
|
|
|
<>
|
|
|
|
<List.Item
|
|
|
|
title={
|
|
|
|
encryptionBanner === E2E_BANNER_TYPE.REQUEST_PASSWORD
|
|
|
|
? 'Enter_Your_E2E_Password'
|
|
|
|
: 'Save_Your_Encryption_Password'
|
|
|
|
}
|
|
|
|
left={() => <List.Icon name='encrypted' color={themes[theme].buttonText} />}
|
|
|
|
underlayColor={themes[theme].tintActive}
|
|
|
|
backgroundColor={themes[theme].actionTintColor}
|
|
|
|
color={themes[theme].buttonText}
|
|
|
|
onPress={goEncryption}
|
|
|
|
testID='listheader-encryption'
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
: null}
|
|
|
|
<List.Item
|
|
|
|
title={sortTitle}
|
|
|
|
left={() => <List.Icon name='sort' />}
|
|
|
|
color={themes[theme].auxiliaryText}
|
|
|
|
onPress={toggleSort}
|
|
|
|
translateTitle={false}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<OmnichannelStatus
|
|
|
|
searching={searching}
|
|
|
|
goQueue={goQueue}
|
|
|
|
inquiryEnabled={inquiryEnabled}
|
|
|
|
queueSize={queueSize}
|
|
|
|
user={user}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
});
|
2019-04-17 18:57:46 +00:00
|
|
|
|
|
|
|
ListHeader.propTypes = {
|
2020-02-13 19:24:39 +00:00
|
|
|
searching: PropTypes.bool,
|
2019-04-17 18:57:46 +00:00
|
|
|
sortBy: PropTypes.string,
|
2019-06-10 16:22:35 +00:00
|
|
|
toggleSort: PropTypes.func,
|
2020-09-11 14:31:38 +00:00
|
|
|
goEncryption: PropTypes.func,
|
2020-07-31 18:22:30 +00:00
|
|
|
goQueue: PropTypes.func,
|
|
|
|
queueSize: PropTypes.number,
|
2020-08-21 13:38:50 +00:00
|
|
|
inquiryEnabled: PropTypes.bool,
|
2020-09-11 14:31:38 +00:00
|
|
|
encryptionBanner: PropTypes.string,
|
2021-01-25 17:14:45 +00:00
|
|
|
user: PropTypes.object,
|
|
|
|
theme: PropTypes.string
|
2019-04-17 18:57:46 +00:00
|
|
|
};
|
|
|
|
|
2021-01-25 17:14:45 +00:00
|
|
|
export default withTheme(ListHeader);
|