diff --git a/package.json b/package.json index 767ec24..259e5cc 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,11 @@ "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", + "i18next": "^19.7.0", "lodash": "^4.17.20", "react": "^16.13.1", "react-dom": "^16.13.1", + "react-i18next": "^11.7.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3" }, diff --git a/public/media/frames/default.png b/public/media/frames/default.png index a25e604..847708e 100644 Binary files a/public/media/frames/default.png and b/public/media/frames/default.png differ diff --git a/public/media/frames/s10.png b/public/media/frames/s10.png new file mode 100644 index 0000000..a25e604 Binary files /dev/null and b/public/media/frames/s10.png differ diff --git a/src/Phone.css b/src/Phone.css index aecb308..1d4a2f6 100644 --- a/src/Phone.css +++ b/src/Phone.css @@ -24,11 +24,13 @@ overflow: hidden; position: absolute; background-color: black; + border: 8px solid black; bottom: 100px; left: 50px; right: 50px; top: 100px; display: flex; + flex-direction: column; } .PhoneAppContainer { diff --git a/src/Phone.js b/src/Phone.js index 4b0e16a..f40fc4f 100644 --- a/src/Phone.js +++ b/src/Phone.js @@ -1,10 +1,16 @@ import React from "react"; import "./Phone.css"; +import "./i18n"; import { Route } from "react-router-dom"; import { HomeApp } from "./apps/home/components/Home"; import { ContactsApp } from "./apps/contacts/components/Contacts"; +import { NotificationBar } from "./os/components/NotificationBar"; +import { useSettings } from "./apps/settings/hooks/useSettings"; +import MessageIcon from "@material-ui/icons/Email"; +import { NotificationIcon } from "./os/components/NotificationIcon"; function Phone() { + const [settings] = useSettings(); return (
@@ -12,10 +18,17 @@ function Phone() {
-
+
+ ]} />
diff --git a/src/apps/appmarket/hooks/useApps.js b/src/apps/appmarket/hooks/useApps.js index 6486573..694f13c 100644 --- a/src/apps/appmarket/hooks/useApps.js +++ b/src/apps/appmarket/hooks/useApps.js @@ -2,16 +2,17 @@ import React, { createContext, useEffect } from "react"; import { useConfig } from "../../../config/hooks/useConfig"; import ContactsIcon from "@material-ui/icons/Contacts"; import { blue } from "@material-ui/core/colors"; +import { useTranslation } from "react-i18next"; const AppsContext = createContext(null); export const useApps = () => { const [apps, setApps] = useConfig(AppsContext); - + const { t } = useTranslation(); useEffect(() => { setApps("preinstalled", [ { - name: "Contacts", + name: t('APPS_CONTACTS'), icon: , backgroundColor: blue[500], color: blue[50] @@ -28,6 +29,18 @@ export const useApps = () => { { name: "Contacts4", }, + { + name: "Contacts4", + }, + { + name: "Contacts4", + }, + { + name: "Contacts4", + }, + { + name: "Contacts4", + } ]); // eslint-disable-next-line }, []); diff --git a/src/apps/contacts/components/Contacts.js b/src/apps/contacts/components/Contacts.js index c41c56f..ce32c5f 100644 --- a/src/apps/contacts/components/Contacts.js +++ b/src/apps/contacts/components/Contacts.js @@ -4,6 +4,7 @@ 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"; const useStyles = makeStyles(() => ({ root: { @@ -16,12 +17,11 @@ const useStyles = makeStyles(() => ({ export const ContactsApp = () => { const classes = useStyles(); + const { t } = useTranslation(); return ( - Contacts - - Coming soon... - + {t("APPS_CONTACTS")} + {t("COMING_SOON")} ); }; diff --git a/src/apps/home/components/GridMenu.js b/src/apps/home/components/GridMenu.js index b0b3579..74118ae 100644 --- a/src/apps/home/components/GridMenu.js +++ b/src/apps/home/components/GridMenu.js @@ -1,16 +1,38 @@ import React from "react"; import { AppIcon } from "../../../ui/components/AppIcon"; -import { Grid } from "@material-ui/core"; +import { Grid, makeStyles } from "@material-ui/core"; import { Link } from "react-router-dom"; +const useStyles = makeStyles(theme => ({ + root: { + marginTop: theme.spacing(3) + }, + item: { + marginTop: theme.spacing(3), + width: '20%' + } +})); + export const GridMenu = ({ apps }) => { + const classes = useStyles(); return ( - - {apps && apps.length && apps.map((app) => ( - - - - ))} + + + {apps && + apps.length && + apps.map((app) => ( + + + + ))} + ); }; diff --git a/src/apps/home/components/Home.js b/src/apps/home/components/Home.js index e618c99..00ad6d9 100644 --- a/src/apps/home/components/Home.js +++ b/src/apps/home/components/Home.js @@ -1,21 +1,15 @@ import React from "react"; import { AppWrapper } from "../../../ui/components"; -import { useSettings } from "../../settings/hooks/useSettings"; import { GridMenu } from "./GridMenu"; import { Box } from "@material-ui/core"; import { useApps } from "../../appmarket/hooks/useApps"; export const HomeApp = () => { - const [settings] = useSettings(); const [apps] = useApps(); console.log(apps) return ( - - {apps && } + + {apps && } ); }; diff --git a/src/apps/messages/hooks/useMessages.js b/src/apps/messages/hooks/useMessages.js new file mode 100644 index 0000000..e69de29 diff --git a/src/apps/settings/default.json b/src/apps/settings/default.json index e0a2dc4..588dcc8 100644 --- a/src/apps/settings/default.json +++ b/src/apps/settings/default.json @@ -1,3 +1,4 @@ { - "wallpaper": "default.png" + "wallpaper": "default.png", + "frame": "default.png" } \ No newline at end of file diff --git a/src/i18n.js b/src/i18n.js new file mode 100644 index 0000000..25acb8f --- /dev/null +++ b/src/i18n.js @@ -0,0 +1,22 @@ +import i18n from "i18next"; +import { initReactI18next } from "react-i18next"; +import en from "./locale/en.json"; + +const resources = { + en +}; + +i18n + .use(initReactI18next) // passes i18n down to react-i18next + .init({ + resources, + lng: "en", + + keySeparator: false, // we do not use keys in form messages.welcome + + interpolation: { + escapeValue: false, // react already safes from xss + }, + }); + +export default i18n; diff --git a/src/locale/en.json b/src/locale/en.json new file mode 100644 index 0000000..99bccb5 --- /dev/null +++ b/src/locale/en.json @@ -0,0 +1,9 @@ +{ + "translation": { + "COMING_SOON": "Coming soon...", + + "APPS_CONTACTS": "Contacts", + "APPS_MESSAGES": "Messages", + "APPS_SETTINGS": "Settings" + } +} \ No newline at end of file diff --git a/src/os/components/NotificationBar.js b/src/os/components/NotificationBar.js new file mode 100644 index 0000000..c81d3ea --- /dev/null +++ b/src/os/components/NotificationBar.js @@ -0,0 +1,53 @@ +import React from "react"; +import { makeStyles, Typography, Grid } from "@material-ui/core"; +import { grey } from "@material-ui/core/colors"; +import { fade } from "@material-ui/core/styles/colorManipulator"; +import SignalIcon from "@material-ui/icons/SignalCellular3Bar"; + +const useStyles = makeStyles(() => ({ + root: { + backgroundColor: fade(grey[800], 0.7), + height: "25px", + width: "100%", + color: "white", + }, + item: { + margin: "0 6px", + }, + text: { + position: "relative", + bottom: "2px", + }, +})); + +export const NotificationBar = ({ notifications = [] }) => { + const classes = useStyles(); + return ( + + + {notifications.map((n) => ( + + {n} + + ))} + + + + + + + {`AT&T`} + + + + ); +}; diff --git a/src/os/components/NotificationIcon.js b/src/os/components/NotificationIcon.js new file mode 100644 index 0000000..a836e9f --- /dev/null +++ b/src/os/components/NotificationIcon.js @@ -0,0 +1,5 @@ +import React from "react"; + +export const NotificationIcon = ({ Icon }) => { + return ; +}; diff --git a/src/ui/components/AppIcon.js b/src/ui/components/AppIcon.js index 04dd55b..f50ab19 100644 --- a/src/ui/components/AppIcon.js +++ b/src/ui/components/AppIcon.js @@ -10,12 +10,13 @@ const useStyles = makeStyles((theme) => ({ "& > *": { margin: theme.spacing(1), }, + padding: 0 }, avatar: { backgroundColor: ({ backgroundColor }) => backgroundColor, color: ({ color }) => color, - width: theme.spacing(8), - height: theme.spacing(8), + width: theme.spacing(7), + height: theme.spacing(7), fontSize: theme.typography.h4.fontSize, } })); diff --git a/yarn.lock b/yarn.lock index 9124a3e..71888e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1108,7 +1108,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.1", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.1", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.11.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736" integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw== @@ -5294,6 +5294,13 @@ html-minifier-terser@^5.0.1: relateurl "^0.2.7" terser "^4.6.3" +html-parse-stringify2@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/html-parse-stringify2/-/html-parse-stringify2-2.0.1.tgz#dc5670b7292ca158b7bc916c9a6735ac8872834a" + integrity sha1-3FZwtyksoVi3vJFsmmc1rIhyg0o= + dependencies: + void-elements "^2.0.1" + html-webpack-plugin@4.0.0-beta.11: version "4.0.0-beta.11" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz#3059a69144b5aecef97708196ca32f9e68677715" @@ -5398,6 +5405,13 @@ hyphenate-style-name@^1.0.3: resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ== +i18next@^19.7.0: + version "19.7.0" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-19.7.0.tgz#e637bbbf36481d34b7d5e6d3b04e1bb654bf2a26" + integrity sha512-sxZhj6u7HbEYOMx81oGwq5MiXISRBVg2wRY3n6YIbe+HtU8ydzlGzv6ErHdrRKYxATBFssVXYbc3lNZoyB4vfA== + dependencies: + "@babel/runtime" "^7.10.1" + iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -8873,6 +8887,14 @@ react-error-overlay@^6.0.7: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108" integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA== +react-i18next@^11.7.1: + version "11.7.1" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.7.1.tgz#80c993bf7c4f07937ce0e5ff4e2d7d97bfe3f42f" + integrity sha512-K7qWaQ03Nc25BqSqdKz1iGU5inwNQnDVcen/tpiILEXyd0w/z+untrsuUy5Y3PqAkwJ7m1FACwBttSSitxDKQA== + dependencies: + "@babel/runtime" "^7.3.1" + html-parse-stringify2 "2.0.1" + react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1, react-is@^16.8.4: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" @@ -10667,6 +10689,11 @@ vm-browserify@^1.0.1: resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== +void-elements@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" + integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w= + w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"