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:
Taso committed 2020-11-19 11:31:16 -05:00
1 parent 954ef6277c
commit 4c9ed764cc
7 files changed
+102 -13

No files matched your search

+1 -1
View File
@@ -243,7 +243,7 @@ function Phone() {
return (
<ThemeProvider theme={currentTheme()}>
<div className='PhoneWrapper'>
<div style={{ zoom: '100%' }}>
<div style={{ zoom: settings.zoom }}>
<div className='Phone'>
<div
className='PhoneFrame'
@@ -1,18 +1,33 @@
import React from "react";
import { ListItem, ListItemText, Divider } from "@material-ui/core";
import React from 'react';
import {
ListItem,
ListItemText,
Divider,
ListItemIcon,
} from '@material-ui/core';
import { SvgIconProps } from '@material-ui/core';
interface IProps {
options?: any;
label: string;
value: string | null;
value?: string | null;
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 (
<>
<ListItem onClick={() => onClick(options)} button>
<ListItemText primary={label} secondary={value} />
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={label} secondary={value ? value : undefined} />
</ListItem>
<Divider />
</>
@@ -13,6 +13,24 @@ import { useSimcard } from '../../../os/simcard/hooks/useSimcard';
import { useApp } from '../../../os/apps/hooks/useApps';
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 = () => {
const settingsApp = useApp('SETTINGS');
const [config] = useConfig();
@@ -20,40 +38,91 @@ export const SettingsApp = () => {
const simcard = useSimcard();
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(
MapStringOptions(settings.frame, (val) => setSettings('frame', val))
MapStringOptions(settings.frame, (val: string) => setSettings('frame', val))
);
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();
return (
<AppWrapper>
<AppTitle app={settingsApp} />
<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
label='Theme'
value={settings.theme}
options={themes}
onClick={openMenu}
icon={<Brush />}
/>
<SettingItem
label='Wallpaper'
value={settings.wallpaper}
options={wallpapers}
onClick={openMenu}
icon={<Wallpaper />}
/>
<SettingItem
label='Frame'
value={settings.frame}
options={frames}
onClick={openMenu}
icon={<Smartphone />}
/>
<SettingItem
label='Zoom'
value={settings.zoom}
options={zoomOptions}
onClick={openMenu}
icon={<ZoomIn />}
/>
<SettingItem label='Phone Number' value={simcard.number} />
</List>
</AppContent>
<ContextMenu />
+4 -1
View File
@@ -1,5 +1,8 @@
{
"wallpaper": "default.png",
"frame": "s10.png",
"theme": "taso-dark"
"theme": "taso-dark",
"zoom": "100%",
"ringtone": "pixel",
"ringtoneVol": 100
}
+2
View File
@@ -11,6 +11,8 @@
"beach.jpg"
],
"frames": ["default.png", "s10.png", "tw.png", "samsung.png"],
"zoomOptions": ["120%", "100%", "80%", "60%", "40%"],
"ringtones": ["marimba", "pixel"],
"themes": {
"default-dark": {
"palette": {