2019-04-17 18:57:46 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-03-17 19:25:31 +00:00
|
|
|
import { useTheme } from '../../../theme';
|
2021-01-21 19:52:26 +00:00
|
|
|
import * as List from '../../../containers/List';
|
2022-04-04 19:15:29 +00:00
|
|
|
import { E2E_BANNER_TYPE } from '../../../lib/constants';
|
2021-01-21 19:52:26 +00:00
|
|
|
import { themes } from '../../../constants/colors';
|
2020-08-28 19:41:08 +00:00
|
|
|
import OmnichannelStatus from '../../../ee/omnichannel/containers/OmnichannelStatus';
|
2022-02-25 18:59:39 +00:00
|
|
|
import { IUser } from '../../../definitions';
|
|
|
|
|
|
|
|
export type TEncryptionBanner = 'REQUEST_PASSWORD' | 'SAVE_PASSWORD';
|
|
|
|
|
|
|
|
interface IRoomListHeader {
|
|
|
|
searching: boolean;
|
|
|
|
goEncryption: () => void;
|
|
|
|
goQueue: () => void;
|
|
|
|
queueSize: number;
|
|
|
|
inquiryEnabled: boolean;
|
|
|
|
encryptionBanner: TEncryptionBanner;
|
|
|
|
user: IUser;
|
|
|
|
}
|
2019-04-17 18:57:46 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const ListHeader = React.memo(
|
2022-03-17 19:25:31 +00:00
|
|
|
({ searching, goEncryption, goQueue, queueSize, inquiryEnabled, encryptionBanner, user }: IRoomListHeader) => {
|
2021-09-13 20:41:05 +00:00
|
|
|
if (searching) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-01-21 19:52:26 +00:00
|
|
|
|
2022-03-17 19:25:31 +00:00
|
|
|
const { theme } = useTheme();
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{encryptionBanner ? (
|
2021-01-21 19:52:26 +00:00
|
|
|
<>
|
|
|
|
<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 />
|
|
|
|
</>
|
2021-09-13 20:41:05 +00:00
|
|
|
) : null}
|
|
|
|
<List.Separator />
|
|
|
|
<OmnichannelStatus
|
|
|
|
searching={searching}
|
|
|
|
goQueue={goQueue}
|
|
|
|
inquiryEnabled={inquiryEnabled}
|
|
|
|
queueSize={queueSize}
|
|
|
|
user={user}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2019-04-17 18:57:46 +00:00
|
|
|
|
2022-03-17 19:25:31 +00:00
|
|
|
export default ListHeader;
|