-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Chat Turtle Mode * Unused code * Switch and better UX * translations Co-authored-by: KoalaSat <[email protected]>
- Loading branch information
1 parent
2706703
commit 3bae399
Showing
14 changed files
with
964 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
frontend/src/components/TradeBox/EncryptedChat/ChatBottom/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { useState } from 'react'; | ||
import { Grid, useTheme, Tooltip, Button } from '@mui/material'; | ||
import { ExportIcon } from '../../../Icons'; | ||
import KeyIcon from '@mui/icons-material/Key'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { saveAsJson } from '../../../../utils'; | ||
|
||
interface Props { | ||
orderId: number; | ||
setAudit: (audit: boolean) => void; | ||
audit: boolean; | ||
createJsonFile: () => object; | ||
} | ||
|
||
const ChatBottom: React.FC<Props> = ({ orderId, setAudit, audit, createJsonFile }) => { | ||
const { t } = useTranslation(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<> | ||
<Grid item xs={6}> | ||
<Tooltip | ||
placement='bottom' | ||
enterTouchDelay={0} | ||
enterDelay={500} | ||
enterNextDelay={2000} | ||
title={t('Verify your privacy')} | ||
> | ||
<Button size='small' color='primary' variant='outlined' onClick={() => setAudit(!audit)}> | ||
<KeyIcon /> | ||
{t('Audit PGP')}{' '} | ||
</Button> | ||
</Tooltip> | ||
</Grid> | ||
|
||
<Grid item xs={6}> | ||
<Tooltip | ||
placement='bottom' | ||
enterTouchDelay={0} | ||
enterDelay={500} | ||
enterNextDelay={2000} | ||
title={t('Save full log as a JSON file (messages and credentials)')} | ||
> | ||
<Button | ||
size='small' | ||
color='primary' | ||
variant='outlined' | ||
onClick={() => saveAsJson('complete_log_chat_' + orderId + '.json', createJsonFile())} | ||
> | ||
<div style={{ width: '1.4em', height: '1.4em' }}> | ||
<ExportIcon sx={{ width: '0.8em', height: '0.8em' }} /> | ||
</div>{' '} | ||
{t('Export')}{' '} | ||
</Button> | ||
</Tooltip> | ||
</Grid> | ||
</> | ||
); | ||
}; | ||
|
||
export default ChatBottom; |
41 changes: 41 additions & 0 deletions
41
frontend/src/components/TradeBox/EncryptedChat/ChatHeader/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { Grid, Paper, Typography, useTheme } from '@mui/material'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
interface Props { | ||
connected: boolean; | ||
peerConnected: boolean; | ||
} | ||
|
||
const ChatHeader: React.FC<Props> = ({ connected, peerConnected }) => { | ||
const { t } = useTranslation(); | ||
const theme = useTheme(); | ||
const connectedColor = theme.palette.mode === 'light' ? '#b5e3b7' : '#153717'; | ||
const connectedTextColor = theme.palette.getContrastText(connectedColor); | ||
|
||
return ( | ||
<Grid container spacing={0.5}> | ||
<Grid item xs={0.3} /> | ||
<Grid item xs={5.5}> | ||
<Paper elevation={1} sx={connected ? { backgroundColor: connectedColor } : {}}> | ||
<Typography variant='caption' sx={{ color: connectedTextColor }}> | ||
{t('You') + ': '} | ||
{connected ? t('connected') : t('disconnected')} | ||
</Typography> | ||
</Paper> | ||
</Grid> | ||
<Grid item xs={0.4} /> | ||
<Grid item xs={5.5}> | ||
<Paper elevation={1} sx={peerConnected ? { backgroundColor: connectedColor } : {}}> | ||
<Typography variant='caption' sx={{ color: connectedTextColor }}> | ||
{t('Peer') + ': '} | ||
{peerConnected ? t('connected') : t('disconnected')} | ||
</Typography> | ||
</Paper> | ||
</Grid> | ||
<Grid item xs={0.3} /> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default ChatHeader; |
Oops, something went wrong.