mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +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
@@ -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 />
|
||||
|
||||
Reference in new issue
Block a user