mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-21 20:59:01 +00:00
Invert QRcode foreground with dark/light themes
This commit is contained in:
parent
215e04f75e
commit
d69bb9bb72
@ -21,23 +21,57 @@ export default class App extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
dark: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches,
|
|
||||||
expandedSettings: false,
|
expandedSettings: false,
|
||||||
openLearn: false,
|
openLearn: false,
|
||||||
theme: { typography: { fontSize: 14 } },
|
theme: createTheme({
|
||||||
|
palette: {
|
||||||
|
mode:
|
||||||
|
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
|
? 'dark'
|
||||||
|
: 'light',
|
||||||
|
background: {
|
||||||
|
default:
|
||||||
|
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
|
? '#070707'
|
||||||
|
: '#fff',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
lightTheme = createTheme({});
|
handleThemeChange = () => {
|
||||||
|
if (this.state.theme.palette.mode === 'light') {
|
||||||
darkTheme = createTheme({
|
this.setState(({ theme }) => ({
|
||||||
palette: {
|
theme: createTheme({
|
||||||
mode: 'dark',
|
typography: {
|
||||||
background: {
|
fontSize: theme.typography.fontSize,
|
||||||
default: '#070707',
|
},
|
||||||
},
|
palette: {
|
||||||
},
|
mode: 'dark',
|
||||||
});
|
background: {
|
||||||
|
default: '#070707',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (this.state.theme.palette.mode === 'dark') {
|
||||||
|
this.setState(({ theme }) => ({
|
||||||
|
theme: createTheme({
|
||||||
|
typography: {
|
||||||
|
fontSize: theme.typography.fontSize,
|
||||||
|
},
|
||||||
|
palette: {
|
||||||
|
mode: 'light',
|
||||||
|
background: {
|
||||||
|
default: '#fff',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onSettingsClick = () => {
|
onSettingsClick = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -62,7 +96,7 @@ export default class App extends Component {
|
|||||||
return (
|
return (
|
||||||
<Suspense fallback='loading language'>
|
<Suspense fallback='loading language'>
|
||||||
<I18nextProvider i18n={i18n}>
|
<I18nextProvider i18n={i18n}>
|
||||||
<ThemeProvider theme={this.state.dark ? this.darkTheme : createTheme(this.state.theme)}>
|
<ThemeProvider theme={this.state.theme}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<LearnDialog
|
<LearnDialog
|
||||||
open={this.state.openLearn}
|
open={this.state.openLearn}
|
||||||
@ -78,9 +112,9 @@ export default class App extends Component {
|
|||||||
<IconButton
|
<IconButton
|
||||||
color='inherit'
|
color='inherit'
|
||||||
sx={{ position: 'fixed', right: '0px' }}
|
sx={{ position: 'fixed', right: '0px' }}
|
||||||
onClick={() => this.setState({ dark: !this.state.dark })}
|
onClick={() => this.handleThemeChange()}
|
||||||
>
|
>
|
||||||
{this.state.dark ? <LightModeIcon /> : <DarkModeIcon />}
|
{this.state.theme.palette.mode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
sx={{ position: 'fixed', right: '34px' }}
|
sx={{ position: 'fixed', right: '34px' }}
|
||||||
|
@ -1071,6 +1071,7 @@ class OrderPage extends Component {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} align='left'>
|
<Grid item xs={6} align='left'>
|
||||||
<TradeBox
|
<TradeBox
|
||||||
|
theme={this.props.theme}
|
||||||
push={this.props.history.push}
|
push={this.props.history.push}
|
||||||
getOrderDetails={this.getOrderDetails}
|
getOrderDetails={this.getOrderDetails}
|
||||||
pauseLoading={this.state.pauseLoading}
|
pauseLoading={this.state.pauseLoading}
|
||||||
@ -1116,6 +1117,7 @@ class OrderPage extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ display: this.state.tabValue == 1 ? '' : 'none' }}>
|
<div style={{ display: this.state.tabValue == 1 ? '' : 'none' }}>
|
||||||
<TradeBox
|
<TradeBox
|
||||||
|
theme={this.props.theme}
|
||||||
push={this.props.history.push}
|
push={this.props.history.push}
|
||||||
getOrderDetails={this.getOrderDetails}
|
getOrderDetails={this.getOrderDetails}
|
||||||
pauseLoading={this.state.pauseLoading}
|
pauseLoading={this.state.pauseLoading}
|
||||||
|
@ -281,13 +281,12 @@ class TradeBox extends Component {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} align='center'>
|
<Grid item xs={12} align='center'>
|
||||||
<Box sx={{ bgcolor: '#ffffff', width: '315px', position: 'relative', left: '-5px' }}>
|
<QRCode
|
||||||
<QRCode
|
bgColor={'rgba(255, 255, 255, 0)'}
|
||||||
value={this.props.data.bond_invoice}
|
fgColor={this.props.theme.palette.text.primary}
|
||||||
size={305}
|
value={this.props.data.bond_invoice}
|
||||||
style={{ position: 'relative', top: '3px' }}
|
size={305}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
||||||
<Button
|
<Button
|
||||||
size='small'
|
size='small'
|
||||||
@ -416,13 +415,12 @@ class TradeBox extends Component {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} align='center'>
|
<Grid item xs={12} align='center'>
|
||||||
<Box sx={{ bgcolor: '#ffffff', width: '315px', position: 'relative', left: '-5px' }}>
|
<QRCode
|
||||||
<QRCode
|
bgColor={'rgba(255, 255, 255, 0)'}
|
||||||
value={this.props.data.escrow_invoice}
|
fgColor={this.props.theme.palette.text.primary}
|
||||||
size={305}
|
value={this.props.data.escrow_invoice}
|
||||||
style={{ position: 'relative', top: '3px' }}
|
size={305}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
||||||
<Button
|
<Button
|
||||||
size='small'
|
size='small'
|
||||||
@ -512,6 +510,8 @@ class TradeBox extends Component {
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
<QRCode
|
<QRCode
|
||||||
|
bgColor={'rgba(255, 255, 255, 0)'}
|
||||||
|
fgColor={this.props.theme.palette.text.primary}
|
||||||
value={
|
value={
|
||||||
'tg://resolve?domain=' +
|
'tg://resolve?domain=' +
|
||||||
this.props.data.tg_bot_name +
|
this.props.data.tg_bot_name +
|
||||||
|
Loading…
Reference in New Issue
Block a user