This commit is contained in:
J Francisco Rader committed 2020-08-22 02:59:35 -03:00
1 parent 23e69d1193
commit 2b94b56c92
11 files changed
+99 -41

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import React, { createContext, useEffect } from "react";
import { useConfig } from "../../../config/hooks/useConfig";
import ContactsIcon from "@material-ui/icons/Contacts";
const AppsContext = createContext(null);
export const useApps = () => {
const [apps, setApps] = useConfig(AppsContext);
useEffect(() => {
setApps("preinstalled", [
{
name: "Contacts",
icon: <ContactsIcon />,
},
{
name: "Contacts1",
},
{
name: "Contacts2",
},
{
name: "Contacts3",
},
{
name: "Contacts4",
},
]);
// eslint-disable-next-line
}, []);
return [apps, setApps];
};
+19 -7
View File
@@ -1,15 +1,27 @@
import React from "react";
import { AppWrapper } from "../../../ui/components";
import { useSettings } from "../../settings/hooks/useSettings";
import { Box } from "@material-ui/core";
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";
const useStyles = makeStyles(() => ({
root: {
backgroundColor: lightBlue[50],
},
title: {
backgroundColor: lightBlue[300],
},
}));
export const ContactsApp = () => {
const [settings] = useSettings();
const classes = useStyles();
return (
<AppWrapper>
<Box padding={2}>
Contacts !!!
</Box>
<AppWrapper className={classes.root}>
<AppTitle className={classes.title}>Contacts</AppTitle>
<AppContent>
Coming soon...
</AppContent>
</AppWrapper>
);
};
+1 -3
View File
@@ -1,7 +1,6 @@
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import Avatar from "@material-ui/core/Avatar";
import { useSettings } from "../../settings/hooks/useSettings";
import { Button } from "@material-ui/core";
const useStyles = makeStyles((theme) => ({
@@ -19,7 +18,6 @@ const useStyles = makeStyles((theme) => ({
}));
export const AppIcon = ({ label, icon }) => {
const [settings] = useSettings();
const classes = useStyles();
return <Button className={classes.root}><Avatar className={classes.avatar}>{label[0].toUpperCase()}</Avatar></Button>;
return <Button className={classes.root}><Avatar className={classes.avatar}>{icon || label[0].toUpperCase()}</Avatar></Button>;
};
+3 -3
View File
@@ -5,9 +5,9 @@ import { Link } from "react-router-dom";
export const GridMenu = ({ apps }) => {
return (
<Grid container spacing={6}>
{apps.map((app) => (
<Grid item component={Link} to="/contacts">
<Grid container spacing={1}>
{apps && apps.length && apps.map((app) => (
<Grid item key={app.name} component={Link} to="/contacts">
<AppIcon icon={app.icon} label={app.name} />
</Grid>
))}
+4 -3
View File
@@ -3,18 +3,19 @@ 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 padding={2}>
<GridMenu apps={settings.apps} />
</Box>
<Box padding={2}>{apps && <GridMenu apps={apps.preinstalled} />}</Box>
</AppWrapper>
);
};
+1 -23
View File
@@ -1,25 +1,3 @@
{
"wallpaper": "default.png",
"apps": [
{
"name": "Contacts",
"icon": "contacts.png"
},
{
"name": "Contacts",
"icon": "contacts.png"
},
{
"name": "Contacts",
"icon": "contacts.png"
},
{
"name": "Contacts",
"icon": "contacts.png"
},
{
"name": "Contacts",
"icon": "contacts.png"
}
]
"wallpaper": "default.png"
}