mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-02 14:38:46 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c06f26271 | ||
|
|
4bf3248168 | ||
|
|
cb1aa80f83 | ||
|
|
9896f2384e |
No files matched your search
@@ -52,7 +52,6 @@ export const DialerInput = () => {
|
||||
className={classes.input}
|
||||
value={inputVal}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
type="number"
|
||||
/>
|
||||
<IconButton color="primary" className={classes.iconBtn} disabled={inputVal <= ''}>
|
||||
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
|
||||
|
||||
@@ -3,9 +3,7 @@ import qs from 'qs';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary';
|
||||
import { Box, Typography, TextField, Button } from '@material-ui/core';
|
||||
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
||||
import useStyles from './modal.styles';
|
||||
import { Box, Typography, Button } from '@material-ui/core';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { ContextMenu } from '../../../../ui/components/ContextMenu';
|
||||
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
|
||||
@@ -20,12 +18,8 @@ interface IProps {
|
||||
}
|
||||
|
||||
export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IProps) => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const { pathname, search } = useLocation();
|
||||
|
||||
const [message, setMessage] = useState('');
|
||||
const [pasteVisible, setPasteVisible] = useState(false);
|
||||
const [queryParamImagePreview, setQueryParamImagePreview] = useState(null);
|
||||
|
||||
const removeQueryParamImage = useCallback(() => {
|
||||
@@ -55,21 +49,10 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
|
||||
useEffect(() => {
|
||||
if (!image) return;
|
||||
setQueryParamImagePreview(image);
|
||||
}, [image, sendFromQueryParam]);
|
||||
|
||||
const sendFromClipboard = (event) => {
|
||||
if (event.key === 'Enter') {
|
||||
sendImageMessage(message);
|
||||
}
|
||||
};
|
||||
}, [image]);
|
||||
|
||||
const menuOptions = useMemo(
|
||||
() => [
|
||||
{
|
||||
label: 'Paste from clipboard',
|
||||
icon: <FileCopyIcon />,
|
||||
onClick: () => setPasteVisible(true),
|
||||
},
|
||||
{
|
||||
label: 'Camera / Gallery',
|
||||
icon: <PhotoLibraryIcon />,
|
||||
@@ -90,7 +73,7 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
|
||||
<Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}>
|
||||
<Box py={1}>
|
||||
<Typography paragraph>Do you want to share this image?</Typography>
|
||||
<PictureResponsive src={queryParamImagePreview} alt={'Share gallery image preview'} />
|
||||
<PictureResponsive src={queryParamImagePreview} alt="Share gallery image preview" />
|
||||
<Button
|
||||
fullWidth
|
||||
variant="contained"
|
||||
@@ -101,21 +84,6 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
|
||||
</Button>
|
||||
</Box>
|
||||
</Modal>
|
||||
<Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}>
|
||||
<Box p={1}>
|
||||
<TextField
|
||||
placeholder="A link to your image or gif"
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
value={message}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.messagesInput,
|
||||
}}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
onKeyPress={sendFromClipboard}
|
||||
/>
|
||||
</Box>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -191,6 +191,10 @@
|
||||
{
|
||||
"label": "Default Light",
|
||||
"value": "default-light"
|
||||
},
|
||||
{
|
||||
"label": "Kiddo Dark",
|
||||
"value": "kiddo-dark"
|
||||
}
|
||||
],
|
||||
"debug": {
|
||||
|
||||
@@ -34,5 +34,20 @@
|
||||
}
|
||||
},
|
||||
"divider": "rgba(255, 255, 255, 0.12)"
|
||||
},
|
||||
"kiddo-dark": {
|
||||
"palette": {
|
||||
"type": "dark",
|
||||
"primary": {
|
||||
"main": "#EBFEF3"
|
||||
},
|
||||
"secondary": {
|
||||
"main": "#5E0035"
|
||||
},
|
||||
"background": {
|
||||
"default": "#033A18",
|
||||
"paper": "#011308"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,9 @@
|
||||
import React, { createContext, useRef, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { AppWrapperTypes } from '../interface/InterfaceUI';
|
||||
import { Computer } from '@material-ui/icons';
|
||||
import PhoneDrawer from './PhoneDrawer';
|
||||
|
||||
const items = [
|
||||
{
|
||||
onClick: () => console.log(),
|
||||
icon: <Computer color="inherit" />,
|
||||
text: 'Item Thing',
|
||||
},
|
||||
{
|
||||
onClick: () => console.log(),
|
||||
icon: <Computer color="inherit" />,
|
||||
text: 'Item Thing',
|
||||
},
|
||||
{
|
||||
onClick: () => console.log(),
|
||||
icon: <Computer color="inherit" />,
|
||||
text: 'Item Thing',
|
||||
},
|
||||
{
|
||||
onClick: () => console.log(),
|
||||
icon: <Computer color="inherit" />,
|
||||
text: 'Item Thing',
|
||||
},
|
||||
];
|
||||
|
||||
export const AppWrapper = ({
|
||||
children,
|
||||
style,
|
||||
handleClickAway,
|
||||
sideMenu,
|
||||
appName,
|
||||
...props
|
||||
}: AppWrapperTypes) => {
|
||||
const ref = useRef();
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
export const AppWrapper = ({ children, style, handleClickAway, ...props }: AppWrapperTypes) => {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
{...props}
|
||||
style={{
|
||||
padding: 0,
|
||||
@@ -54,13 +17,6 @@ export const AppWrapper = ({
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
<PhoneDrawer
|
||||
open={open}
|
||||
handleClose={() => setOpen(false)}
|
||||
appTitle={'Side Menu Thing'}
|
||||
containerEl={ref.current}
|
||||
items={items}
|
||||
/>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
ListItem,
|
||||
List,
|
||||
ListItemText,
|
||||
ListItemIcon,
|
||||
Drawer,
|
||||
Typography,
|
||||
Box,
|
||||
Divider,
|
||||
Button,
|
||||
useTheme,
|
||||
} from '@material-ui/core';
|
||||
import { ChevronLeft, Settings } from '@material-ui/icons';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
interface DrawerItem {
|
||||
onClick: () => void;
|
||||
text: string;
|
||||
icon?: JSX.Element;
|
||||
}
|
||||
|
||||
const BackAction = ({ handleClose }) => (
|
||||
<Button
|
||||
component={Box}
|
||||
display="flex"
|
||||
flexDirection="row"
|
||||
alignItems="center"
|
||||
left="16px"
|
||||
position="absolute"
|
||||
bottom="16px"
|
||||
onClick={handleClose}
|
||||
>
|
||||
<ChevronLeft color="secondary" />
|
||||
<Typography variant="body1" color="textSecondary">
|
||||
Close
|
||||
</Typography>
|
||||
</Button>
|
||||
);
|
||||
|
||||
interface PhoneDrawer {
|
||||
open: boolean;
|
||||
handleClose: () => void;
|
||||
containerEl: Element;
|
||||
items: DrawerItem[];
|
||||
appTitle?: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
sidebarTitle: {
|
||||
marginLeft: 20,
|
||||
color: theme.palette.secondary.contrastText,
|
||||
},
|
||||
}));
|
||||
|
||||
const PhoneDrawer: React.FC<PhoneDrawer> = ({
|
||||
items,
|
||||
open,
|
||||
containerEl,
|
||||
handleClose,
|
||||
appTitle,
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
open={open}
|
||||
onClose={() => {}}
|
||||
PaperProps={{ style: { position: 'absolute', width: '70%' } }}
|
||||
BackdropProps={{ style: { position: 'absolute' } }}
|
||||
ModalProps={{
|
||||
container: containerEl,
|
||||
style: { position: 'absolute' },
|
||||
}}
|
||||
variant="temporary"
|
||||
>
|
||||
<Box height="100%">
|
||||
<Box
|
||||
display="flex"
|
||||
flexDirection="row"
|
||||
alignItems="center"
|
||||
p={2}
|
||||
bgcolor={theme.palette.secondary.main}
|
||||
>
|
||||
<Settings htmlColor={theme.palette.secondary.contrastText} />
|
||||
{appTitle && (
|
||||
<Typography variant="h6" className={classes.sidebarTitle}>
|
||||
{appTitle}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<List disablePadding>
|
||||
{items.map((item) => (
|
||||
<>
|
||||
<ListItem
|
||||
button
|
||||
onClick={item.onClick}
|
||||
style={{ color: theme.palette.text.secondary }}
|
||||
>
|
||||
{item?.icon && <ListItemIcon>{item.icon}</ListItemIcon>}
|
||||
<ListItemText primary={item.text} />
|
||||
</ListItem>
|
||||
<Divider />
|
||||
</>
|
||||
))}
|
||||
</List>
|
||||
<BackAction handleClose={handleClose} />
|
||||
</Box>
|
||||
</Drawer>
|
||||
);
|
||||
};
|
||||
|
||||
export default PhoneDrawer;
|
||||
@@ -9,9 +9,7 @@ export interface AppContentTypes {
|
||||
|
||||
export interface AppWrapperTypes {
|
||||
id?: string;
|
||||
appName?: string;
|
||||
children?: JSX.Element | JSX.Element[];
|
||||
style?: CSSProperties;
|
||||
handleClickAway?: (...args: any[]) => void;
|
||||
sideMenu?: string[];
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { BankEvents } from '../../typings/bank';
|
||||
import { PhotoEvents } from '../../typings/photo';
|
||||
import { CallEvents } from '../../typings/call';
|
||||
import { MatchEvents } from '../../typings/match';
|
||||
import { Delay } from '../utils/fivem';
|
||||
|
||||
let isPhoneOpen = false;
|
||||
let isPhoneReady = false;
|
||||
@@ -51,6 +52,7 @@ const getCurrentGameTime = () => {
|
||||
|
||||
const showPhone = async (): Promise<void> => {
|
||||
isPhoneOpen = true;
|
||||
disableControls();
|
||||
const time = getCurrentGameTime();
|
||||
await phoneOpenAnim(); // Animation starts before the phone is open
|
||||
emitNet('phone:getCredentials');
|
||||
@@ -58,6 +60,7 @@ const showPhone = async (): Promise<void> => {
|
||||
sendMessage('PHONE', 'setVisibility', true);
|
||||
sendMessage('PHONE', 'setTime', time);
|
||||
SetNuiFocus(true, true);
|
||||
SetNuiFocusKeepInput(true);
|
||||
};
|
||||
|
||||
const hidePhone = async (): Promise<void> => {
|
||||
@@ -65,6 +68,7 @@ const hidePhone = async (): Promise<void> => {
|
||||
sendMessage('PHONE', 'setVisibility', false);
|
||||
await phoneCloseAnim();
|
||||
SetNuiFocus(false, false);
|
||||
SetNuiFocusKeepInput(false);
|
||||
};
|
||||
|
||||
/* * * * * * * * * * * * *
|
||||
@@ -196,3 +200,30 @@ on(`__cfx_nui:${PhoneEvents.CLOSE_PHONE}`, async (data: any, cb: Function) => {
|
||||
// const time = getCurrentGameTime()
|
||||
// sendMessage('PHONE', 'setTime', time)
|
||||
// }, 2000);
|
||||
|
||||
function disableControls(): void {
|
||||
let timeoutFinished = false;
|
||||
|
||||
const loopTick = setTick(
|
||||
async (useTimeout = false): Promise<void> => {
|
||||
if (!isPhoneOpen) {
|
||||
clearTick(loopTick);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPhoneOpen) {
|
||||
DisableControlAction(0, 1, true);
|
||||
DisableControlAction(0, 2, true);
|
||||
DisableControlAction(0, 16, true);
|
||||
DisableControlAction(0, 17, true);
|
||||
if (useTimeout) {
|
||||
setTimeout(() => {
|
||||
timeoutFinished = true;
|
||||
}, 5000);
|
||||
}
|
||||
} else {
|
||||
await Delay(30000);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user