diff --git a/frontend/src/basic/SettingsPage/index.tsx b/frontend/src/basic/SettingsPage/index.tsx index c9828eb1..bc4cfe2e 100644 --- a/frontend/src/basic/SettingsPage/index.tsx +++ b/frontend/src/basic/SettingsPage/index.tsx @@ -12,7 +12,7 @@ const SettingsPage = (): JSX.Element => { elevation={12} sx={{ padding: '0.6em', - width: '18em', + width: '21em', maxHeight: `${maxHeight}em`, overflow: 'auto', overflowX: 'clip', diff --git a/frontend/src/components/Dialogs/EnableTelegram.tsx b/frontend/src/components/Dialogs/EnableTelegram.tsx index ed7b6179..f9f562d1 100644 --- a/frontend/src/components/Dialogs/EnableTelegram.tsx +++ b/frontend/src/components/Dialogs/EnableTelegram.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { useTheme } from '@mui/material/styles'; import QRCode from 'react-qr-code'; @@ -13,6 +13,7 @@ import { Grid, } from '@mui/material'; import { NewTabIcon } from '../Icons'; +import { AppContext, UseAppStoreType } from '../../contexts/AppContext'; interface Props { open: boolean; @@ -22,6 +23,7 @@ interface Props { } const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): JSX.Element => { + const { settings } = useContext(AppContext); const { t } = useTranslation(); const theme = useTheme(); @@ -49,7 +51,7 @@ const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): JSX sx={{ width: 290, display: 'flex', - backgroundColor: theme.palette.background.paper, + backgroundColor: settings.lightQRs ? '#fff' : theme.palette.background.paper, alignItems: 'center', justifyContent: 'center', padding: '0.5em', @@ -63,7 +65,7 @@ const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): JSX > } /> + {settings.mode === 'dark' ? ( + <> + + + + + + + } + icon={ + + + + } + onChange={(e) => { + const lightQRs = !e.target.checked; + setSettings({ ...settings, lightQRs }); + systemClient.setItem('settings_lightQRs', lightQRs); + }} + /> + } + /> + + ) : ( + <> + )} diff --git a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx index d0fbc468..f5f7ee73 100644 --- a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx +++ b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Box, Grid, Typography, TextField, Tooltip, useTheme } from '@mui/material'; import { ContentCopy } from '@mui/icons-material'; @@ -7,6 +7,7 @@ import { Order } from '../../../models'; import { systemClient } from '../../../services/System'; import currencies from '../../../../static/assets/currencies.json'; import WalletsButton from '../WalletsButton'; +import { AppContext, UseAppStoreType } from '../../../contexts/AppContext'; interface LockInvoicePromptProps { order: Order; @@ -14,6 +15,7 @@ interface LockInvoicePromptProps { } export const LockInvoicePrompt = ({ order, concept }: LockInvoicePromptProps): JSX.Element => { + const { settings } = useContext(AppContext); const { t } = useTranslation(); const theme = useTheme(); const currencyCode: string = currencies[`${order.currency}`]; @@ -81,7 +83,7 @@ export const LockInvoicePrompt = ({ order, concept }: LockInvoicePromptProps): J { useEffect(() => { setTheme(makeTheme(settings)); - }, [settings.fontSize, settings.mode]); + }, [settings.fontSize, settings.mode, settings.lightQRs]); useEffect(() => { i18n.changeLanguage(settings.language); diff --git a/frontend/src/models/Settings.model.ts b/frontend/src/models/Settings.model.ts index 83fa0d33..24f6fcc1 100644 --- a/frontend/src/models/Settings.model.ts +++ b/frontend/src/models/Settings.model.ts @@ -30,6 +30,8 @@ class BaseSettings { ? 'dark' : 'light'; + this.lightQRs = systemClient.getItem('settings_lightQRs') === 'true'; + const languageCookie = systemClient.getItem('settings_language'); this.language = languageCookie !== '' @@ -45,6 +47,7 @@ class BaseSettings { public frontend: 'basic' | 'pro' = 'basic'; public mode: 'light' | 'dark' = 'light'; public fontSize: number = 14; + public lightQRs: boolean = false; public language?: Language; public freezeViewports: boolean = false; public network: 'mainnet' | 'testnet' = 'mainnet'; diff --git a/mobile/App.tsx b/mobile/App.tsx index f7aa1eb9..f3f272dc 100644 --- a/mobile/App.tsx +++ b/mobile/App.tsx @@ -44,11 +44,11 @@ const App = () => { }; EncryptedStorage.removeItem('sessionid'); - // EncryptedStorage.removeItem('csrftoken'); loadCookie('robot_token'); loadCookie('settings_fontsize_basic'); loadCookie('settings_language'); loadCookie('settings_mode'); + loadCookie('settings_lightQRs'); loadCookie('settings_network'); loadCookie('garage').then(() => injectMessageResolve(responseId)); };