diff --git a/src/Phone.js b/src/Phone.js index a6aad6d..68f19b7 100644 --- a/src/Phone.js +++ b/src/Phone.js @@ -11,9 +11,12 @@ import { NavigationBar } from "./os/components/NavigationBar"; import { HomeApp } from "./apps/home/components/Home"; import { ContactsApp } from "./apps/contacts/components/Contacts"; import { SettingsApp } from "./apps/settings/components/Settings"; +import { ThemeProvider, createMuiTheme } from "@material-ui/core"; +import { useConfig } from "./config/hooks/useConfig"; function Phone() { const { settings } = useSettings(); + const [config] = useConfig(); return (
@@ -24,23 +27,25 @@ function Phone() { backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`, }} >
-
- ]} - /> -
- - - + +
+ ]} + /> +
+ + + +
+
- -
+
diff --git a/src/apps/appmarket/hooks/useApps.js b/src/apps/appmarket/hooks/useApps.js index fdea817..31256c1 100644 --- a/src/apps/appmarket/hooks/useApps.js +++ b/src/apps/appmarket/hooks/useApps.js @@ -8,7 +8,7 @@ import { atom } from "recoil"; const appsState = atom({ key: 'apps', - default: null + default: { preinstalled: [] } }); export const useApps = () => { @@ -17,6 +17,7 @@ export const useApps = () => { useEffect(() => { setApps("preinstalled", [ { + id: 'contacts', name: t('APPS_CONTACTS'), icon: , backgroundColor: blue[500], @@ -24,6 +25,7 @@ export const useApps = () => { path: '/contacts' }, { + id: 'settings', name: t('APPS_SETTINGS'), icon: , backgroundColor: grey[700], @@ -34,5 +36,9 @@ export const useApps = () => { // eslint-disable-next-line }, []); - return { apps, setApps }; + const allApps = [...apps.preinstalled]; + + const getApp = id => allApps.find(a => a.id === id) || {}; + + return { apps, allApps, setApps, getApp }; }; diff --git a/src/apps/contacts/components/ContactList.js b/src/apps/contacts/components/ContactList.js index 306dfd2..17e3366 100644 --- a/src/apps/contacts/components/ContactList.js +++ b/src/apps/contacts/components/ContactList.js @@ -1,5 +1,4 @@ import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemText from "@material-ui/core/ListItemText"; @@ -8,31 +7,19 @@ import { Button } from "@material-ui/core"; import PhoneIcon from "@material-ui/icons/Phone"; import ChatIcon from "@material-ui/icons/Chat"; -const useStyles = makeStyles((theme) => ({ - root: { - width: "100%", - maxWidth: 360, - color: "#fff", - }, - listItem: { - color: "#fff", - }, -})); - export const ContactList = ({ contacts, onCall, onMessage }) => { - const classes = useStyles(); return ( - + {contacts.map((contact) => ( - + - - diff --git a/src/apps/contacts/components/Contacts.js b/src/apps/contacts/components/Contacts.js index 6bf3598..a64af01 100644 --- a/src/apps/contacts/components/Contacts.js +++ b/src/apps/contacts/components/Contacts.js @@ -1,33 +1,27 @@ import React from "react"; import { AppWrapper } from "../../../ui/components"; -import { makeStyles } from "@material-ui/core"; -import lightBlue from "@material-ui/core/colors/lightBlue"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppContent } from "../../../ui/components/AppContent"; import { useTranslation } from "react-i18next"; import { useContacts } from "../hooks/useContacts"; -import { ContactList } from './ContactList'; - - -const useStyles = makeStyles(() => ({ - root: { - backgroundColor: '#232323', - }, - title: { - backgroundColor: lightBlue[300], - textAlign: 'center' - }, -})); +import { ContactList } from "./ContactList"; +import { useApps } from "../../appmarket/hooks/useApps"; export const ContactsApp = () => { - const classes = useStyles(); const { contactList } = useContacts(); + const { getApp } = useApps(); const { t } = useTranslation(); return ( - - {t("APPS_CONTACTS")} + + + {t("APPS_CONTACTS")} + - console.log("Calling")} onMessage={() => console.log("Opening messages")}/> + console.log("Calling")} + onMessage={() => console.log("Opening messages")} + /> ); diff --git a/src/apps/contacts/hooks/useContacts.js b/src/apps/contacts/hooks/useContacts.js index 30251a7..56b6951 100644 --- a/src/apps/contacts/hooks/useContacts.js +++ b/src/apps/contacts/hooks/useContacts.js @@ -4,10 +4,12 @@ const contactListState = atom({ key: "contactList", default: [ { + id: 0, display: "Test Contact", phoneNumber: "000-1111", }, { + id: 1, display: "Test Contact 2", phoneNumber: "000-1112", }, diff --git a/src/apps/settings/components/Settings.js b/src/apps/settings/components/Settings.js index f990844..5552b35 100644 --- a/src/apps/settings/components/Settings.js +++ b/src/apps/settings/components/Settings.js @@ -1,31 +1,23 @@ import React from "react"; import { AppWrapper } from "../../../ui/components"; -import { makeStyles, List, ListItem } from "@material-ui/core"; +import { List, ListItem, ListItemText } from "@material-ui/core"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppContent } from "../../../ui/components/AppContent"; import { useTranslation } from "react-i18next"; -import { grey } from "@material-ui/core/colors"; import { useContextMenu } from "../../../ui/hooks/useContextMenu"; import { useConfig } from "../../../config/hooks/useConfig"; import { useSettings } from "../hooks/useSettings"; - -const useStyles = makeStyles(() => ({ - root: { - backgroundColor: grey[50], - }, - title: { - backgroundColor: grey[600], - }, -})); +import { useApps } from "../../appmarket/hooks/useApps"; export const SettingsApp = () => { - const classes = useStyles(); const { t } = useTranslation(); const [config] = useConfig(); - const { setSettings } = useSettings(); + const { getApp } = useApps(); + const { setSettings, settings } = useSettings(); const wallpaperOptions = config.wallpapers.map((w) => ({ label: w, + key: w, onClick: () => setSettings("wallpaper", w), })); @@ -33,12 +25,12 @@ export const SettingsApp = () => { wallpaperOptions ); return ( - - {t("APPS_SETTINGS")} + + {t("APPS_SETTINGS")} - {t("APPS_SETTINGS_OPTIONS_WALLPAPER")} + diff --git a/src/apps/settings/default.json b/src/apps/settings/default.json index 588dcc8..d864924 100644 --- a/src/apps/settings/default.json +++ b/src/apps/settings/default.json @@ -1,4 +1,5 @@ { "wallpaper": "default.png", - "frame": "default.png" + "frame": "default.png", + "theme": "default-dark" } \ No newline at end of file diff --git a/src/config/default.json b/src/config/default.json index aad8e36..d09f7c3 100644 --- a/src/config/default.json +++ b/src/config/default.json @@ -1,9 +1,12 @@ { - "4gNetowrk": "AT&T", - "language": "en_US", - "wallpapers": [ - "default.png", - "dragon.jpg", - "legacy.jpg" - ] + "4gNetowrk": "AT&T", + "language": "en_US", + "wallpapers": ["default.png", "dragon.jpg", "legacy.jpg"], + "themes": { + "default-dark": { + "palette": { + "type": "dark" + } + } + } } \ No newline at end of file diff --git a/src/os/components/NavigationBar.js b/src/os/components/NavigationBar.js index f8eab4b..2972b0c 100644 --- a/src/os/components/NavigationBar.js +++ b/src/os/components/NavigationBar.js @@ -2,37 +2,34 @@ import React from "react"; import { makeStyles, BottomNavigation, - BottomNavigationAction, + BottomNavigationAction } from "@material-ui/core"; -import { grey } from "@material-ui/core/colors"; import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft"; import AppsIcon from "@material-ui/icons/Apps"; import { useHistory } from "react-router-dom"; -const useStyles = makeStyles(() => ({ +const useStyles = makeStyles((theme) => ({ root: { - backgroundColor: grey[800], - color: "white", - zIndex: 2 + zIndex: 2, + backgroundColor: theme.palette.background.default, }, - icon: { - color: "white" - } })); export const NavigationBar = ({ notifications = [] }) => { const classes = useStyles(); - const history = useHistory() - + const history = useHistory(); + return ( value === 'back' ? history.goBack() : history.push('/')} + onChange={(_e, value) => + value === "back" ? history.goBack() : history.push("/") + } > } + icon={} /> ({ box: { @@ -10,6 +10,10 @@ const useStyles = makeStyles((theme) => ({ position: "absolute", zIndex: 1, }, + paper: { + width: "100%", + height: "100%", + }, })); export const AppContent = ({ @@ -21,19 +25,15 @@ export const AppContent = ({ }) => { const classes = useStyles(); return ( - - - {children} + + + + {children} + ); }; diff --git a/src/ui/components/AppTitle.js b/src/ui/components/AppTitle.js index 058de73..0e9be2a 100644 --- a/src/ui/components/AppTitle.js +++ b/src/ui/components/AppTitle.js @@ -1,10 +1,22 @@ import React from "react"; -import { Typography, Box } from "@material-ui/core"; +import { Typography, Box, makeStyles } from "@material-ui/core"; -export const AppTitle = ({ children, style, ...props }) => { +const useStyle = makeStyles(theme => ({ + root: ({ color }) => ({ + width: '100%', + textAlign: 'center', + backgroundColor: color || theme.palette.background.default + }), + text: { + color: theme.palette.text.primary + } +})); + +export const AppTitle = ({ children, color, ...props }) => { + const classes = useStyle({ color }); return ( - - {children} + + {children} ); }; diff --git a/src/ui/components/AppWrapper.js b/src/ui/components/AppWrapper.js index b1dc92d..76310a0 100644 --- a/src/ui/components/AppWrapper.js +++ b/src/ui/components/AppWrapper.js @@ -10,6 +10,7 @@ export const AppWrapper = ({ children, style, handleClickAway, ...props }) => { width: "100%", height: "100%", display: "flex", + position: 'relative', flexDirection: "column", ...style, }} diff --git a/src/ui/components/ContextMenu.js b/src/ui/components/ContextMenu.js index 40b1c23..f383a0c 100644 --- a/src/ui/components/ContextMenu.js +++ b/src/ui/components/ContextMenu.js @@ -6,13 +6,14 @@ import { ListItemText, Slide, makeStyles, + Paper, } from "@material-ui/core"; const useStyles = makeStyles((theme) => ({ root: { width: "100%", - backgroundColor: theme.palette.background.default, - color: "black", + position: 'absolute', + bottom: 0, zIndex: 2, }, })); @@ -21,12 +22,12 @@ export const ContextMenu = ({ open, onClose, options }) => { const classes = useStyles(); return ( -
- + + {options.map((option) => ( { option.onClick(e, option); onClose(); @@ -37,7 +38,7 @@ export const ContextMenu = ({ open, onClose, options }) => { ))} -
+
); };