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
@@ -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,
}
}));