mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
tweak(phone/settings): simplify custom background
This commit is contained in:
1 parent
3157cafd5a
commit
c0cca9ceb8
5 files changed
+16
-35
No files matched your search
+2
-1
@@ -104,7 +104,8 @@ function Phone() {
|
|||||||
id="phone"
|
id="phone"
|
||||||
className="PhoneScreen"
|
className="PhoneScreen"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: settings.customWallpaper
|
backgroundImage:
|
||||||
|
settings.wallpaper.label === 'Custom Wallpaper'
|
||||||
? `url(${settings.customWallpaper})`
|
? `url(${settings.customWallpaper})`
|
||||||
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -109,15 +109,3 @@ export const SettingItemIconAction = ({
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const SettingItemModal = ({ icon, label, secondary, onClick }) => (
|
|
||||||
<ListItem divider>
|
|
||||||
<ListItemIcon>{icon}</ListItemIcon>
|
|
||||||
<ListItemText primary={label} secondary={secondary} />
|
|
||||||
<ListItemSecondaryAction>
|
|
||||||
<IconButton onClick={onClick}>
|
|
||||||
<CreateIcon />
|
|
||||||
</IconButton>
|
|
||||||
</ListItemSecondaryAction>
|
|
||||||
</ListItem>
|
|
||||||
);
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { AppWrapper } from '../../../ui/components';
|
import { AppWrapper } from '../../../ui/components';
|
||||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||||
import { AppContent } from '../../../ui/components/AppContent';
|
import { AppContent } from '../../../ui/components/AppContent';
|
||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
SettingItemIconAction,
|
SettingItemIconAction,
|
||||||
SettingItemSlider,
|
SettingItemSlider,
|
||||||
SettingSwitch,
|
SettingSwitch,
|
||||||
SettingItemModal,
|
|
||||||
} from './SettingItem';
|
} from './SettingItem';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
|
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
|
||||||
@@ -73,9 +72,12 @@ export const SettingsApp = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wallpapers = config.wallpapers.map(
|
const wallpapers = config.wallpapers.map(
|
||||||
MapSettingItem(settings.wallpaper, (val: SettingOption) =>
|
MapSettingItem(settings.wallpaper, (val: SettingOption) => {
|
||||||
handleSettingChange('wallpaper', val),
|
if (val.label === 'Custom Wallpaper') {
|
||||||
),
|
setCustomWallpaperModal(true);
|
||||||
|
}
|
||||||
|
return handleSettingChange('wallpaper', val);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
const frames = config.frames.map(
|
const frames = config.frames.map(
|
||||||
MapSettingItem(settings.frame, (val: SettingOption) => handleSettingChange('frame', val)),
|
MapSettingItem(settings.frame, (val: SettingOption) => handleSettingChange('frame', val)),
|
||||||
@@ -213,13 +215,6 @@ export const SettingsApp = () => {
|
|||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
icon={<Wallpaper />}
|
icon={<Wallpaper />}
|
||||||
/>
|
/>
|
||||||
{/* CUSTOM BACKGROUND */}
|
|
||||||
<SettingItemModal
|
|
||||||
icon={<Wallpaper />}
|
|
||||||
label={t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')}
|
|
||||||
secondary={settings.customWallpaper}
|
|
||||||
onClick={() => setCustomWallpaperModal(true)}
|
|
||||||
/>
|
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label={t('APPS_SETTINGS_OPTION_FRAME')}
|
label={t('APPS_SETTINGS_OPTION_FRAME')}
|
||||||
value={settings.frame.label}
|
value={settings.frame.label}
|
||||||
|
|||||||
@@ -37,11 +37,8 @@ export default function WallpaperModal() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNewWallpaper = () => {
|
const handleNewWallpaper = () => {
|
||||||
handleSettingChange('customWallpaper', value);
|
handleSettingChange('wallpaper', { label: 'Custom Wallpaper', value });
|
||||||
};
|
setCustomWallpaperModal(false);
|
||||||
|
|
||||||
const handleRemoveWallpaper = () => {
|
|
||||||
handleSettingChange('customWallpaper', '');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -59,6 +56,7 @@ export default function WallpaperModal() {
|
|||||||
<TextField
|
<TextField
|
||||||
value={value}
|
value={value}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
size="small"
|
||||||
className={classes.input}
|
className={classes.input}
|
||||||
onChange={(e) => setValue(e.currentTarget.value)}
|
onChange={(e) => setValue(e.currentTarget.value)}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
@@ -75,11 +73,6 @@ export default function WallpaperModal() {
|
|||||||
>
|
>
|
||||||
{t('APPS_SETTINGS_SET_CUSTOM_WALLPAPER')}
|
{t('APPS_SETTINGS_SET_CUSTOM_WALLPAPER')}
|
||||||
</Button>
|
</Button>
|
||||||
{settings.customWallpaper && (
|
|
||||||
<StatusButton color="error" variant="contained" onClick={handleRemoveWallpaper}>
|
|
||||||
{t('GENERIC_DELETE')}
|
|
||||||
</StatusButton>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
{
|
{
|
||||||
"label": "Project Error",
|
"label": "Project Error",
|
||||||
"value": "projecterror.jpg"
|
"value": "projecterror.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Custom Wallpaper",
|
||||||
|
"value": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"frames": [
|
"frames": [
|
||||||
|
|||||||
Reference in new issue
Block a user