mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Make styling!!
This commit is contained in:
1 parent
0bbd463c01
commit
bc20bfac99
13 files changed
+114
-113
No files matched your search
+21
-16
@@ -11,9 +11,12 @@ import { NavigationBar } from "./os/components/NavigationBar";
|
|||||||
import { HomeApp } from "./apps/home/components/Home";
|
import { HomeApp } from "./apps/home/components/Home";
|
||||||
import { ContactsApp } from "./apps/contacts/components/Contacts";
|
import { ContactsApp } from "./apps/contacts/components/Contacts";
|
||||||
import { SettingsApp } from "./apps/settings/components/Settings";
|
import { SettingsApp } from "./apps/settings/components/Settings";
|
||||||
|
import { ThemeProvider, createMuiTheme } from "@material-ui/core";
|
||||||
|
import { useConfig } from "./config/hooks/useConfig";
|
||||||
|
|
||||||
function Phone() {
|
function Phone() {
|
||||||
const { settings } = useSettings();
|
const { settings } = useSettings();
|
||||||
|
const [config] = useConfig();
|
||||||
return (
|
return (
|
||||||
<div className="PhoneWrapper">
|
<div className="PhoneWrapper">
|
||||||
<div style={{ zoom: "80%" }}>
|
<div style={{ zoom: "80%" }}>
|
||||||
@@ -24,23 +27,25 @@ function Phone() {
|
|||||||
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`,
|
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`,
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
<div
|
<ThemeProvider theme={createMuiTheme(config.themes[settings.theme])}>
|
||||||
id="phone"
|
<div
|
||||||
className="PhoneScreen"
|
id="phone"
|
||||||
style={{
|
className="PhoneScreen"
|
||||||
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
|
style={{
|
||||||
}}
|
backgroundImage: `${process.env.PUBLIC_URL}url(/media/backgrounds/${settings.wallpaper})`,
|
||||||
>
|
}}
|
||||||
<NotificationBar
|
>
|
||||||
notifications={[<NotificationIcon Icon={MessageIcon} />]}
|
<NotificationBar
|
||||||
/>
|
notifications={[<NotificationIcon Icon={MessageIcon} />]}
|
||||||
<div className="PhoneAppContainer">
|
/>
|
||||||
<Route exact path="/" component={HomeApp} />
|
<div className="PhoneAppContainer">
|
||||||
<Route exact path="/contacts" component={ContactsApp} />
|
<Route exact path="/" component={HomeApp} />
|
||||||
<Route exact path="/settings" component={SettingsApp} />
|
<Route exact path="/contacts" component={ContactsApp} />
|
||||||
|
<Route exact path="/settings" component={SettingsApp} />
|
||||||
|
</div>
|
||||||
|
<NavigationBar />
|
||||||
</div>
|
</div>
|
||||||
<NavigationBar />
|
</ThemeProvider>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { atom } from "recoil";
|
|||||||
|
|
||||||
const appsState = atom({
|
const appsState = atom({
|
||||||
key: 'apps',
|
key: 'apps',
|
||||||
default: null
|
default: { preinstalled: [] }
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useApps = () => {
|
export const useApps = () => {
|
||||||
@@ -17,6 +17,7 @@ export const useApps = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setApps("preinstalled", [
|
setApps("preinstalled", [
|
||||||
{
|
{
|
||||||
|
id: 'contacts',
|
||||||
name: t('APPS_CONTACTS'),
|
name: t('APPS_CONTACTS'),
|
||||||
icon: <ContactsIcon />,
|
icon: <ContactsIcon />,
|
||||||
backgroundColor: blue[500],
|
backgroundColor: blue[500],
|
||||||
@@ -24,6 +25,7 @@ export const useApps = () => {
|
|||||||
path: '/contacts'
|
path: '/contacts'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'settings',
|
||||||
name: t('APPS_SETTINGS'),
|
name: t('APPS_SETTINGS'),
|
||||||
icon: <SettingsIcon />,
|
icon: <SettingsIcon />,
|
||||||
backgroundColor: grey[700],
|
backgroundColor: grey[700],
|
||||||
@@ -34,5 +36,9 @@ export const useApps = () => {
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return { apps, setApps };
|
const allApps = [...apps.preinstalled];
|
||||||
|
|
||||||
|
const getApp = id => allApps.find(a => a.id === id) || {};
|
||||||
|
|
||||||
|
return { apps, allApps, setApps, getApp };
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
|
||||||
import List from "@material-ui/core/List";
|
import List from "@material-ui/core/List";
|
||||||
import ListItem from "@material-ui/core/ListItem";
|
import ListItem from "@material-ui/core/ListItem";
|
||||||
import ListItemText from "@material-ui/core/ListItemText";
|
import ListItemText from "@material-ui/core/ListItemText";
|
||||||
@@ -8,31 +7,19 @@ import { Button } from "@material-ui/core";
|
|||||||
import PhoneIcon from "@material-ui/icons/Phone";
|
import PhoneIcon from "@material-ui/icons/Phone";
|
||||||
import ChatIcon from "@material-ui/icons/Chat";
|
import ChatIcon from "@material-ui/icons/Chat";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
|
||||||
root: {
|
|
||||||
width: "100%",
|
|
||||||
maxWidth: 360,
|
|
||||||
color: "#fff",
|
|
||||||
},
|
|
||||||
listItem: {
|
|
||||||
color: "#fff",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const ContactList = ({ contacts, onCall, onMessage }) => {
|
export const ContactList = ({ contacts, onCall, onMessage }) => {
|
||||||
const classes = useStyles();
|
|
||||||
return (
|
return (
|
||||||
<List component="nav" className={classes.root}>
|
<List>
|
||||||
{contacts.map((contact) => (
|
{contacts.map((contact) => (
|
||||||
<ListItem divider className={classes.listItem}>
|
<ListItem key={contact.id} divider>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={contact.display}
|
primary={contact.display}
|
||||||
secondary={contact.phoneNumber}
|
secondary={contact.phoneNumber}
|
||||||
/>
|
/>
|
||||||
<Button className={classes.listItem} onClick={onCall}>
|
<Button onClick={onCall}>
|
||||||
<PhoneIcon />
|
<PhoneIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button className={classes.listItem} onClick={onMessage}>
|
<Button onClick={onMessage}>
|
||||||
<ChatIcon />
|
<ChatIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@@ -1,33 +1,27 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { AppWrapper } from "../../../ui/components";
|
import { AppWrapper } from "../../../ui/components";
|
||||||
import { makeStyles } from "@material-ui/core";
|
|
||||||
import lightBlue from "@material-ui/core/colors/lightBlue";
|
|
||||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||||
import { AppContent } from "../../../ui/components/AppContent";
|
import { AppContent } from "../../../ui/components/AppContent";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useContacts } from "../hooks/useContacts";
|
import { useContacts } from "../hooks/useContacts";
|
||||||
import { ContactList } from './ContactList';
|
import { ContactList } from "./ContactList";
|
||||||
|
import { useApps } from "../../appmarket/hooks/useApps";
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
|
||||||
root: {
|
|
||||||
backgroundColor: '#232323',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
backgroundColor: lightBlue[300],
|
|
||||||
textAlign: 'center'
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const ContactsApp = () => {
|
export const ContactsApp = () => {
|
||||||
const classes = useStyles();
|
|
||||||
const { contactList } = useContacts();
|
const { contactList } = useContacts();
|
||||||
|
const { getApp } = useApps();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<AppWrapper className={classes.root}>
|
<AppWrapper>
|
||||||
<AppTitle className={classes.title}>{t("APPS_CONTACTS")}</AppTitle>
|
<AppTitle color={getApp("contacts").backgroundColor}>
|
||||||
|
{t("APPS_CONTACTS")}
|
||||||
|
</AppTitle>
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<ContactList contacts={contactList} onCall={() => console.log("Calling")} onMessage={() => console.log("Opening messages")}/>
|
<ContactList
|
||||||
|
contacts={contactList}
|
||||||
|
onCall={() => console.log("Calling")}
|
||||||
|
onMessage={() => console.log("Opening messages")}
|
||||||
|
/>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ const contactListState = atom({
|
|||||||
key: "contactList",
|
key: "contactList",
|
||||||
default: [
|
default: [
|
||||||
{
|
{
|
||||||
|
id: 0,
|
||||||
display: "Test Contact",
|
display: "Test Contact",
|
||||||
phoneNumber: "000-1111",
|
phoneNumber: "000-1111",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 1,
|
||||||
display: "Test Contact 2",
|
display: "Test Contact 2",
|
||||||
phoneNumber: "000-1112",
|
phoneNumber: "000-1112",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,31 +1,23 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { AppWrapper } from "../../../ui/components";
|
import { AppWrapper } from "../../../ui/components";
|
||||||
import { makeStyles, List, ListItem } from "@material-ui/core";
|
import { List, ListItem, ListItemText } from "@material-ui/core";
|
||||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||||
import { AppContent } from "../../../ui/components/AppContent";
|
import { AppContent } from "../../../ui/components/AppContent";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { grey } from "@material-ui/core/colors";
|
|
||||||
import { useContextMenu } from "../../../ui/hooks/useContextMenu";
|
import { useContextMenu } from "../../../ui/hooks/useContextMenu";
|
||||||
import { useConfig } from "../../../config/hooks/useConfig";
|
import { useConfig } from "../../../config/hooks/useConfig";
|
||||||
import { useSettings } from "../hooks/useSettings";
|
import { useSettings } from "../hooks/useSettings";
|
||||||
|
import { useApps } from "../../appmarket/hooks/useApps";
|
||||||
const useStyles = makeStyles(() => ({
|
|
||||||
root: {
|
|
||||||
backgroundColor: grey[50],
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
backgroundColor: grey[600],
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const SettingsApp = () => {
|
export const SettingsApp = () => {
|
||||||
const classes = useStyles();
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [config] = useConfig();
|
const [config] = useConfig();
|
||||||
const { setSettings } = useSettings();
|
const { getApp } = useApps();
|
||||||
|
const { setSettings, settings } = useSettings();
|
||||||
|
|
||||||
const wallpaperOptions = config.wallpapers.map((w) => ({
|
const wallpaperOptions = config.wallpapers.map((w) => ({
|
||||||
label: w,
|
label: w,
|
||||||
|
key: w,
|
||||||
onClick: () => setSettings("wallpaper", w),
|
onClick: () => setSettings("wallpaper", w),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -33,12 +25,12 @@ export const SettingsApp = () => {
|
|||||||
wallpaperOptions
|
wallpaperOptions
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<AppWrapper className={classes.root}>
|
<AppWrapper>
|
||||||
<AppTitle className={classes.title}>{t("APPS_SETTINGS")}</AppTitle>
|
<AppTitle color={getApp("settings").backgroundColor}>{t("APPS_SETTINGS")}</AppTitle>
|
||||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||||
<List>
|
<List>
|
||||||
<ListItem onClick={openMenu} button>
|
<ListItem onClick={openMenu} button>
|
||||||
{t("APPS_SETTINGS_OPTIONS_WALLPAPER")}
|
<ListItemText primary={t("APPS_SETTINGS_OPTIONS_WALLPAPER")} secondary={settings.wallpaper} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"wallpaper": "default.png",
|
"wallpaper": "default.png",
|
||||||
"frame": "default.png"
|
"frame": "default.png",
|
||||||
|
"theme": "default-dark"
|
||||||
}
|
}
|
||||||
+10
-7
@@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"4gNetowrk": "AT&T",
|
"4gNetowrk": "AT&T",
|
||||||
"language": "en_US",
|
"language": "en_US",
|
||||||
"wallpapers": [
|
"wallpapers": ["default.png", "dragon.jpg", "legacy.jpg"],
|
||||||
"default.png",
|
"themes": {
|
||||||
"dragon.jpg",
|
"default-dark": {
|
||||||
"legacy.jpg"
|
"palette": {
|
||||||
]
|
"type": "dark"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,37 +2,34 @@ import React from "react";
|
|||||||
import {
|
import {
|
||||||
makeStyles,
|
makeStyles,
|
||||||
BottomNavigation,
|
BottomNavigation,
|
||||||
BottomNavigationAction,
|
BottomNavigationAction
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { grey } from "@material-ui/core/colors";
|
|
||||||
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
||||||
import AppsIcon from "@material-ui/icons/Apps";
|
import AppsIcon from "@material-ui/icons/Apps";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
backgroundColor: grey[800],
|
zIndex: 2,
|
||||||
color: "white",
|
backgroundColor: theme.palette.background.default,
|
||||||
zIndex: 2
|
|
||||||
},
|
},
|
||||||
icon: {
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const NavigationBar = ({ notifications = [] }) => {
|
export const NavigationBar = ({ notifications = [] }) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const history = useHistory()
|
const history = useHistory();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BottomNavigation
|
<BottomNavigation
|
||||||
className={classes.root}
|
className={classes.root}
|
||||||
onChange={(_e, value) => value === 'back' ? history.goBack() : history.push('/')}
|
onChange={(_e, value) =>
|
||||||
|
value === "back" ? history.goBack() : history.push("/")
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Back"
|
label="Back"
|
||||||
value="back"
|
value="back"
|
||||||
icon={<KeyboardArrowLeftIcon className={classes.icon} />}
|
icon={<KeyboardArrowLeftIcon />}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Home"
|
label="Home"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box, makeStyles, Backdrop } from "@material-ui/core";
|
import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
box: {
|
box: {
|
||||||
@@ -10,6 +10,10 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
position: "absolute",
|
position: "absolute",
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
},
|
},
|
||||||
|
paper: {
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const AppContent = ({
|
export const AppContent = ({
|
||||||
@@ -21,19 +25,15 @@ export const AppContent = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box flexGrow={1} className={classes.box} {...props}>
|
||||||
px={2}
|
<Paper square px={2} pt={1} elevation={0} className={classes.paper}>
|
||||||
pt={1}
|
<Backdrop
|
||||||
flexGrow={1}
|
className={classes.backdrop}
|
||||||
style={{ width: "100%", ...props }}
|
open={backdrop || false}
|
||||||
{...props}
|
onClick={onClickBackdrop}
|
||||||
>
|
></Backdrop>
|
||||||
<Backdrop
|
{children}
|
||||||
className={classes.backdrop}
|
</Paper>
|
||||||
open={backdrop}
|
|
||||||
onClick={onClickBackdrop}
|
|
||||||
></Backdrop>
|
|
||||||
{children}
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,10 +1,22 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Typography, Box } from "@material-ui/core";
|
import { Typography, Box, makeStyles } from "@material-ui/core";
|
||||||
|
|
||||||
export const AppTitle = ({ children, style, ...props }) => {
|
const useStyle = makeStyles(theme => ({
|
||||||
|
root: ({ color }) => ({
|
||||||
|
width: '100%',
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: color || theme.palette.background.default
|
||||||
|
}),
|
||||||
|
text: {
|
||||||
|
color: theme.palette.text.primary
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const AppTitle = ({ children, color, ...props }) => {
|
||||||
|
const classes = useStyle({ color });
|
||||||
return (
|
return (
|
||||||
<Box px={2} pt={4} style={{ width: '100%', ...props }} {...props}>
|
<Box px={2} pt={4} className={classes.root} {...props}>
|
||||||
<Typography paragraph variant="h4">{children}</Typography>
|
<Typography className={classes.text} paragraph variant="h4">{children}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -10,6 +10,7 @@ export const AppWrapper = ({ children, style, handleClickAway, ...props }) => {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
position: 'relative',
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
...style,
|
...style,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import {
|
|||||||
ListItemText,
|
ListItemText,
|
||||||
Slide,
|
Slide,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
|
Paper,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
backgroundColor: theme.palette.background.default,
|
position: 'absolute',
|
||||||
color: "black",
|
bottom: 0,
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
@@ -21,12 +22,12 @@ export const ContextMenu = ({ open, onClose, options }) => {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
|
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
|
||||||
<div className={classes.root}>
|
<Paper square className={classes.root}>
|
||||||
<List component="nav" aria-label="context menu">
|
<List aria-label="context menu">
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
button
|
button
|
||||||
key={option.key}
|
key={option.key || option.label}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
option.onClick(e, option);
|
option.onClick(e, option);
|
||||||
onClose();
|
onClose();
|
||||||
@@ -37,7 +38,7 @@ export const ContextMenu = ({ open, onClose, options }) => {
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</div>
|
</Paper>
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user