mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Wohoo
This commit is contained in:
1 parent
23e69d1193
commit
2b94b56c92
11 files changed
+99
-41
No files matched your search
@@ -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];
|
||||
};
|
||||
@@ -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,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>;
|
||||
};
|
||||
@@ -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>
|
||||
))}
|
||||
|
||||
@@ -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,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"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import { Box } from "@material-ui/core";
|
||||
|
||||
export const AppContent = ({ children, style, ...props }) => {
|
||||
return (
|
||||
<Box px={2} pt={1} style={{ width: '100%', ...props }} {...props}>
|
||||
{children}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import { Typography, Box } from "@material-ui/core";
|
||||
|
||||
export const AppTitle = ({ children, style, ...props }) => {
|
||||
return (
|
||||
<Box px={2} pt={4} style={{ width: '100%', ...props }} {...props}>
|
||||
<Typography paragraph variant="h4">{children}</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,17 @@ export const AppWrapper = ({ children, style, ...props }) => {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
style={{ width: "100%", height: "100%", display: "flex", ...style }}
|
||||
style={{
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
<div style={{ padding: "1em" }}>{children}</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user