Add copied feedback to Android pgp export

This commit is contained in:
Reckless_Satoshi 2022-11-17 09:42:52 -08:00
parent 7c3293775b
commit ddcad444b6
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -17,14 +17,6 @@ const ChatBottom: React.FC<Props> = ({ orderId, setAudit, audit, createJsonFile
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const onPGPClick: () => void = () => {
if (window.ReactNativeWebView === undefined) {
saveAsJson('complete_log_chat_' + orderId + '.json', createJsonFile());
} else {
systemClient.copyToClipboard(JSON.stringify(createJsonFile()));
}
};
return ( return (
<> <>
<Grid item xs={6}> <Grid item xs={6}>
@ -43,20 +35,41 @@ const ChatBottom: React.FC<Props> = ({ orderId, setAudit, audit, createJsonFile
</Grid> </Grid>
<Grid item xs={6}> <Grid item xs={6}>
<Tooltip {window.ReactNativeWebView === undefined ? (
placement='bottom' <Tooltip
enterTouchDelay={0} placement='bottom'
enterDelay={500} enterTouchDelay={0}
enterNextDelay={2000} enterDelay={500}
title={t('Save full log as a JSON file (messages and credentials)')} enterNextDelay={2000}
> title={t('Save full log as a JSON file (messages and credentials)')}
<Button size='small' color='primary' variant='outlined' onClick={onPGPClick}> >
<div style={{ width: '1.4em', height: '1.4em' }}> <Button
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} /> size='small'
</div>{' '} color='primary'
{t('Export')}{' '} variant='outlined'
</Button> onClick={() => saveAsJson('complete_log_chat_' + orderId + '.json', createJsonFile())}
</Tooltip> >
<div style={{ width: '1.4em', height: '1.4em' }}>
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} />
</div>{' '}
{t('Export')}{' '}
</Button>
</Tooltip>
) : (
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
<Button
size='small'
color='primary'
variant='outlined'
onClick={() => systemClient.copyToClipboard(JSON.stringify(createJsonFile()))}
>
<div style={{ width: '1.4em', height: '1.4em' }}>
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} />
</div>{' '}
{t('Export')}{' '}
</Button>
</Tooltip>
)}
</Grid> </Grid>
</> </>
); );