diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index a80f7f0..3c5ad65 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -104,9 +104,10 @@ function Phone() { id="phone" className="PhoneScreen" style={{ - backgroundImage: settings.customWallpaper - ? `url(${settings.customWallpaper})` - : `url(media/backgrounds/${settings.wallpaper.value})`, + backgroundImage: + settings.wallpaper.label === 'Custom Wallpaper' + ? `url(${settings.customWallpaper})` + : `url(media/backgrounds/${settings.wallpaper.value})`, }} > {isPhoneReady ? ( diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 336f393..b838228 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -109,15 +109,3 @@ export const SettingItemIconAction = ({ ); - -export const SettingItemModal = ({ icon, label, secondary, onClick }) => ( - - {icon} - - - - - - - -); diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index e740a5c..a4d2c1a 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; @@ -12,7 +12,6 @@ import { SettingItemIconAction, SettingItemSlider, SettingSwitch, - SettingItemModal, } from './SettingItem'; import { useTranslation } from 'react-i18next'; import VisibilityOffIcon from '@material-ui/icons/VisibilityOff'; @@ -73,9 +72,12 @@ export const SettingsApp = () => { }; const wallpapers = config.wallpapers.map( - MapSettingItem(settings.wallpaper, (val: SettingOption) => - handleSettingChange('wallpaper', val), - ), + MapSettingItem(settings.wallpaper, (val: SettingOption) => { + if (val.label === 'Custom Wallpaper') { + setCustomWallpaperModal(true); + } + return handleSettingChange('wallpaper', val); + }), ); const frames = config.frames.map( MapSettingItem(settings.frame, (val: SettingOption) => handleSettingChange('frame', val)), @@ -213,13 +215,6 @@ export const SettingsApp = () => { onClick={openMenu} icon={} /> - {/* CUSTOM BACKGROUND */} - } - label={t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')} - secondary={settings.customWallpaper} - onClick={() => setCustomWallpaperModal(true)} - /> { - handleSettingChange('customWallpaper', value); - }; - - const handleRemoveWallpaper = () => { - handleSettingChange('customWallpaper', ''); + handleSettingChange('wallpaper', { label: 'Custom Wallpaper', value }); + setCustomWallpaperModal(false); }; return ( @@ -59,6 +56,7 @@ export default function WallpaperModal() { setValue(e.currentTarget.value)} inputProps={{ @@ -75,11 +73,6 @@ export default function WallpaperModal() { > {t('APPS_SETTINGS_SET_CUSTOM_WALLPAPER')} - {settings.customWallpaper && ( - - {t('GENERIC_DELETE')} - - )} ); diff --git a/phone/src/config/default.json b/phone/src/config/default.json index 5516dd0..4c6dc6e 100644 --- a/phone/src/config/default.json +++ b/phone/src/config/default.json @@ -17,6 +17,10 @@ { "label": "Project Error", "value": "projecterror.jpg" + }, + { + "label": "Custom Wallpaper", + "value": "" } ], "frames": [