mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
08e21f4129
53 files changed
+563
-352
No files matched your search
+2
-1
@@ -1 +1,2 @@
|
||||
|
||||
# No intellij folder
|
||||
.idea
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ function Phone() {
|
||||
return (
|
||||
<ThemeProvider theme={currentTheme()}>
|
||||
<div className='PhoneWrapper'>
|
||||
<div style={{ zoom: '80%' }}>
|
||||
<div style={{ zoom: settings.zoom }}>
|
||||
<div className='Phone'>
|
||||
<div
|
||||
className='PhoneFrame'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { Transfer } from '../../../common/interfaces/bank';
|
||||
import { Transfer } from '../../../common/typings/bank';
|
||||
import { bankState } from './state';
|
||||
|
||||
interface IBankNotification {
|
||||
@@ -9,5 +9,5 @@ interface IBankNotification {
|
||||
|
||||
export const useBankNotification = (): IBankNotification => {
|
||||
const notification = useRecoilValue<Transfer | null>(bankState.notification);
|
||||
return { notification }
|
||||
}
|
||||
return { notification };
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -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 (
|
||||
<Box display="flex" flexDirection="column">
|
||||
<Box display='flex' flexDirection='column'>
|
||||
<Box flexGrow={1} component={Paper} p={4} className={classes.result}>
|
||||
{result()}
|
||||
{result().toLocaleString(undefined, {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 4,
|
||||
})}
|
||||
</Box>
|
||||
<Box>
|
||||
<Grid container justify="space-around">
|
||||
<Grid container justify='space-around'>
|
||||
<CalcButton button={clear} className={classes.button} />
|
||||
<CalcButton button={clearAll} className={classes.button} />
|
||||
<CalcButton button={divider} className={classes.button} />
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 (
|
||||
<AppWrapper id='contact-app'>
|
||||
<AppTitle app={contacts}></AppTitle>
|
||||
<AppTitle app={contacts} />
|
||||
<SearchContacts />
|
||||
<AddContactModal />
|
||||
<InfoModal key={contactDetail?.id} />
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ export const InfoModal = () => {
|
||||
<Slide direction='up' in={showContactModal}>
|
||||
<Paper
|
||||
className={showContactModal ? classes.modalRoot : classes.modalHide}
|
||||
square
|
||||
>
|
||||
<Button style={{ margin: 10 }} onClick={closeModal}>
|
||||
<ArrowBackIcon fontSize='large' />
|
||||
|
||||
@@ -12,7 +12,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
zIndex: 5,
|
||||
},
|
||||
absolute: {
|
||||
position: 'sticky',
|
||||
position: 'absolute',
|
||||
bottom: theme.spacing(2),
|
||||
left: theme.spacing(3),
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { IContactAlert } from '../../../common/interfaces/contact';
|
||||
import { IContactAlert } from '../../../common/typings/contact';
|
||||
import { contactsState } from './state';
|
||||
|
||||
export const useContactAlert = (): IContactAlert => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import PhoneCallbackIcon from "@material-ui/icons/PhoneCallback";
|
||||
import PhoneForwardedIcon from "@material-ui/icons/PhoneForwarded";
|
||||
import { List } from "../../../ui/components/List";
|
||||
import { ListItem } from "../../../ui/components/ListItem";
|
||||
import React from 'react';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback';
|
||||
import PhoneForwardedIcon from '@material-ui/icons/PhoneForwarded';
|
||||
import { List } from '../../../ui/components/List';
|
||||
import { ListItem } from '../../../ui/components/ListItem';
|
||||
|
||||
const CallTypeIcon = {
|
||||
incoming: <PhoneCallbackIcon />,
|
||||
@@ -12,7 +12,7 @@ const CallTypeIcon = {
|
||||
|
||||
export const DialerHistory = ({ calls }) => {
|
||||
return (
|
||||
<List>
|
||||
<List disablePadding>
|
||||
{calls.map((call) => (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemText primary={call.caller} secondary={call.phoneNumber} />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from "react";
|
||||
import React from 'react';
|
||||
import {
|
||||
ListItem,
|
||||
ListItemText,
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
} from "@material-ui/core";
|
||||
} from '@material-ui/core';
|
||||
|
||||
import { MessageGroup } from "../../../../common/interfaces/messages";
|
||||
import { MessageGroup } from '../../../../common/typings/messages';
|
||||
|
||||
interface IProps {
|
||||
messageGroup: MessageGroup;
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { List } from "@material-ui/core";
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { List } from '@material-ui/core';
|
||||
|
||||
import { MessageGroup } from "../../../../common/interfaces/messages";
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import useMessages from "../../hooks/useMessages";
|
||||
import useModals from "../../hooks/useModals";
|
||||
import MessageSearch from "./MessageSearch";
|
||||
import MessageGroupItem from "./MessageGroupItem";
|
||||
import useStyles from "./list.styles";
|
||||
import { MessageGroup } from '../../../../common/typings/messages';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import useMessages from '../../hooks/useMessages';
|
||||
import useModals from '../../hooks/useModals';
|
||||
import MessageSearch from './MessageSearch';
|
||||
import MessageGroupItem from './MessageGroupItem';
|
||||
import useStyles from './list.styles';
|
||||
|
||||
const MessagesList = (): any => {
|
||||
const classes = useStyles();
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const { messageGroups } = useMessages();
|
||||
const { setActiveMessageGroup } = useModals();
|
||||
|
||||
useEffect(() => {
|
||||
Nui.send("phone:fetchMessageGroups");
|
||||
Nui.send('phone:fetchMessageGroups');
|
||||
}, []);
|
||||
|
||||
if (!messageGroups) return null;
|
||||
|
||||
const handleClick = (messageGroup: MessageGroup) => () => {
|
||||
setActiveMessageGroup(messageGroup);
|
||||
Nui.send("phone:fetchMessages", { groupId: messageGroup.groupId });
|
||||
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
||||
};
|
||||
|
||||
const formattedSearch = searchValue.toLowerCase().trim();
|
||||
|
||||
@@ -1,46 +1,41 @@
|
||||
import React from "react";
|
||||
import { Paper, Typography } from "@material-ui/core";
|
||||
import React from 'react';
|
||||
import { Paper, Typography } from '@material-ui/core';
|
||||
|
||||
import { Message, MessageGroup } from "../../../../common/interfaces/messages";
|
||||
import MessageInput from "../form/MessageInput";
|
||||
import useStyles from "./modal.styles";
|
||||
import { MessageImageModal } from "./MessageImageModal";
|
||||
import { Message, MessageGroup } from '../../../../common/typings/messages';
|
||||
import MessageInput from '../form/MessageInput';
|
||||
import useStyles from './modal.styles';
|
||||
import { MessageImageModal } from './MessageImageModal';
|
||||
|
||||
interface IProps {
|
||||
activeMessageGroup: MessageGroup;
|
||||
messages: Message[];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const CONVERSATION_ELEMENT_ID = "message-modal-conversation";
|
||||
export const CONVERSATION_ELEMENT_ID = 'message-modal-conversation';
|
||||
|
||||
const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||
const classes = useStyles();
|
||||
|
||||
|
||||
const isImage = (url) => {
|
||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url)
|
||||
}
|
||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<MessageImageModal messageGroupId={activeMessageGroup.groupId}/>
|
||||
<MessageImageModal messageGroupId={activeMessageGroup.groupId} />
|
||||
<div id={CONVERSATION_ELEMENT_ID} className={classes.messageList}>
|
||||
{messages.map((message) => (
|
||||
<div key={message.id} className={classes.messageContainer}>
|
||||
<Paper
|
||||
className={message.isMine ? classes.sourceSms : classes.sms}
|
||||
variant="outlined"
|
||||
variant='outlined'
|
||||
>
|
||||
{isImage(message.message) ? (
|
||||
<img src={message.message} className={classes.imageMessage}/>
|
||||
{isImage(message.message) ? (
|
||||
<img src={message.message} className={classes.imageMessage} />
|
||||
) : (
|
||||
<div>{message.message}</div>
|
||||
)}
|
||||
<Typography variant="subtitle1" color="secondary">
|
||||
)}
|
||||
<Typography variant='subtitle1' color='secondary'>
|
||||
{activeMessageGroup.isGroupChat && !message.isMine
|
||||
? message.display || message.phone_number
|
||||
: null}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useRecoilState } from "recoil";
|
||||
import { CreateMessageGroupResult } from "../../../common/interfaces/messages";
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { CreateMessageGroupResult } from '../../../common/typings/messages';
|
||||
|
||||
import { messageState } from "./state";
|
||||
import { messageState } from './state';
|
||||
|
||||
interface IUseAlerts {
|
||||
createMessageGroupResult: CreateMessageGroupResult | null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRecoilState, useRecoilValue } from "recoil";
|
||||
import { Message, MessageGroup } from "../../../common/interfaces/messages";
|
||||
import { messageState } from "./state";
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { Message, MessageGroup } from '../../../common/typings/messages';
|
||||
import { messageState } from './state';
|
||||
|
||||
interface IUseMessages {
|
||||
messages?: Message[] | null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRecoilState } from "recoil";
|
||||
import { MessageGroup } from "../../../common/interfaces/messages";
|
||||
import { messageState } from "./state";
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { MessageGroup } from '../../../common/typings/messages';
|
||||
import { messageState } from './state';
|
||||
|
||||
interface IUseModal {
|
||||
activeMessageGroup: MessageGroup | null;
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../ui/components/AppWrapper";
|
||||
import { AppContent } from "../../ui/components/AppContent";
|
||||
import NotesTitle from "./NotesTitle";
|
||||
import NoteList from "./list/NoteList";
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../ui/components/AppWrapper';
|
||||
import { AppContent } from '../../ui/components/AppContent';
|
||||
import { AppTitle } from '../../ui/components/AppTitle';
|
||||
import { useApp } from '../../os/apps/hooks/useApps';
|
||||
import NoteList from './list/NoteList';
|
||||
|
||||
import { useNotes } from "./hooks/useNotes";
|
||||
import { NoteModal } from "./modal/NoteModal";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import AddIcon from "@material-ui/icons/Add";
|
||||
import { useNotes } from './hooks/useNotes';
|
||||
import { NoteModal } from './modal/NoteModal';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
|
||||
import { useNoteModal } from "./hooks/useNoteModal";
|
||||
import { useNoteDetail } from "./hooks/useNoteDetail";
|
||||
import { useNoteModal } from './hooks/useNoteModal';
|
||||
import { useNoteDetail } from './hooks/useNoteDetail';
|
||||
|
||||
import useStyles from "./notes.styles";
|
||||
import useStyles from './notes.styles';
|
||||
|
||||
export const NotesApp = () => {
|
||||
const { setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
const notes = useNotes();
|
||||
const notesApp = useApp('NOTES');
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
@@ -27,8 +29,8 @@ export const NotesApp = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<AppWrapper id="notes-app">
|
||||
<NotesTitle />
|
||||
<AppWrapper id='notes-app'>
|
||||
<AppTitle app={notesApp} />
|
||||
<NoteModal key={detail?.id} />
|
||||
<AppContent>
|
||||
<NoteList notes={notes} />
|
||||
@@ -36,8 +38,8 @@ export const NotesApp = () => {
|
||||
className={classes.absolute}
|
||||
onClick={handleModal}
|
||||
style={{
|
||||
background: "#f9a825",
|
||||
color: "#fff",
|
||||
background: '#f9a825',
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
<AddIcon />
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
import { List, ListItem, ListItemText } from '@material-ui/core';
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
|
||||
// add search bar later
|
||||
const NoteList = ({notes}) => {
|
||||
// TODO: Add interface for note
|
||||
const NoteList = ({ notes }) => {
|
||||
const { setNoteModal } = useNoteModal();
|
||||
const { setDetail } = useNoteDetail();
|
||||
|
||||
const handleNoteModal = (note) => {
|
||||
setNoteModal(true)
|
||||
setDetail(note)
|
||||
}
|
||||
setNoteModal(true);
|
||||
setDetail(note);
|
||||
};
|
||||
|
||||
return (
|
||||
<List>
|
||||
<List disablePadding>
|
||||
{notes.map((note) => (
|
||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||
<ListItemText><strong>{note.title}</strong></ListItemText>
|
||||
<ListItem
|
||||
key={note.id}
|
||||
button
|
||||
divider
|
||||
onClick={() => handleNoteModal(note)}
|
||||
>
|
||||
<ListItemText>{note.title}</ListItemText>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default NoteList;
|
||||
@@ -1,25 +1,22 @@
|
||||
import {
|
||||
Button,
|
||||
TextField,
|
||||
Slide,
|
||||
} from "@material-ui/core";
|
||||
import React, { useState } from "react";
|
||||
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
|
||||
import { Button, TextField, Slide } from '@material-ui/core';
|
||||
import React, { useState } from 'react';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import { useNoteModal } from "../hooks/useNoteModal";
|
||||
import { useNoteDetail } from "../hooks/useNoteDetail";
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
|
||||
import useStyles from "./modal.styles";
|
||||
import useStyles from './modal.styles';
|
||||
|
||||
import "../NotesApp.css";
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import '../NotesApp.css';
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
|
||||
// TODO: Fix input focus color
|
||||
export const NoteModal = () => {
|
||||
const { noteModal, setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
console.log(detail);
|
||||
const [title, setTitle] = useState(detail ? detail.title : "");
|
||||
const [content, setContent] = useState(detail ? detail.content : "");
|
||||
const [title, setTitle] = useState(detail ? detail.title : '');
|
||||
const [content, setContent] = useState(detail ? detail.content : '');
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
@@ -31,7 +28,7 @@ export const NoteModal = () => {
|
||||
const handleNoteSave = () => {
|
||||
setNoteModal(false);
|
||||
setDetail(null);
|
||||
Nui.send("phone:addNote", {
|
||||
Nui.send('phone:addNote', {
|
||||
title,
|
||||
content,
|
||||
});
|
||||
@@ -40,14 +37,14 @@ export const NoteModal = () => {
|
||||
const handleDeleteNote = () => {
|
||||
const id = detail.id;
|
||||
setNoteModal(false);
|
||||
Nui.send("phone:deleteNote", {
|
||||
Nui.send('phone:deleteNote', {
|
||||
id,
|
||||
});
|
||||
setDetail(null);
|
||||
};
|
||||
|
||||
const handleUpdateNote = () => {
|
||||
Nui.send("phone:updateNote", {
|
||||
Nui.send('phone:updateNote', {
|
||||
id: detail.id,
|
||||
title,
|
||||
content,
|
||||
@@ -58,15 +55,15 @@ export const NoteModal = () => {
|
||||
|
||||
return (
|
||||
<div className={noteModal ? classes.modalRoot : classes.modalHide}>
|
||||
<Slide direction="left" in={noteModal} mountOnEnter unmountOnExit>
|
||||
<Slide direction='left' in={noteModal} mountOnEnter unmountOnExit>
|
||||
<div>
|
||||
<Button className={classes.closeButton} onClick={_handleClose}>
|
||||
<ArrowBackIcon fontSize="large" />
|
||||
</Button>
|
||||
<div id="notes-modal" className={classes.noteContainer}>
|
||||
<div id='notes-modal' className={classes.noteContainer}>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder="Title"
|
||||
placeholder='Title'
|
||||
inputProps={{
|
||||
className: classes.inputPropsTitle,
|
||||
}}
|
||||
@@ -79,11 +76,11 @@ export const NoteModal = () => {
|
||||
inputProps={{
|
||||
className: classes.inputPropsContent,
|
||||
}}
|
||||
placeholder="Content"
|
||||
placeholder='Content'
|
||||
multiline
|
||||
fullWidth
|
||||
rows={19}
|
||||
variant="outlined"
|
||||
variant='outlined'
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
/>
|
||||
|
||||
@@ -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 (
|
||||
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
||||
<FontAwesomeIcon icon={faAd} className={classes.icon} />
|
||||
</Paper>
|
||||
);
|
||||
|
||||
@@ -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 = () => {
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faHome} />}
|
||||
to="/sellout"
|
||||
to='/sellout'
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<AddCircleIcon />}
|
||||
to="/sellout/new"
|
||||
to='/sellout/new'
|
||||
/>
|
||||
</BottomNavigation>
|
||||
);
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<ListItem onClick={() => onClick(options)} button>
|
||||
<ListItemText primary={label} secondary={value} />
|
||||
<ListItemIcon>{icon}</ListItemIcon>
|
||||
<ListItemText primary={label} secondary={value ? value : undefined} />
|
||||
</ListItem>
|
||||
<Divider />
|
||||
</>
|
||||
|
||||
@@ -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 }) => (
|
||||
<ListSubheader component='div' disableSticky>
|
||||
{props.text}
|
||||
</ListSubheader>
|
||||
);
|
||||
|
||||
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 (
|
||||
<AppWrapper>
|
||||
<AppTitle app={settingsApp} />
|
||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||
<List>
|
||||
<List disablePadding subheader={<SubHeaderComp text='Phone' />}>
|
||||
<SettingItem
|
||||
label="Theme"
|
||||
label='Phone Number'
|
||||
value={simcard.number}
|
||||
icon={<Phone />}
|
||||
/>
|
||||
<SettingItem
|
||||
label='Ringtone'
|
||||
value={settings.ringtone}
|
||||
options={ringtones}
|
||||
onClick={openMenu}
|
||||
icon={<LibraryMusic />}
|
||||
/>
|
||||
{
|
||||
// * NOTE: This component is most likely temporary
|
||||
// * Probably want to make it a slider in the future. Ignore hardcoded for the meantime
|
||||
}
|
||||
<SettingItem
|
||||
label='Ringtone Volume'
|
||||
value='100%'
|
||||
options={['100%', '80%', '70%']}
|
||||
onClick={openMenu}
|
||||
icon={<VolumeUp />}
|
||||
/>
|
||||
</List>
|
||||
<List disablePadding subheader={<SubHeaderComp text='Appearance' />}>
|
||||
<SettingItem
|
||||
label='Theme'
|
||||
value={settings.theme}
|
||||
options={themes}
|
||||
onClick={openMenu}
|
||||
icon={<Brush />}
|
||||
/>
|
||||
<SettingItem
|
||||
label="Wallpaper"
|
||||
label='Wallpaper'
|
||||
value={settings.wallpaper}
|
||||
options={wallpapers}
|
||||
onClick={openMenu}
|
||||
icon={<Wallpaper />}
|
||||
/>
|
||||
<SettingItem
|
||||
label="Frame"
|
||||
label='Frame'
|
||||
value={settings.frame}
|
||||
options={frames}
|
||||
onClick={openMenu}
|
||||
icon={<Smartphone />}
|
||||
/>
|
||||
<SettingItem
|
||||
label='Zoom'
|
||||
value={settings.zoom}
|
||||
options={zoomOptions}
|
||||
onClick={openMenu}
|
||||
icon={<ZoomIn />}
|
||||
/>
|
||||
<SettingItem label="Phone Number" value={simcard.number} />
|
||||
</List>
|
||||
</AppContent>
|
||||
<ContextMenu />
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"wallpaper": "default.png",
|
||||
"frame": "s10.png",
|
||||
"theme": "default-dark"
|
||||
"theme": "taso-dark",
|
||||
"zoom": "100%",
|
||||
"ringtone": "pixel",
|
||||
"ringtoneVol": 100
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface IContactAlert {
|
||||
alert: string;
|
||||
setAlert: (type: string) => void;
|
||||
}
|
||||
File renamed without changes.
@@ -16,8 +16,8 @@ interface General {
|
||||
}
|
||||
|
||||
interface NotificationConfig {
|
||||
horizontal: "left" | "center" | "right";
|
||||
vertical: "bottom" | "top";
|
||||
horizontal: 'left' | 'center' | 'right';
|
||||
vertical: 'bottom' | 'top';
|
||||
}
|
||||
|
||||
interface BankConfig {
|
||||
@@ -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;
|
||||
}
|
||||
File renamed without changes.
@@ -6,4 +6,4 @@ export interface Note {
|
||||
|
||||
export interface NoteId {
|
||||
id: number;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface IPhoto {
|
||||
image: string;
|
||||
id: number
|
||||
}
|
||||
id: number;
|
||||
}
|
||||
File renamed without changes.
@@ -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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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!"
|
||||
}
|
||||
}
|
||||
@@ -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: <FontAwesomeIcon icon={faPhoneAlt} size="xs" />,
|
||||
id: 'DIALER',
|
||||
nameLocale: 'APPS_DIALER',
|
||||
icon: <FontAwesomeIcon icon={faPhoneAlt} size='xs' />,
|
||||
backgroundColor: green[600],
|
||||
color: common.white,
|
||||
path: "/phone",
|
||||
Route: () => <Route path="/phone" component={DialerApp} />,
|
||||
path: '/phone',
|
||||
Route: () => <Route path='/phone' component={DialerApp} />,
|
||||
},
|
||||
{
|
||||
id: "MESSAGES",
|
||||
nameLocale: "APPS_MESSAGES",
|
||||
icon: <MessageIcon fontSize="default" />,
|
||||
id: 'MESSAGES',
|
||||
nameLocale: 'APPS_MESSAGES',
|
||||
icon: <MessageIcon fontSize='default' />,
|
||||
backgroundColor: amber[700],
|
||||
color: common.white,
|
||||
path: "/messages",
|
||||
Route: () => <Route path="/messages" component={MessagesApp} />,
|
||||
path: '/messages',
|
||||
Route: () => <Route path='/messages' component={MessagesApp} />,
|
||||
},
|
||||
{
|
||||
id: "CONTACTS",
|
||||
nameLocale: "APPS_CONTACTS",
|
||||
id: 'CONTACTS',
|
||||
nameLocale: 'APPS_CONTACTS',
|
||||
icon: <ContactsIcon />,
|
||||
backgroundColor: blue[500],
|
||||
color: common.white,
|
||||
path: "/contacts",
|
||||
Route: () => <Route path="/contacts" component={ContactsApp} />,
|
||||
path: '/contacts',
|
||||
Route: () => <Route path='/contacts' component={ContactsApp} />,
|
||||
},
|
||||
{
|
||||
id: "CALCULATOR",
|
||||
nameLocale: "APPS_CALCULATOR",
|
||||
id: 'CALCULATOR',
|
||||
nameLocale: 'APPS_CALCULATOR',
|
||||
icon: <CalculatorIcon />,
|
||||
backgroundColor: purple[500],
|
||||
color: grey[50],
|
||||
path: "/calculator",
|
||||
Route: () => <Route path="/calculator" component={CalculatorApp} />,
|
||||
path: '/calculator',
|
||||
Route: () => <Route path='/calculator' component={CalculatorApp} />,
|
||||
},
|
||||
{
|
||||
id: "SETTINGS",
|
||||
nameLocale: "APPS_SETTINGS",
|
||||
id: 'SETTINGS',
|
||||
nameLocale: 'APPS_SETTINGS',
|
||||
icon: <SettingsIcon />,
|
||||
backgroundColor: grey[700],
|
||||
backgroundColor: '#383838',
|
||||
color: grey[50],
|
||||
path: "/settings",
|
||||
Route: () => <Route path="/settings" component={SettingsApp} />,
|
||||
path: '/settings',
|
||||
Route: () => <Route path='/settings' component={SettingsApp} />,
|
||||
},
|
||||
{
|
||||
id: "BANK",
|
||||
nameLocale: "APPS_BANK",
|
||||
icon: <FontAwesomeIcon icon={faWonSign} size="xs" />,
|
||||
id: 'BANK',
|
||||
nameLocale: 'APPS_BANK',
|
||||
icon: <FontAwesomeIcon icon={faWonSign} size='xs' />,
|
||||
backgroundColor: blue[900],
|
||||
color: common.white,
|
||||
path: "/bank",
|
||||
Route: () => <Route path="/bank" component={BankApp} />,
|
||||
path: '/bank',
|
||||
Route: () => <Route path='/bank' component={BankApp} />,
|
||||
},
|
||||
{
|
||||
id: "TWITTER",
|
||||
nameLocale: "APPS_TWITTER",
|
||||
icon: <FontAwesomeIcon icon={faTwitter} fixedWidth size="xs" />,
|
||||
id: 'TWITTER',
|
||||
nameLocale: 'APPS_TWITTER',
|
||||
icon: <FontAwesomeIcon icon={faTwitter} fixedWidth size='xs' />,
|
||||
backgroundColor: blue[600],
|
||||
color: common.white,
|
||||
path: "/twitter",
|
||||
Route: () => <Route path="/twitter" component={TwitterApp} />,
|
||||
path: '/twitter',
|
||||
Route: () => <Route path='/twitter' component={TwitterApp} />,
|
||||
},
|
||||
{
|
||||
id: "SELLOUT",
|
||||
nameLocale: "APPS_SELLOUT",
|
||||
id: 'SELLOUT',
|
||||
nameLocale: 'APPS_SELLOUT',
|
||||
icon: <FontAwesomeIcon icon={faAd} fixedWidth />,
|
||||
backgroundColor: red[500],
|
||||
color: common.white,
|
||||
path: "/sellout",
|
||||
Route: () => <Route path="/sellout" component={SelloutApp} />,
|
||||
path: '/sellout',
|
||||
Route: () => <Route path='/sellout' component={SelloutApp} />,
|
||||
},
|
||||
{
|
||||
id: 'NOTES',
|
||||
name: 'APPS_NOTES',
|
||||
nameLocale: 'APPS_NOTES',
|
||||
icon: <FontAwesomeIcon icon={faStickyNote} fixedWidth />,
|
||||
backgroundColor: yellow[800],
|
||||
color: common.white,
|
||||
path: "/notes",
|
||||
Route: () => <Route path="/notes" component={NotesApp}/>
|
||||
path: '/notes',
|
||||
Route: () => <Route path='/notes' component={NotesApp} />,
|
||||
},
|
||||
{
|
||||
id: "CAMERA",
|
||||
@@ -139,8 +139,8 @@ const appsState = atom({
|
||||
icon: <FontAwesomeIcon icon={faPlaneArrival} size="sm" />,
|
||||
backgroundColor: blue[500],
|
||||
color: blue[50],
|
||||
path: "/example",
|
||||
Route: () => <Route path="/example" component={ExampleApp} />,
|
||||
path: '/example',
|
||||
Route: () => <Route path='/example' component={ExampleApp} />,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -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) => {
|
||||
<Grid
|
||||
className={classes.root}
|
||||
container
|
||||
justify="space-between"
|
||||
wrap="nowrap"
|
||||
justify='space-between'
|
||||
wrap='nowrap'
|
||||
>
|
||||
<Grid container item wrap="nowrap">
|
||||
<Grid container item wrap='nowrap'>
|
||||
{notifications.map((notification) => (
|
||||
<Grid
|
||||
item
|
||||
@@ -55,15 +58,19 @@ export const NotificationBar = ({ notifications = [] }: IProps) => {
|
||||
</Grid>
|
||||
))}
|
||||
</Grid>
|
||||
<Grid container item wrap="nowrap" justify="flex-end">
|
||||
<Grid container item wrap='nowrap' justify='flex-end' alignItems='center'>
|
||||
<Grid item>
|
||||
<SignalIcon fontSize="small" />
|
||||
<SignalIcon fontSize='small' />
|
||||
</Grid>
|
||||
<Grid item className={classes.item}>
|
||||
<Typography
|
||||
className={classes.text}
|
||||
variant="button"
|
||||
>{`AT&T`}</Typography>
|
||||
<Typography className={classes.text} variant='button'>
|
||||
{Default.cellProvider}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Battery90Icon
|
||||
style={{ transform: 'rotate(90deg)', display: 'block' }}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -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<T>(key: string, initialValue: T) {
|
||||
// Serves as a nice identifying prefix for the key
|
||||
const UNIQ_PREFIX = 'npwd_phone_';
|
||||
const [localVal, setLocalVal] = useState<T>(() => {
|
||||
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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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 (
|
||||
<Paper className={classes.wrapper}>
|
||||
<Paper className={classes.wrapper} square>
|
||||
<Box flexGrow={1} className={classes.box} {...props}>
|
||||
<Paper square elevation={0} className={classes.paper}>
|
||||
<Backdrop
|
||||
|
||||
@@ -18,7 +18,7 @@ const useStyle = makeStyles(
|
||||
(theme): IUseStyle => ({
|
||||
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 (
|
||||
<Box px={2} pt={4} className={classes.root} {...props}>
|
||||
<Box px={2} pt={2} className={classes.root} {...props}>
|
||||
<Typography className={classes.text} paragraph variant={variant}>
|
||||
{t(nameLocale)}
|
||||
</Typography>
|
||||
|
||||
@@ -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,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -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 (
|
||||
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
|
||||
<Slide direction='up' in={open} mountOnEnter unmountOnExit>
|
||||
<Paper square className={classes.root}>
|
||||
<List>
|
||||
<List disablePadding>
|
||||
{options.map((option) => (
|
||||
<ListItem
|
||||
selected={option.selected}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { AppIcon } from "./AppIcon";
|
||||
import { Grid, makeStyles } from "@material-ui/core";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useKeyboard } from "../../os/keyboard/hooks/useKeyboard";
|
||||
import React, { useEffect } from 'react';
|
||||
import { AppIcon } from './AppIcon';
|
||||
import { Grid, makeStyles, Tooltip } from '@material-ui/core';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useKeyboard } from '../../os/keyboard/hooks/useKeyboard';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
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 (
|
||||
<Grid container justify="center">
|
||||
<Grid container justify='center'>
|
||||
<Grid container item>
|
||||
{items &&
|
||||
items.length &&
|
||||
items.map((item) => (
|
||||
// <Tooltip
|
||||
// title={item.id}
|
||||
// placement='top'
|
||||
// arrow
|
||||
// classes={{ tooltip: classes.tooltip }}
|
||||
// PopperProps={{
|
||||
// anchorEl={}
|
||||
// }}
|
||||
// >
|
||||
<Grid
|
||||
key={item.id}
|
||||
item
|
||||
@@ -40,6 +53,7 @@ export const GridMenu = ({ items, Component = AppIcon }) => {
|
||||
>
|
||||
<Component {...item} />
|
||||
</Grid>
|
||||
// </Tooltip>
|
||||
))}
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in new issue
Block a user