mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
styling & tweaks: Improved settings styling and altered config
- Still WIP and many of those components are placeholder/proof of concept for now - Added corresponding default.json schemas for new settings - Also added two ringtones that are currently not being utilized
This commit is contained in:
1 parent
954ef6277c
commit
4c9ed764cc
7 files changed
+102
-13
No files matched your search
Binary file not shown.
Binary file not shown.
+1
-1
@@ -243,7 +243,7 @@ function Phone() {
|
|||||||
return (
|
return (
|
||||||
<ThemeProvider theme={currentTheme()}>
|
<ThemeProvider theme={currentTheme()}>
|
||||||
<div className='PhoneWrapper'>
|
<div className='PhoneWrapper'>
|
||||||
<div style={{ zoom: '100%' }}>
|
<div style={{ zoom: settings.zoom }}>
|
||||||
<div className='Phone'>
|
<div className='Phone'>
|
||||||
<div
|
<div
|
||||||
className='PhoneFrame'
|
className='PhoneFrame'
|
||||||
|
|||||||
@@ -1,18 +1,33 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { ListItem, ListItemText, Divider } from "@material-ui/core";
|
import {
|
||||||
|
ListItem,
|
||||||
|
ListItemText,
|
||||||
|
Divider,
|
||||||
|
ListItemIcon,
|
||||||
|
} from '@material-ui/core';
|
||||||
|
import { SvgIconProps } from '@material-ui/core';
|
||||||
interface IProps {
|
interface IProps {
|
||||||
options?: any;
|
options?: any;
|
||||||
label: string;
|
label: string;
|
||||||
value: string | null;
|
value?: string | null;
|
||||||
onClick?: any;
|
onClick?: any;
|
||||||
|
icon: JSX.Element;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SettingItem = ({ options, label, value, onClick }: IProps) => {
|
export const SettingItem = ({
|
||||||
|
options,
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
onClick,
|
||||||
|
icon,
|
||||||
|
disabled,
|
||||||
|
}: IProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListItem onClick={() => onClick(options)} button>
|
<ListItem onClick={() => onClick(options)} button>
|
||||||
<ListItemText primary={label} secondary={value} />
|
<ListItemIcon>{icon}</ListItemIcon>
|
||||||
|
<ListItemText primary={label} secondary={value ? value : undefined} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider />
|
<Divider />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -13,6 +13,24 @@ import { useSimcard } from '../../../os/simcard/hooks/useSimcard';
|
|||||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||||
import { SettingItem } from './SettingItem';
|
import { SettingItem } from './SettingItem';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Brush,
|
||||||
|
Wallpaper,
|
||||||
|
Phone,
|
||||||
|
Smartphone,
|
||||||
|
ZoomIn,
|
||||||
|
LibraryMusic,
|
||||||
|
VolumeUp,
|
||||||
|
} from '@material-ui/icons';
|
||||||
|
|
||||||
|
import { ListSubheader } from '@material-ui/core';
|
||||||
|
|
||||||
|
const SubHeaderComp = (props: { text: string }) => (
|
||||||
|
<ListSubheader component='div' disableSticky>
|
||||||
|
{props.text}
|
||||||
|
</ListSubheader>
|
||||||
|
);
|
||||||
|
|
||||||
export const SettingsApp = () => {
|
export const SettingsApp = () => {
|
||||||
const settingsApp = useApp('SETTINGS');
|
const settingsApp = useApp('SETTINGS');
|
||||||
const [config] = useConfig();
|
const [config] = useConfig();
|
||||||
@@ -20,40 +38,91 @@ export const SettingsApp = () => {
|
|||||||
const simcard = useSimcard();
|
const simcard = useSimcard();
|
||||||
|
|
||||||
const wallpapers = config.wallpapers.map(
|
const wallpapers = config.wallpapers.map(
|
||||||
MapStringOptions(settings.wallpaper, (val) => setSettings('wallpaper', val))
|
MapStringOptions(settings.wallpaper, (val: string) =>
|
||||||
|
setSettings('wallpaper', val)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
const frames = config.frames.map(
|
const frames = config.frames.map(
|
||||||
MapStringOptions(settings.frame, (val) => setSettings('frame', val))
|
MapStringOptions(settings.frame, (val: string) => setSettings('frame', val))
|
||||||
);
|
);
|
||||||
const themes = Object.keys(config.themes).map(
|
const themes = Object.keys(config.themes).map(
|
||||||
MapStringOptions(settings.theme, (val) => setSettings('theme', val))
|
MapStringOptions(settings.theme, (val: string) => setSettings('theme', val))
|
||||||
);
|
);
|
||||||
|
const zoomOptions = config.zoomOptions.map(
|
||||||
|
MapStringOptions(settings.zoom, (val: string) => setSettings('zoom', val))
|
||||||
|
);
|
||||||
|
// Doesn't actually do anything for the time being
|
||||||
|
const ringtones = config.ringtones.map(
|
||||||
|
MapStringOptions(settings.ringtone, (val: string) =>
|
||||||
|
setSettings('ringtone', val)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// * Probably gonna make this a slider component in the future
|
||||||
|
// const ringtoneVols = config.ringtoneVols.map(
|
||||||
|
// MapStringOptions(settings.ringtoneVol, (val: number) => setSettings('ringtoneVol', val))
|
||||||
|
// )
|
||||||
|
|
||||||
|
// TODO: These new settings all work
|
||||||
|
|
||||||
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
||||||
return (
|
return (
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
<AppTitle app={settingsApp} />
|
<AppTitle app={settingsApp} />
|
||||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||||
<List disablePadding>
|
<List disablePadding subheader={<SubHeaderComp text='Phone' />}>
|
||||||
|
<SettingItem
|
||||||
|
label='Phone Number'
|
||||||
|
value={simcard.number}
|
||||||
|
icon={<Phone />}
|
||||||
|
/>
|
||||||
|
<SettingItem
|
||||||
|
label='Ringtone'
|
||||||
|
value={settings.ringtone}
|
||||||
|
options={ringtones}
|
||||||
|
onClick={openMenu}
|
||||||
|
icon={<LibraryMusic />}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
// * NOTE: This component is most likely temporary
|
||||||
|
// * Probably want to make it a slider in the future. Ignore hardcoded for the meantime
|
||||||
|
}
|
||||||
|
<SettingItem
|
||||||
|
label='Ringtone Volume'
|
||||||
|
value='100%'
|
||||||
|
options={['100%', '80%', '70%']}
|
||||||
|
onClick={openMenu}
|
||||||
|
icon={<VolumeUp />}
|
||||||
|
/>
|
||||||
|
</List>
|
||||||
|
<List disablePadding subheader={<SubHeaderComp text='Appearance' />}>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label='Theme'
|
label='Theme'
|
||||||
value={settings.theme}
|
value={settings.theme}
|
||||||
options={themes}
|
options={themes}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
|
icon={<Brush />}
|
||||||
/>
|
/>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label='Wallpaper'
|
label='Wallpaper'
|
||||||
value={settings.wallpaper}
|
value={settings.wallpaper}
|
||||||
options={wallpapers}
|
options={wallpapers}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
|
icon={<Wallpaper />}
|
||||||
/>
|
/>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label='Frame'
|
label='Frame'
|
||||||
value={settings.frame}
|
value={settings.frame}
|
||||||
options={frames}
|
options={frames}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
|
icon={<Smartphone />}
|
||||||
|
/>
|
||||||
|
<SettingItem
|
||||||
|
label='Zoom'
|
||||||
|
value={settings.zoom}
|
||||||
|
options={zoomOptions}
|
||||||
|
onClick={openMenu}
|
||||||
|
icon={<ZoomIn />}
|
||||||
/>
|
/>
|
||||||
<SettingItem label='Phone Number' value={simcard.number} />
|
|
||||||
</List>
|
</List>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<ContextMenu />
|
<ContextMenu />
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"wallpaper": "default.png",
|
"wallpaper": "default.png",
|
||||||
"frame": "s10.png",
|
"frame": "s10.png",
|
||||||
"theme": "taso-dark"
|
"theme": "taso-dark",
|
||||||
|
"zoom": "100%",
|
||||||
|
"ringtone": "pixel",
|
||||||
|
"ringtoneVol": 100
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
"beach.jpg"
|
"beach.jpg"
|
||||||
],
|
],
|
||||||
"frames": ["default.png", "s10.png", "tw.png", "samsung.png"],
|
"frames": ["default.png", "s10.png", "tw.png", "samsung.png"],
|
||||||
|
"zoomOptions": ["120%", "100%", "80%", "60%", "40%"],
|
||||||
|
"ringtones": ["marimba", "pixel"],
|
||||||
"themes": {
|
"themes": {
|
||||||
"default-dark": {
|
"default-dark": {
|
||||||
"palette": {
|
"palette": {
|
||||||
|
|||||||
Reference in new issue
Block a user