mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Change themes!!!
This commit is contained in:
1 parent
bc20bfac99
commit
362ab8be4d
7 files changed
+82
-21
No files matched your search
+4
-2
@@ -17,14 +17,16 @@
|
|||||||
z-index: 999;
|
z-index: 999;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 1000px;
|
height: 1000px;
|
||||||
pointer-events:none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.PhoneScreen {
|
.PhoneScreen {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
border: 8px solid black;
|
border-top: 2px solid black;
|
||||||
|
border-left: 4px solid black;
|
||||||
|
border-right: 4px solid black;
|
||||||
bottom: 100px;
|
bottom: 100px;
|
||||||
left: 50px;
|
left: 50px;
|
||||||
right: 50px;
|
right: 50px;
|
||||||
|
|||||||
+1
-1
@@ -1,12 +1,12 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import "./Phone.css";
|
import "./Phone.css";
|
||||||
import "./i18n";
|
import "./i18n";
|
||||||
import MessageIcon from "@material-ui/icons/Email";
|
|
||||||
import { Route } from "react-router-dom";
|
import { Route } from "react-router-dom";
|
||||||
import { useSettings } from "./apps/settings/hooks/useSettings";
|
import { useSettings } from "./apps/settings/hooks/useSettings";
|
||||||
import { NotificationBar } from "./os/components/NotificationBar";
|
import { NotificationBar } from "./os/components/NotificationBar";
|
||||||
import { NotificationIcon } from "./os/components/NotificationIcon";
|
import { NotificationIcon } from "./os/components/NotificationIcon";
|
||||||
import { NavigationBar } from "./os/components/NavigationBar";
|
import { NavigationBar } from "./os/components/NavigationBar";
|
||||||
|
import MessageIcon from "@material-ui/icons/Email";
|
||||||
|
|
||||||
import { HomeApp } from "./apps/home/components/Home";
|
import { HomeApp } from "./apps/home/components/Home";
|
||||||
import { ContactsApp } from "./apps/contacts/components/Contacts";
|
import { ContactsApp } from "./apps/contacts/components/Contacts";
|
||||||
|
|||||||
@@ -4,34 +4,64 @@ import { List, ListItem, ListItemText } from "@material-ui/core";
|
|||||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||||
import { AppContent } from "../../../ui/components/AppContent";
|
import { AppContent } from "../../../ui/components/AppContent";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useContextMenu } from "../../../ui/hooks/useContextMenu";
|
import {
|
||||||
|
useContextMenu,
|
||||||
|
MapStringOptions,
|
||||||
|
} from "../../../ui/hooks/useContextMenu";
|
||||||
import { useConfig } from "../../../config/hooks/useConfig";
|
import { useConfig } from "../../../config/hooks/useConfig";
|
||||||
import { useSettings } from "../hooks/useSettings";
|
import { useSettings } from "../hooks/useSettings";
|
||||||
import { useApps } from "../../appmarket/hooks/useApps";
|
import { useApps } from "../../appmarket/hooks/useApps";
|
||||||
|
|
||||||
|
export const SettingItem = ({ options, label, value, onClick }) => {
|
||||||
|
return (
|
||||||
|
<ListItem onClick={() => onClick(options)} button>
|
||||||
|
<ListItemText primary={label} secondary={value} />
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const SettingsApp = () => {
|
export const SettingsApp = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [config] = useConfig();
|
const [config] = useConfig();
|
||||||
const { getApp } = useApps();
|
const { getApp } = useApps();
|
||||||
const { setSettings, settings } = useSettings();
|
const { setSettings, settings } = useSettings();
|
||||||
|
|
||||||
const wallpaperOptions = config.wallpapers.map((w) => ({
|
const wallpapers = config.wallpapers.map(
|
||||||
label: w,
|
MapStringOptions(settings.wallpaper, (val) => setSettings("wallpaper", val))
|
||||||
key: w,
|
|
||||||
onClick: () => setSettings("wallpaper", w),
|
|
||||||
}));
|
|
||||||
|
|
||||||
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(
|
|
||||||
wallpaperOptions
|
|
||||||
);
|
);
|
||||||
|
const frames = config.frames.map(
|
||||||
|
MapStringOptions(settings.frame, (val) => setSettings("frame", val))
|
||||||
|
);
|
||||||
|
const themes = Object.keys(config.themes).map(
|
||||||
|
MapStringOptions(settings.theme, (val) => setSettings("theme", val))
|
||||||
|
);
|
||||||
|
|
||||||
|
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
||||||
return (
|
return (
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
<AppTitle color={getApp("settings").backgroundColor}>{t("APPS_SETTINGS")}</AppTitle>
|
<AppTitle color={getApp("settings").backgroundColor}>
|
||||||
|
{t("APPS_SETTINGS")}
|
||||||
|
</AppTitle>
|
||||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||||
<List>
|
<List>
|
||||||
<ListItem onClick={openMenu} button>
|
<SettingItem
|
||||||
<ListItemText primary={t("APPS_SETTINGS_OPTIONS_WALLPAPER")} secondary={settings.wallpaper} />
|
label="Theme"
|
||||||
</ListItem>
|
value={settings.theme}
|
||||||
|
options={themes}
|
||||||
|
onClick={openMenu}
|
||||||
|
/>
|
||||||
|
<SettingItem
|
||||||
|
label="Wallpaper"
|
||||||
|
value={settings.wallpaper}
|
||||||
|
options={wallpapers}
|
||||||
|
onClick={openMenu}
|
||||||
|
/>
|
||||||
|
<SettingItem
|
||||||
|
label="Frame"
|
||||||
|
value={settings.frame}
|
||||||
|
options={frames}
|
||||||
|
onClick={openMenu}
|
||||||
|
/>
|
||||||
</List>
|
</List>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<ContextMenu />
|
<ContextMenu />
|
||||||
|
|||||||
@@ -2,11 +2,17 @@
|
|||||||
"4gNetowrk": "AT&T",
|
"4gNetowrk": "AT&T",
|
||||||
"language": "en_US",
|
"language": "en_US",
|
||||||
"wallpapers": ["default.png", "dragon.jpg", "legacy.jpg"],
|
"wallpapers": ["default.png", "dragon.jpg", "legacy.jpg"],
|
||||||
|
"frames": ["default.png", "s10.png"],
|
||||||
"themes": {
|
"themes": {
|
||||||
"default-dark": {
|
"default-dark": {
|
||||||
"palette": {
|
"palette": {
|
||||||
"type": "dark"
|
"type": "dark"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"default-light": {
|
||||||
|
"palette": {
|
||||||
|
"type": "light"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -5,6 +5,7 @@
|
|||||||
"APPS_CONTACTS": "Contacts",
|
"APPS_CONTACTS": "Contacts",
|
||||||
"APPS_MESSAGES": "Messages",
|
"APPS_MESSAGES": "Messages",
|
||||||
"APPS_SETTINGS": "Settings",
|
"APPS_SETTINGS": "Settings",
|
||||||
"APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper"
|
"APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper",
|
||||||
|
"APPS_SETTINGS_OPTIONS_FRAME": "Frame"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
},
|
},
|
||||||
@@ -26,6 +26,7 @@ export const ContextMenu = ({ open, onClose, options }) => {
|
|||||||
<List aria-label="context menu">
|
<List aria-label="context menu">
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
|
selected={option.selected}
|
||||||
button
|
button
|
||||||
key={option.key || option.label}
|
key={option.key || option.label}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { ContextMenu } from "../components/ContextMenu";
|
import { ContextMenu } from "../components/ContextMenu";
|
||||||
|
|
||||||
export const useContextMenu = (options = []) => {
|
export const MapStringOptions = (current, onClick) => (string) => {
|
||||||
|
return {
|
||||||
|
selected: current === string,
|
||||||
|
label: string,
|
||||||
|
key: string,
|
||||||
|
onClick: () => onClick(string)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useContextMenu = (_options = []) => {
|
||||||
const [open, setOpen] = useState();
|
const [open, setOpen] = useState();
|
||||||
|
const [options, setOptions] = useState(_options);
|
||||||
|
|
||||||
const onClose = () => setOpen(false);
|
const onClose = () => setOpen(false);
|
||||||
const onOpen = () => setOpen(true);
|
|
||||||
return [onOpen, onClose, () => <ContextMenu open={open} onClose={onClose} options={options} />, open]
|
const onOpen = (opts) => {
|
||||||
|
setOptions(opts);
|
||||||
|
setOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
onOpen,
|
||||||
|
onClose,
|
||||||
|
() => <ContextMenu open={open} onClose={onClose} options={options} />,
|
||||||
|
open,
|
||||||
|
];
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user