tweak(phone/settings): simplify some things

This commit is contained in:
Christopher committed 2021-03-31 05:05:55 +02:00
1 parent c0cca9ceb8
commit 4c73f66ab5
4 files changed
+11 -13

No files matched your search

+2 -2
View File
@@ -105,8 +105,8 @@ function Phone() {
className="PhoneScreen" className="PhoneScreen"
style={{ style={{
backgroundImage: backgroundImage:
settings.wallpaper.label === 'Custom Wallpaper' settings.wallpaper.label === t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')
? `url(${settings.customWallpaper})` ? `url(${settings.wallpaper.value})`
: `url(media/backgrounds/${settings.wallpaper.value})`, : `url(media/backgrounds/${settings.wallpaper.value})`,
}} }}
> >
@@ -12,8 +12,6 @@ import {
Switch, Switch,
TextField, TextField,
} from '@material-ui/core'; } from '@material-ui/core';
import CreateIcon from '@material-ui/icons/Create';
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
interface ISettingItem { interface ISettingItem {
options?: any; options?: any;
@@ -73,10 +73,7 @@ export const SettingsApp = () => {
const wallpapers = config.wallpapers.map( const wallpapers = config.wallpapers.map(
MapSettingItem(settings.wallpaper, (val: SettingOption) => { MapSettingItem(settings.wallpaper, (val: SettingOption) => {
if (val.label === 'Custom Wallpaper') { handleSettingChange('wallpaper', val);
setCustomWallpaperModal(true);
}
return handleSettingChange('wallpaper', val);
}), }),
); );
const frames = config.frames.map( const frames = config.frames.map(
@@ -130,6 +127,13 @@ export const SettingsApp = () => {
}, },
]; ];
const customWallpaper: IContextMenuOption = {
selected: false,
onClick: () => setCustomWallpaperModal(true),
key: 'CUSTOM_WALLPAPER',
label: t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER'),
};
const handleCopyPhoneNumber = () => { const handleCopyPhoneNumber = () => {
setClipboard(simcard.number); setClipboard(simcard.number);
addAlert({ addAlert({
@@ -211,7 +215,7 @@ export const SettingsApp = () => {
<SettingItem <SettingItem
label={t('APPS_SETTINGS_OPTION_WALLPAPER')} label={t('APPS_SETTINGS_OPTION_WALLPAPER')}
value={settings.wallpaper.label} value={settings.wallpaper.label}
options={wallpapers} options={[...wallpapers, customWallpaper]}
onClick={openMenu} onClick={openMenu}
icon={<Wallpaper />} icon={<Wallpaper />}
/> />
-4
View File
@@ -17,10 +17,6 @@
{ {
"label": "Project Error", "label": "Project Error",
"value": "projecterror.jpg" "value": "projecterror.jpg"
},
{
"label": "Custom Wallpaper",
"value": ""
} }
], ],
"frames": [ "frames": [