mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
tweak(phone/settings): custom wallpaper dialog
This commit is contained in:
1 parent
e268dae34b
commit
bb8d765bc6
5 files changed
+20
-36
No files matched your search
+4
-4
@@ -33,6 +33,7 @@ import WindowSnackbar from './ui/components/WindowSnackbar';
|
||||
import { usePhone } from './os/phone/hooks/usePhone';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSnackbar } from './ui/hooks/useSnackbar';
|
||||
import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
|
||||
|
||||
function Phone() {
|
||||
const { t, i18n } = useTranslation();
|
||||
@@ -104,10 +105,9 @@ function Phone() {
|
||||
id="phone"
|
||||
className="PhoneScreen"
|
||||
style={{
|
||||
backgroundImage:
|
||||
settings.wallpaper.label === t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')
|
||||
? `url(${settings.wallpaper.value})`
|
||||
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||
backgroundImage: !isDefaultWallpaper(settings.wallpaper.value)
|
||||
? `url(${settings.wallpaper.value})`
|
||||
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||
}}
|
||||
>
|
||||
{isPhoneReady ? (
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useCustomWallpaperModal, useSettings } from '../hooks/useSettings';
|
||||
import { Box, Button, TextField, Typography } from '@material-ui/core';
|
||||
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
|
||||
import { TextField } from '@material-ui/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import DialogForm from '../../../ui/components/DialogForm';
|
||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
input: {
|
||||
marginTop: 10,
|
||||
marginBottom: 10,
|
||||
},
|
||||
inputProps: {
|
||||
fontSize: 18,
|
||||
},
|
||||
});
|
||||
|
||||
export default function WallpaperModal() {
|
||||
const { customWallpaperModal, setCustomWallpaperModal } = useCustomWallpaperModal();
|
||||
const [settings, setSettings] = useSettings();
|
||||
@@ -40,7 +28,7 @@ export default function WallpaperModal() {
|
||||
});
|
||||
setCustomWallpaperModal(false);
|
||||
} else {
|
||||
addAlert({ message: t('APPS_SETTINGS_INVALID_WALLPAPER'), type: 'error' });
|
||||
addAlert({ message: t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_ERROR'), type: 'error' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,13 +37,14 @@ export default function WallpaperModal() {
|
||||
open={customWallpaperModal}
|
||||
handleClose={() => setCustomWallpaperModal(false)}
|
||||
onSubmit={handleNewWallpaper}
|
||||
title="Custom wallpaper"
|
||||
content="Set a custom wallpaper by entering the URL of the image below!"
|
||||
title={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_TITLE')}
|
||||
content={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_CONTENT')}
|
||||
>
|
||||
<TextField
|
||||
value={value}
|
||||
error={!isImageAndUrl(value) && true}
|
||||
onChange={(e) => setValue(e.currentTarget.value)}
|
||||
placeholder="Image URL"
|
||||
placeholder={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_PLACEHOLDER')}
|
||||
fullWidth
|
||||
/>
|
||||
</DialogForm>
|
||||
|
||||
@@ -23,7 +23,6 @@ const settingsSchema: Schema = {
|
||||
properties: {
|
||||
language: { $ref: '/SettingOption' },
|
||||
wallpaper: { $ref: '/SettingOption' },
|
||||
customWallpaper: { type: 'string' },
|
||||
frame: { $ref: '/SettingOption' },
|
||||
theme: { $ref: '/SettingOption' },
|
||||
zoom: { $ref: '/SettingOption' },
|
||||
@@ -64,7 +63,6 @@ export function isSettingsSchemaValid(): boolean {
|
||||
export interface IPhoneSettings {
|
||||
language: SettingOption;
|
||||
wallpaper: SettingOption;
|
||||
customWallpaper: string;
|
||||
frame: SettingOption;
|
||||
theme: SettingOption;
|
||||
zoom: SettingOption;
|
||||
|
||||
@@ -11,7 +11,13 @@
|
||||
"OPTIONS": {
|
||||
"LANGUAGE": "Language",
|
||||
"RESET_SETTINGS": "Reset Settings",
|
||||
"RESET_SETTINGS_DESC": "This will clear your locally stored data"
|
||||
"RESET_SETTINGS_DESC": "This will clear your locally stored data",
|
||||
"CUSTOM_WALLPAPER": {
|
||||
"DIALOG_TITLE": "Custom Wallpaper",
|
||||
"DIALOG_CONTENT": "Set a custom wallpaper by entering the URL of the image below!",
|
||||
"DIALOG_PLACEHOLDER": "Image URL",
|
||||
"DIALOG_ERROR": "Invalid image or link"
|
||||
}
|
||||
},
|
||||
"MESSAGES": {
|
||||
"INVALID_SETTINGS": "Invalid stored settings! Please reset in the Settings App.",
|
||||
@@ -195,8 +201,6 @@
|
||||
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
|
||||
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
|
||||
"APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown",
|
||||
"APPS_SETTINGS_SET_CUSTOM_WALLPAPER": "Set new wallpaper",
|
||||
"APPS_SETTINGS_INVALID_WALLPAPER": "Not a valid image or link!",
|
||||
|
||||
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
|
||||
"APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Failed to create a new listing",
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import {
|
||||
Button,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
Paper,
|
||||
TextField,
|
||||
} from '@material-ui/core';
|
||||
import { Button, DialogContent, DialogContentText, DialogTitle, Paper } from '@material-ui/core';
|
||||
import DialogActions from '@material-ui/core/DialogActions';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
@@ -33,7 +26,7 @@ const useStyles = makeStyles({
|
||||
},
|
||||
});
|
||||
|
||||
interface DialogForm {
|
||||
interface DialogFormProps {
|
||||
children: React.ReactNode;
|
||||
open: boolean;
|
||||
handleClose: any; // No idea what those types are
|
||||
@@ -49,7 +42,7 @@ export default function DialogForm({
|
||||
onSubmit,
|
||||
title,
|
||||
content,
|
||||
}: DialogForm) {
|
||||
}: DialogFormProps) {
|
||||
const classes = useStyles();
|
||||
|
||||
const showHideClassName = open ? classes.displayBlock : classes.displayNone;
|
||||
|
||||
Reference in new issue
Block a user