Notification bar

This commit is contained in:
J Francisco Rader committed 2020-08-22 05:19:35 -03:00
1 parent 205dcabf12
commit 68fd91d4d0
17 files changed
+191 -27

No files matched your search

+2
View File
@@ -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"
},
Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

+2
View File
@@ -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 {
+15 -2
View File
@@ -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 (
<div className="PhoneWrapper">
<div style={{ zoom: "80%" }}>
@@ -12,10 +18,17 @@ function Phone() {
<div
className="PhoneFrame"
style={{
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/default.png)`,
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`,
}}
></div>
<div className="PhoneScreen" id="phone">
<div
id="phone"
className="PhoneScreen"
style={{
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
}}
>
<NotificationBar notifications={[<NotificationIcon Icon={MessageIcon} />]} />
<div className="PhoneAppContainer">
<Route exact path="/" component={HomeApp} />
<Route exact path="/contacts" component={ContactsApp} />
+15 -2
View File
@@ -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: <ContactsIcon />,
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
}, []);
+4 -4
View File
@@ -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 (
<AppWrapper className={classes.root}>
<AppTitle className={classes.title}>Contacts</AppTitle>
<AppContent>
Coming soon...
</AppContent>
<AppTitle className={classes.title}>{t("APPS_CONTACTS")}</AppTitle>
<AppContent>{t("COMING_SOON")}</AppContent>
</AppWrapper>
);
};
+29 -7
View File
@@ -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 (
<Grid container>
{apps && apps.length && apps.map((app) => (
<Grid item xs={3} key={app.name} component={Link} to="/contacts">
<AppIcon {...app} />
</Grid>
))}
<Grid container justify="center">
<Grid container item>
{apps &&
apps.length &&
apps.map((app) => (
<Grid
item
className={classes.item}
key={app.name}
tabindex="-1"
component={Link}
to="/contacts"
>
<AppIcon {...app} />
</Grid>
))}
</Grid>
</Grid>
);
};
+2 -8
View File
@@ -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 (
<AppWrapper
style={{
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
}}
>
<Box mt={6} px={4}>{apps && <GridMenu apps={apps.preinstalled} />}</Box>
<AppWrapper>
<Box width="100%" mt={6} px={1}>{apps && <GridMenu apps={apps.preinstalled} />}</Box>
</AppWrapper>
);
};
Whitespace-only changes.
+2 -1
View File
@@ -1,3 +1,4 @@
{
"wallpaper": "default.png"
"wallpaper": "default.png",
"frame": "default.png"
}
+22
View File
@@ -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;
+9
View File
@@ -0,0 +1,9 @@
{
"translation": {
"COMING_SOON": "Coming soon...",
"APPS_CONTACTS": "Contacts",
"APPS_MESSAGES": "Messages",
"APPS_SETTINGS": "Settings"
}
}
+53
View File
@@ -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 (
<Grid
className={classes.root}
container
justify="space-between"
wrap="nowrap"
>
<Grid container item wrap="nowrap">
{notifications.map((n) => (
<Grid item className={classes.item}>
{n}
</Grid>
))}
</Grid>
<Grid container item wrap="nowrap" justify="flex-end">
<Grid item>
<SignalIcon fontSize="small" />
</Grid>
<Grid item className={classes.item}>
<Typography
className={classes.text}
variant="button"
color="white"
>{`AT&T`}</Typography>
</Grid>
</Grid>
</Grid>
);
};
+5
View File
@@ -0,0 +1,5 @@
import React from "react";
export const NotificationIcon = ({ Icon }) => {
return <Icon fontSize="small" />;
};
+3 -2
View File
@@ -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,
}
}));
+28 -1
View File
@@ -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"
[email protected]:
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"
[email protected]:
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"
[email protected], 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"