diff --git a/.gitignore b/.gitignore index 8b13789..3a0077f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ - +# No intellij folder +.idea diff --git a/phone/public/media/backgrounds/beach.jpg b/phone/public/media/backgrounds/beach.jpg new file mode 100644 index 0000000..ec32c72 Binary files /dev/null and b/phone/public/media/backgrounds/beach.jpg differ diff --git a/phone/public/media/backgrounds/minimal.jpg b/phone/public/media/backgrounds/minimal.jpg new file mode 100644 index 0000000..fc29c58 Binary files /dev/null and b/phone/public/media/backgrounds/minimal.jpg differ diff --git a/phone/public/media/backgrounds/surf.jpg b/phone/public/media/backgrounds/surf.jpg new file mode 100644 index 0000000..ad389ce Binary files /dev/null and b/phone/public/media/backgrounds/surf.jpg differ diff --git a/phone/public/media/backgrounds/waves.jpg b/phone/public/media/backgrounds/waves.jpg new file mode 100644 index 0000000..92f8567 Binary files /dev/null and b/phone/public/media/backgrounds/waves.jpg differ diff --git a/phone/public/media/ringtones/marimba.ogg b/phone/public/media/ringtones/marimba.ogg new file mode 100644 index 0000000..31ab798 Binary files /dev/null and b/phone/public/media/ringtones/marimba.ogg differ diff --git a/phone/public/media/ringtones/pixel.ogg b/phone/public/media/ringtones/pixel.ogg new file mode 100644 index 0000000..b5611ee Binary files /dev/null and b/phone/public/media/ringtones/pixel.ogg differ diff --git a/phone/src/Phone.css b/phone/src/Phone.css index f4daefb..616c518 100644 --- a/phone/src/Phone.css +++ b/phone/src/Phone.css @@ -24,7 +24,6 @@ overflow: hidden; position: absolute; background-color: black; - border-top: 2px solid black; border-left: 4px solid black; border-right: 4px solid black; bottom: 100px; diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 35793bc..5ae11c6 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -272,7 +272,7 @@ function Phone() { return (
-
+
{ const notification = useRecoilValue(bankState.notification); - return { notification } -} \ No newline at end of file + return { notification }; +}; diff --git a/phone/src/apps/bank/hooks/useCredentials.ts b/phone/src/apps/bank/hooks/useCredentials.ts index 9c19a0b..4583f77 100644 --- a/phone/src/apps/bank/hooks/useCredentials.ts +++ b/phone/src/apps/bank/hooks/useCredentials.ts @@ -1,6 +1,6 @@ import { useRecoilValue } from 'recoil'; import { bankState } from './state'; -import { IBankCredentials } from '../../../common/interfaces/bank'; +import { IBankCredentials } from '../../../common/typings/bank'; interface ICredentialsHook { credentials: IBankCredentials; diff --git a/phone/src/apps/calculator/components/Calculator.tsx b/phone/src/apps/calculator/components/Calculator.tsx index 8818e7d..598dc32 100644 --- a/phone/src/apps/calculator/components/Calculator.tsx +++ b/phone/src/apps/calculator/components/Calculator.tsx @@ -1,6 +1,6 @@ -import React from "react"; -import { useCalculator, CalcButton } from "../hooks/useCalculator"; -import { Grid, makeStyles, Box, Paper } from "@material-ui/core"; +import React from 'react'; +import { useCalculator, CalcButton } from '../hooks/useCalculator'; +import { Grid, makeStyles, Box, Paper } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ button: { @@ -9,7 +9,9 @@ const useStyles = makeStyles((theme) => ({ }, result: { fontSize: theme.typography.h2.fontSize, - textAlign: "right", + textAlign: 'right', + overflow: 'hidden', + textOverflow: 'ellipsis', }, })); @@ -37,12 +39,15 @@ export const Calculator = ({ ...props }) => { } = useCalculator(); const classes = useStyles(); return ( - + - {result()} + {result().toLocaleString(undefined, { + minimumFractionDigits: 0, + maximumFractionDigits: 4, + })} - + diff --git a/phone/src/apps/calculator/hooks/useCalculator.tsx b/phone/src/apps/calculator/hooks/useCalculator.tsx index 251c7f7..d10b247 100644 --- a/phone/src/apps/calculator/hooks/useCalculator.tsx +++ b/phone/src/apps/calculator/hooks/useCalculator.tsx @@ -1,19 +1,19 @@ -import React, { useReducer } from "react"; -import { Grid, Button } from "@material-ui/core"; +import React, { useReducer } from 'react'; +import { Grid, Button } from '@material-ui/core'; const initialState = { value: 0, - op: "", + op: '', num1: 0, - num2: "", - num3: "", + num2: '', + num3: '', }; const Reducer = (state, action) => { switch (action.type) { - case "2": + case '2': if (!state.num1) { - return { ...state, num1: state.num2, op: action.payload, num2: "" }; + return { ...state, num1: state.num2, op: action.payload, num2: '' }; } if (!state.num2) { return { ...state, op: action.payload }; @@ -28,30 +28,30 @@ const Reducer = (state, action) => { return { ...state, value: state.op(state.num1, state.num2), - num2: "", + num2: '', op: action.payload, num1: state.op(state.num1, state.num2), }; - case "1": - if (state.num2 === "" && action.payload === ".") { - return { ...state, num2: "0" + action.payload }; + case '1': + if (state.num2 === '' && action.payload === '.') { + return { ...state, num2: '0' + action.payload }; } - if (state.num2 === "") { + if (state.num2 === '') { return { ...state, num2: action.payload }; } - if (action.payload === "." && state.num2.includes(".")) { + if (action.payload === '.' && state.num2.includes('.')) { return state; } else { return { ...state, num2: state.num2 + action.payload }; } - case "3": + case '3': if (state.op && state.num2) { return { ...state, value: state.op(state.num1, state.num2), - num2: "", + num2: '', num1: state.op(state.num1, state.num2), num3: state.num2, }; @@ -61,22 +61,22 @@ const Reducer = (state, action) => { } return state; - case "c": - if (state.num2.length === 2 && state.num2.includes("0.")) { - return { ...state, num2: "" }; + case 'c': + if (state.num2.length === 2 && state.num2.includes('0.')) { + return { ...state, num2: '' }; } if (state.num2.length > 1) { return { ...state, num2: state.num2.slice(0, -1) }; } - return { ...state, num2: "" }; + return { ...state, num2: '' }; - case "ac": + case 'ac': return { value: 0, - op: "", + op: '', num1: 0, - num2: "", - num3: "", + num2: '', + num3: '', }; default: @@ -96,17 +96,17 @@ export const useCalculator = () => { const [state, dispatch] = useReducer(Reducer, initialState); const getPayload = (label, type) => { - if (type !== "2") { + if (type !== '2') { return `${label}`; } switch (label) { - case "/": + case '/': return (a, b) => Number(a) / Number(b); - case "*": + case '*': return (a, b) => Number(a) * Number(b); - case "+": + case '+': return (a, b) => Number(a) + Number(b); - case "-": + case '-': return (a, b) => Number(a) - Number(b); default: break; @@ -122,17 +122,17 @@ export const useCalculator = () => { }), }); - const number = (n) => buttonProps(n, "1"); - const operator = (sym) => buttonProps(sym, "2"); - const clear = buttonProps("C", "c"); - const clearAll = buttonProps("AC", "ac"); - const equals = buttonProps("=", "3"); + const number = (n) => buttonProps(n, '1'); + const operator = (sym) => buttonProps(sym, '2'); + const clear = buttonProps('C', 'c'); + const clearAll = buttonProps('AC', 'ac'); + const equals = buttonProps('=', '3'); const zero = number(0); - const dot = number("."); - const divider = operator("/"); - const multiplier = operator("*"); - const adder = operator("+"); - const substractor = operator("-"); + const dot = number('.'); + const divider = operator('/'); + const multiplier = operator('*'); + const adder = operator('+'); + const substractor = operator('-'); const one = number(1); const two = number(2); const three = number(3); @@ -142,7 +142,7 @@ export const useCalculator = () => { const seven = number(7); const eight = number(8); const nine = number(9); - const result = () => (!state.num2 ? state.value : state.num2); + const result = (): number => (!state.num2 ? state.value : state.num2); return { result, diff --git a/phone/src/apps/contacts/components/ContactsApp.tsx b/phone/src/apps/contacts/components/ContactsApp.tsx index 622da53..5e7350c 100644 --- a/phone/src/apps/contacts/components/ContactsApp.tsx +++ b/phone/src/apps/contacts/components/ContactsApp.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { AppWrapper } from '../../../ui/components'; +import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; import { ContactList } from './List/ContactList'; @@ -27,7 +28,7 @@ export const ContactsApp = () => { return ( - + diff --git a/phone/src/apps/contacts/components/alert/ContactAlert.tsx b/phone/src/apps/contacts/components/alert/ContactAlert.tsx index 9d9731c..67761cc 100644 --- a/phone/src/apps/contacts/components/alert/ContactAlert.tsx +++ b/phone/src/apps/contacts/components/alert/ContactAlert.tsx @@ -3,6 +3,11 @@ import React, { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert } from '../../../../ui/components/Alert'; import { useContactAlert } from '../../hooks/useAlert'; +import { AlertCategory } from '../../../../common/typings/contact'; + +// Used as a prefix for referencing the locales +// Needed to make code cleaner +const LOCALE_PREFIX = 'APPS_'; export const ContactAlert = () => { const { t } = useTranslation(); @@ -16,31 +21,31 @@ export const ContactAlert = () => { setAlert(null); }; + function setMessageAlert(type: AlertCategory, severity: 'success' | 'error') { + setMessage(t(LOCALE_PREFIX + type)); + setSeverity(severity); + setOpen(true); + } + useEffect(() => { - if (alert === 'CONTACT_ADD_SUCCESS') { - setMessage(t('APPS_CONTACTS_ADD_SUCCESS')); - setSeverity('success'); - setOpen(true); - } else if (alert === 'CONTACT_ADD_FAILED') { - setMessage(t('APPS_CONTACTS_ADD_FAILED')); - setSeverity('error'); - setOpen(true); - } else if (alert === 'CONTACT_UPDATE_SUCCESS') { - setMessage(t('APPS_CONTACTS_UPDATE_SUCCESS')); - setSeverity('success'); - setOpen(true); - } else if (alert === 'CONTACT_UPDATE_FAILED') { - setMessage(t('APPS_CONTACTS_UPDATE_FAILED')); - setSeverity('error'); - setOpen(true); - } else if (alert === 'CONTACT_DELETE_SUCCESS') { - setMessage(t('APPS_CONTACTS_DELETE_SUCCESS')); - setSeverity('success'); - setOpen(true); - } else if (alert === 'CONTACT_DELETE_FAILED') { - setMessage(t('APPS_CONTACTS_DELETE_FAILED')); - setSeverity('error'); - setOpen(true); + switch (alert) { + case 'CONTACT_ADD_FAILED': + setMessageAlert(alert, 'error'); + break; + case 'CONTACT_ADD_SUCCESS': + setMessageAlert(alert, 'success'); + break; + case 'CONTACT_DELETE_FAILED': + setMessageAlert(alert, 'error'); + break; + case 'CONTACT_DELETE_SUCCESS': + setMessageAlert(alert, 'success'); + break; + case 'CONTACT_UPDATE_FAILED': + setMessageAlert(alert, 'error'); + break; + case 'CONTACT_UPDATE_SUCCESS': + setMessageAlert(alert, 'success'); } }, [alert]); diff --git a/phone/src/apps/contacts/components/modal/InfoModal.tsx b/phone/src/apps/contacts/components/modal/InfoModal.tsx index 9abb299..f094d73 100644 --- a/phone/src/apps/contacts/components/modal/InfoModal.tsx +++ b/phone/src/apps/contacts/components/modal/InfoModal.tsx @@ -59,6 +59,7 @@ export const InfoModal = () => { -
+
{ inputProps={{ className: classes.inputPropsContent, }} - placeholder="Content" + placeholder='Content' multiline fullWidth rows={19} - variant="outlined" + variant='outlined' value={content} onChange={(e) => setContent(e.target.value)} /> diff --git a/phone/src/apps/sellout/components/SelloutTitle.tsx b/phone/src/apps/sellout/components/SelloutTitle.tsx index 0464a08..25e7a02 100644 --- a/phone/src/apps/sellout/components/SelloutTitle.tsx +++ b/phone/src/apps/sellout/components/SelloutTitle.tsx @@ -1,21 +1,21 @@ -import React from "react"; -import Paper from "@material-ui/core/Paper"; -import { makeStyles } from "@material-ui/core"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faAd } from "@fortawesome/free-solid-svg-icons"; +import React from 'react'; +import Paper from '@material-ui/core/Paper'; +import { makeStyles } from '@material-ui/core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faAd } from '@fortawesome/free-solid-svg-icons'; const useStyles = makeStyles((theme) => ({ root: { - height: "60px", - width: "100%", - display: "flex", - flexFlow: "row nowrap", - justifyContent: "center", - alignItems: "center", - background: "#424242", + height: '60px', + width: '100%', + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'center', + alignItems: 'center', + background: '#262525', }, icon: { - color: "#f44336", + color: '#f44336', fontSize: 40, }, })); @@ -23,7 +23,7 @@ const useStyles = makeStyles((theme) => ({ export const SelloutTitle = () => { const classes = useStyles(); return ( - + ); diff --git a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx index 85d38da..75b4c30 100644 --- a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx @@ -1,17 +1,18 @@ -import React, { useState } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Link } from "react-router-dom"; -import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faHome } from "@fortawesome/free-solid-svg-icons"; -import AddCircleIcon from "@material-ui/icons/AddCircle"; +import React, { useState } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Link } from 'react-router-dom'; +import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faHome } from '@fortawesome/free-solid-svg-icons'; +import AddCircleIcon from '@material-ui/icons/AddCircle'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", + width: '100%', + backgroundColor: '#262525', }, icon: { - color: "#f44336", + color: '#f44336', }, })); @@ -30,12 +31,12 @@ export const NavigationBar = () => { } - to="/sellout" + to='/sellout' /> } - to="/sellout/new" + to='/sellout/new' /> ); diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 90a2897..8dd485c 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -1,18 +1,33 @@ -import React from "react"; -import { ListItem, ListItemText, Divider } from "@material-ui/core"; - +import React from 'react'; +import { + ListItem, + ListItemText, + Divider, + ListItemIcon, +} from '@material-ui/core'; +import { SvgIconProps } from '@material-ui/core'; interface IProps { options?: any; label: string; - value: string | null; + value?: string | null; onClick?: any; + icon: JSX.Element; + disabled?: boolean; } -export const SettingItem = ({ options, label, value, onClick }: IProps) => { +export const SettingItem = ({ + options, + label, + value, + onClick, + icon, + disabled, +}: IProps) => { return ( <> onClick(options)} button> - + {icon} + diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index b5d2fb7..f8071ca 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,59 +1,128 @@ -import React from "react"; -import { AppWrapper } from "../../../ui/components"; -import { AppTitle } from "../../../ui/components/AppTitle"; -import { AppContent } from "../../../ui/components/AppContent"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components'; +import { AppTitle } from '../../../ui/components/AppTitle'; +import { AppContent } from '../../../ui/components/AppContent'; import { useContextMenu, MapStringOptions, -} from "../../../ui/hooks/useContextMenu"; -import { useConfig } from "../../../config/hooks/useConfig"; -import { useSettings } from "../hooks/useSettings"; -import { List } from "../../../ui/components/List"; -import { useSimcard } from "../../../os/simcard/hooks/useSimcard"; -import { useApp } from "../../../os/apps/hooks/useApps"; -import { SettingItem } from "./SettingItem"; +} from '../../../ui/hooks/useContextMenu'; +import { useConfig } from '../../../config/hooks/useConfig'; +import { useSettings } from '../hooks/useSettings'; +import { List } from '../../../ui/components/List'; +import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; +import { useApp } from '../../../os/apps/hooks/useApps'; +import { SettingItem } from './SettingItem'; + +import { + Brush, + Wallpaper, + Phone, + Smartphone, + ZoomIn, + LibraryMusic, + VolumeUp, +} from '@material-ui/icons'; + +import { ListSubheader } from '@material-ui/core'; + +const SubHeaderComp = (props: { text: string }) => ( + + {props.text} + +); export const SettingsApp = () => { - const settingsApp = useApp("SETTINGS"); + const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const { setSettings, settings } = useSettings(); const simcard = useSimcard(); const wallpapers = config.wallpapers.map( - MapStringOptions(settings.wallpaper, (val) => setSettings("wallpaper", val)) + MapStringOptions(settings.wallpaper, (val: string) => + setSettings('wallpaper', val) + ) ); const frames = config.frames.map( - MapStringOptions(settings.frame, (val) => setSettings("frame", val)) + MapStringOptions(settings.frame, (val: string) => setSettings('frame', val)) ); const themes = Object.keys(config.themes).map( - MapStringOptions(settings.theme, (val) => setSettings("theme", val)) + MapStringOptions(settings.theme, (val: string) => setSettings('theme', val)) ); + const zoomOptions = config.zoomOptions.map( + MapStringOptions(settings.zoom, (val: string) => setSettings('zoom', val)) + ); + // Doesn't actually do anything for the time being + const ringtones = config.ringtones.map( + MapStringOptions(settings.ringtone, (val: string) => + setSettings('ringtone', val) + ) + ); + // * Probably gonna make this a slider component in the future + // const ringtoneVols = config.ringtoneVols.map( + // MapStringOptions(settings.ringtoneVol, (val: number) => setSettings('ringtoneVol', val)) + // ) + + // TODO: These new settings all work const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( - + }> } + /> + } + /> + { + // * NOTE: This component is most likely temporary + // * Probably want to make it a slider in the future. Ignore hardcoded for the meantime + } + } + /> + + }> + } /> } /> } + /> + } /> - diff --git a/phone/src/apps/settings/default.json b/phone/src/apps/settings/default.json index 01d3d2a..70b0b4e 100644 --- a/phone/src/apps/settings/default.json +++ b/phone/src/apps/settings/default.json @@ -1,5 +1,8 @@ { "wallpaper": "default.png", "frame": "s10.png", - "theme": "default-dark" + "theme": "taso-dark", + "zoom": "100%", + "ringtone": "pixel", + "ringtoneVol": 100 } diff --git a/phone/src/apps/twitter/hooks/useTwitterNotification.ts b/phone/src/apps/twitter/hooks/useTwitterNotification.ts index 73b1893..d01a9ca 100644 --- a/phone/src/apps/twitter/hooks/useTwitterNotification.ts +++ b/phone/src/apps/twitter/hooks/useTwitterNotification.ts @@ -1,7 +1,7 @@ -import { useRecoilValue } from "recoil"; +import { useRecoilValue } from 'recoil'; -import { Tweet } from "../../../common/interfaces/twitter"; -import { twitterState } from "./state"; +import { Tweet } from '../../../common/typings/twitter'; +import { twitterState } from './state'; interface ITwitterNotification { notification: Tweet | null; diff --git a/phone/src/common/interfaces/contact.ts b/phone/src/common/interfaces/contact.ts deleted file mode 100644 index fa46e10..0000000 --- a/phone/src/common/interfaces/contact.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IContactAlert { - alert: string; - setAlert: (type: string) => void; -} diff --git a/phone/src/common/interfaces/bank.ts b/phone/src/common/typings/bank.ts similarity index 100% rename from phone/src/common/interfaces/bank.ts rename to phone/src/common/typings/bank.ts diff --git a/phone/src/common/interfaces/config.ts b/phone/src/common/typings/config.ts similarity index 91% rename from phone/src/common/interfaces/config.ts rename to phone/src/common/typings/config.ts index 81dd665..35a49d3 100644 --- a/phone/src/common/interfaces/config.ts +++ b/phone/src/common/typings/config.ts @@ -16,8 +16,8 @@ interface General { } interface NotificationConfig { - horizontal: "left" | "center" | "right"; - vertical: "bottom" | "top"; + horizontal: 'left' | 'center' | 'right'; + vertical: 'bottom' | 'top'; } interface BankConfig { diff --git a/phone/src/common/typings/contact.ts b/phone/src/common/typings/contact.ts new file mode 100644 index 0000000..805b1c5 --- /dev/null +++ b/phone/src/common/typings/contact.ts @@ -0,0 +1,12 @@ +export type AlertCategory = + | 'CONTACT_ADD_SUCCESS' + | 'CONTACT_ADD_FAILED' + | 'CONTACT_UPDATE_SUCCESS' + | 'CONTACT_UPDATE_FAILED' + | 'CONTACT_DELETE_SUCCESS' + | 'CONTACT_DELETE_FAILED'; + +export interface IContactAlert { + alert: AlertCategory; + setAlert: (type: string) => void; +} diff --git a/phone/src/common/interfaces/messages.ts b/phone/src/common/typings/messages.ts similarity index 100% rename from phone/src/common/interfaces/messages.ts rename to phone/src/common/typings/messages.ts diff --git a/phone/src/common/interfaces/notes.ts b/phone/src/common/typings/notes.ts similarity index 98% rename from phone/src/common/interfaces/notes.ts rename to phone/src/common/typings/notes.ts index 8d9cb5d..2f70474 100644 --- a/phone/src/common/interfaces/notes.ts +++ b/phone/src/common/typings/notes.ts @@ -6,4 +6,4 @@ export interface Note { export interface NoteId { id: number; -} \ No newline at end of file +} diff --git a/phone/src/common/interfaces/photo.ts b/phone/src/common/typings/photo.ts similarity index 72% rename from phone/src/common/interfaces/photo.ts rename to phone/src/common/typings/photo.ts index 48e0ad3..3a26e5b 100644 --- a/phone/src/common/interfaces/photo.ts +++ b/phone/src/common/typings/photo.ts @@ -1,4 +1,4 @@ export interface IPhoto { image: string; - id: number -} \ No newline at end of file + id: number; +} diff --git a/phone/src/common/interfaces/twitter.ts b/phone/src/common/typings/twitter.ts similarity index 100% rename from phone/src/common/interfaces/twitter.ts rename to phone/src/common/typings/twitter.ts diff --git a/phone/src/config/default.json b/phone/src/config/default.json index cd5dc7f..fe6fc4c 100644 --- a/phone/src/config/default.json +++ b/phone/src/config/default.json @@ -1,8 +1,18 @@ { - "4gNetowrk": "AT&T", + "cellProvider": "AT&T", "language": "en_US", - "wallpapers": ["default.png", "dragon.jpg", "legacy.jpg"], - "frames": ["default.png", "s10.png"], + "wallpapers": [ + "default.png", + "dragon.jpg", + "legacy.jpg", + "minimal.jpg", + "waves.jpg", + "surf.jpg", + "beach.jpg" + ], + "frames": ["default.png", "s10.png", "tw.png", "samsung.png"], + "zoomOptions": ["120%", "100%", "80%", "60%", "40%"], + "ringtones": ["marimba", "pixel"], "themes": { "default-dark": { "palette": { @@ -13,6 +23,26 @@ "palette": { "type": "light" } + }, + "taso-dark": { + "common": {}, + "palette": { + "type": "dark", + "background": { + "paper": "#1c1c1c", + "default": "#121212", + "dark": "#000000", + "light": "#383838" + }, + "text": { + "primary": "#fff", + "secondary": "rgba(255, 255, 255, 0.7)", + "disabled": "rgba(255, 255, 255, 0.5)", + "hint": "rgba(255, 255, 255, 0.5)", + "icon": "rgba(255, 255, 255, 0.5)" + } + }, + "divider": "rgba(255, 255, 255, 0.12)" } } } diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 7f782aa..ad0936b 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -7,6 +7,7 @@ "APPS_CALCULATOR": "Calculator", "APPS_SETTINGS": "Settings", "APPS_BANK": "WhoDis Banking", + "APPS_NOTES": "Notes", "APPS_EXAMPLE": "Example app", "APPS_BANK_TRANSFER": "Transfer", "APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper", @@ -63,11 +64,11 @@ "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Failed to create message group", "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "You cannot add yourself!", - "APPS_CONTACTS_ADD_SUCCESS": "Successfully created contact!", - "APPS_CONTACTS_ADD_FAILED": "Failed to created contact!", - "APPS_CONTACTS_UPDATE_SUCCESS": "Successfully updated contact!", - "APPS_CONTACTS_UPDATE_FAILED": "Failed to update contact!", - "APPS_CONTACTS_DELETE_SUCCESS": "Successfully deleted contact!", - "APPS_CONTACTS_DELETE_FAILED": "Failed to delete contact!" + "APPS_CONTACT_ADD_SUCCESS": "Successfully created contact!", + "APPS_CONTACT_ADD_FAILED": "Failed to created contact!", + "APPS_CONTACT_UPDATE_SUCCESS": "Successfully updated contact!", + "APPS_CONTACT_UPDATE_FAILED": "Failed to update contact!", + "APPS_CONTACT_DELETE_SUCCESS": "Successfully deleted contact!", + "APPS_CONTACT_DELETE_FAILED": "Failed to delete contact!" } } diff --git a/phone/src/os/apps/hooks/useApps.tsx b/phone/src/os/apps/hooks/useApps.tsx index 58afc58..d3d726f 100644 --- a/phone/src/os/apps/hooks/useApps.tsx +++ b/phone/src/os/apps/hooks/useApps.tsx @@ -1,5 +1,5 @@ -import React from "react"; -import { useConfig } from "../../../config/hooks/useConfig"; +import React from 'react'; +import { useConfig } from '../../../config/hooks/useConfig'; import { blue, common, @@ -9,8 +9,8 @@ import { yellow, red, amber, -} from "@material-ui/core/colors"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +} from '@material-ui/core/colors'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faAd, faPlaneArrival, @@ -40,89 +40,89 @@ import { NotesApp } from "../../../apps/notes/NotesApp"; import CameraApp from "../../../apps/camera/components/CameraApp"; const appsState = atom({ - key: "apps", + key: 'apps', default: { preinstalled: [ { - id: "DIALER", - nameLocale: "APPS_DIALER", - icon: , + id: 'DIALER', + nameLocale: 'APPS_DIALER', + icon: , backgroundColor: green[600], color: common.white, - path: "/phone", - Route: () => , + path: '/phone', + Route: () => , }, { - id: "MESSAGES", - nameLocale: "APPS_MESSAGES", - icon: , + id: 'MESSAGES', + nameLocale: 'APPS_MESSAGES', + icon: , backgroundColor: amber[700], color: common.white, - path: "/messages", - Route: () => , + path: '/messages', + Route: () => , }, { - id: "CONTACTS", - nameLocale: "APPS_CONTACTS", + id: 'CONTACTS', + nameLocale: 'APPS_CONTACTS', icon: , backgroundColor: blue[500], color: common.white, - path: "/contacts", - Route: () => , + path: '/contacts', + Route: () => , }, { - id: "CALCULATOR", - nameLocale: "APPS_CALCULATOR", + id: 'CALCULATOR', + nameLocale: 'APPS_CALCULATOR', icon: , backgroundColor: purple[500], color: grey[50], - path: "/calculator", - Route: () => , + path: '/calculator', + Route: () => , }, { - id: "SETTINGS", - nameLocale: "APPS_SETTINGS", + id: 'SETTINGS', + nameLocale: 'APPS_SETTINGS', icon: , - backgroundColor: grey[700], + backgroundColor: '#383838', color: grey[50], - path: "/settings", - Route: () => , + path: '/settings', + Route: () => , }, { - id: "BANK", - nameLocale: "APPS_BANK", - icon: , + id: 'BANK', + nameLocale: 'APPS_BANK', + icon: , backgroundColor: blue[900], color: common.white, - path: "/bank", - Route: () => , + path: '/bank', + Route: () => , }, { - id: "TWITTER", - nameLocale: "APPS_TWITTER", - icon: , + id: 'TWITTER', + nameLocale: 'APPS_TWITTER', + icon: , backgroundColor: blue[600], color: common.white, - path: "/twitter", - Route: () => , + path: '/twitter', + Route: () => , }, { - id: "SELLOUT", - nameLocale: "APPS_SELLOUT", + id: 'SELLOUT', + nameLocale: 'APPS_SELLOUT', icon: , backgroundColor: red[500], color: common.white, - path: "/sellout", - Route: () => , + path: '/sellout', + Route: () => , }, { id: 'NOTES', - name: 'APPS_NOTES', + nameLocale: 'APPS_NOTES', icon: , backgroundColor: yellow[800], color: common.white, - path: "/notes", - Route: () => + path: '/notes', + Route: () => , }, { id: "CAMERA", @@ -139,8 +139,8 @@ const appsState = atom({ icon: , backgroundColor: blue[500], color: blue[50], - path: "/example", - Route: () => , + path: '/example', + Route: () => , }, ], }, diff --git a/phone/src/os/notifications/components/NotificationBar.tsx b/phone/src/os/notifications/components/NotificationBar.tsx index 7ebb2a4..07c963d 100644 --- a/phone/src/os/notifications/components/NotificationBar.tsx +++ b/phone/src/os/notifications/components/NotificationBar.tsx @@ -1,26 +1,29 @@ -import React from "react"; -import { makeStyles, Typography, Grid, IconButton } from "@material-ui/core"; -import { fade } from "@material-ui/core/styles/colorManipulator"; -import SignalIcon from "@material-ui/icons/SignalCellular3Bar"; +import React from 'react'; +import { makeStyles, Typography, Grid, IconButton } from '@material-ui/core'; +import SignalIcon from '@material-ui/icons/SignalCellular3Bar'; +import Battery90Icon from '@material-ui/icons/Battery90'; +import Default from '../../../config/default.json'; const useStyles = makeStyles((theme) => ({ root: { - backgroundColor: fade(theme.palette.background.paper, 0.7), - height: "25px", - width: "100%", + backgroundColor: theme.palette.background.default, + height: '30px', + width: '100%', color: theme.palette.text.primary, zIndex: 2, + paddingLeft: '15px', + paddingRight: '10px', }, item: { - margin: "0 6px", + margin: '0 6px', }, text: { - position: "relative", - bottom: "2px", + position: 'relative', + lineHeight: '30px', color: theme.palette.text.primary, }, icon: { - padding: "4px", + padding: '4px', color: theme.palette.text.primary, }, })); @@ -40,10 +43,10 @@ export const NotificationBar = ({ notifications = [] }: IProps) => { - + {notifications.map((notification) => ( { ))} - + - + - {`AT&T`} + + {Default.cellProvider} + + + + diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts new file mode 100644 index 0000000..ab5a4b0 --- /dev/null +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -0,0 +1,49 @@ +import { useState } from 'react'; + +// TODO: Integrate debug log to fetch when that branch is merged + +/** + * A LocalStorage hook designed to behave like the useState hook. + * @param {string} key - The unique identifier to be used as a key + * @param {string} intialValue - The initialValue to be used + * if there is no savedState + */ + +function useLocalStorage(key: string, initialValue: T) { + // Serves as a nice identifying prefix for the key + const UNIQ_PREFIX = 'npwd_phone_'; + const [localVal, setLocalVal] = useState(() => { + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + key); + // return stored or initValue if none stored + return data ? JSON.parse(data) : initialValue; + } catch (e) { + // TODO: Integrate debug error state here + console.log(e); + // We still return initVal if error is thrown + return initialValue; + } + }); + + // Trying to rep useState setter pretty close just with localStorage + const setVal = (value: T | ((val: T) => T)) => { + try { + // Same API as useState meaning we can accept a function for value + const valForStore = value instanceof Function ? value(localVal) : value; + // Save that state so we repli useState + setLocalVal(valForStore); + // Set that localStorage yo + window.localStorage.setItem( + UNIQ_PREFIX + key, + JSON.stringify(valForStore) + ); + } catch (e) { + // TODO: Also integrate debug log state error here + console.log(e); + } + }; + + return [localVal, setVal]; +} + +export default useLocalStorage; diff --git a/phone/src/os/phone/hooks/usePhone.ts b/phone/src/os/phone/hooks/usePhone.ts index 1776e24..42dff45 100644 --- a/phone/src/os/phone/hooks/usePhone.ts +++ b/phone/src/os/phone/hooks/usePhone.ts @@ -1,6 +1,6 @@ -import { useRecoilValue } from "recoil"; -import { phoneState } from "./state"; -import { ServerConfig } from "../../../common/interfaces/config"; +import { useRecoilValue } from 'recoil'; +import { phoneState } from './state'; +import { ServerConfig } from '../../../common/typings/config'; interface IUsePhone { visibility: boolean; diff --git a/phone/src/ui/components/AppContent.tsx b/phone/src/ui/components/AppContent.tsx index 6908dfc..eb6cb0a 100644 --- a/phone/src/ui/components/AppContent.tsx +++ b/phone/src/ui/components/AppContent.tsx @@ -4,7 +4,7 @@ import { AppContentTypes } from "../interface/InterfaceUI"; const useStyles = makeStyles(() => ({ wrapper: { - height: "67vh", + height: "70vh", // NOTE: Taso: Hacky change temp, this should be done automatically tbh. Will refactor at some point overflow: "auto", }, box: { @@ -32,7 +32,7 @@ export const AppContent = ({ }: AppContentTypes) => { const classes = useStyles(); return ( - + ({ root: ({ backgroundColor }) => ({ width: "100%", - textAlign: "center", + textAlign: "left", backgroundColor: backgroundColor || theme.palette.background.default, }), text: ({ color }) => ({ @@ -26,16 +26,17 @@ const useStyle = makeStyles( }), }) ); - +// Taso: Maybe we should pass an icon (maybe fa?) as a prop as well at somepoint +// but need to think about the best way to do that for standardization sake. export const AppTitle = ({ app: { backgroundColor, color, nameLocale }, - variant = "h4", + variant = "h5", ...props }: IProps) => { const classes = useStyle({ color, backgroundColor }); const { t } = useTranslation(); return ( - + {t(nameLocale)} diff --git a/phone/src/ui/components/AppWrapper.tsx b/phone/src/ui/components/AppWrapper.tsx index 63d87f0..7b9b84d 100644 --- a/phone/src/ui/components/AppWrapper.tsx +++ b/phone/src/ui/components/AppWrapper.tsx @@ -1,5 +1,5 @@ -import React from "react"; -import { AppWrapperTypes } from "../interface/InterfaceUI"; +import React from 'react'; +import { AppWrapperTypes } from '../interface/InterfaceUI'; export const AppWrapper = ({ children, @@ -13,11 +13,12 @@ export const AppWrapper = ({ style={{ padding: 0, margin: 0, - width: "100%", - height: "100%", - display: "flex", - position: "relative", - flexDirection: "column", + width: '100%', + height: '100%', + display: 'flex', + position: 'relative', + flexDirection: 'column', + minHeight: '720px', ...style, }} > diff --git a/phone/src/ui/components/ContextMenu.tsx b/phone/src/ui/components/ContextMenu.tsx index 5b08fdc..a148c72 100644 --- a/phone/src/ui/components/ContextMenu.tsx +++ b/phone/src/ui/components/ContextMenu.tsx @@ -1,18 +1,18 @@ -import React from "react"; +import React from 'react'; import { ListItemIcon, ListItemText, Slide, makeStyles, Paper, -} from "@material-ui/core"; -import { List } from "./List"; -import { ListItem } from "./ListItem"; +} from '@material-ui/core'; +import { List } from './List'; +import { ListItem } from './ListItem'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", - position: "absolute", + width: '100%', + position: 'absolute', bottom: 0, zIndex: 2, }, @@ -21,9 +21,9 @@ const useStyles = makeStyles((theme) => ({ export const ContextMenu = ({ open, onClose, options }) => { const classes = useStyles(); return ( - + - + {options.map((option) => ( ({ root: { @@ -10,7 +10,11 @@ const useStyles = makeStyles((theme) => ({ }, item: { marginTop: theme.spacing(3), - width: "20%", + width: '20%', + }, + tooltip: { + bottom: -8, + fontSize: 12, }, })); @@ -19,18 +23,27 @@ export const GridMenu = ({ items, Component = AppIcon }) => { const classes = useStyles(); useEffect(function registerKeyHandlers() { - setKey("ArrowLeft", () => { - console.log(":v"); + setKey('ArrowLeft', () => { + console.log(':v'); }); // eslint-disable-next-line }, []); return ( - + {items && items.length && items.map((item) => ( + // { > + // ))}