mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Make Camera app use router (#69)
* Make Camera app use router * Remove unused hooks * Fucking communicate messages with camera with router * Improved sharing in messages flow * Fix clipboard * Removeunused imports * improve routing helpers * Fix bug :D * Fix stupid thing * Add docs to useQueryParams hook
This commit is contained in:
1 parent
447c51a07e
commit
40f9555b39
34 files changed
+442
-255
No files matched your search
@@ -25,7 +25,9 @@
|
|||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.5",
|
"enzyme-adapter-react-16": "^1.15.5",
|
||||||
"i18next": "^19.7.0",
|
"i18next": "^19.7.0",
|
||||||
|
"parse-url": "^5.0.2",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
|
"qs": "^6.9.6",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-hotkeys": "^2.0.0",
|
"react-hotkeys": "^2.0.0",
|
||||||
@@ -45,8 +47,10 @@
|
|||||||
"@babel/preset-react": "^7.0.0",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"@types/enzyme": "^3.10.7",
|
"@types/enzyme": "^3.10.7",
|
||||||
"@types/node": "^14.11.5",
|
"@types/node": "^14.11.5",
|
||||||
|
"@types/qs": "^6.9.5",
|
||||||
"@types/react": "^16.9.51",
|
"@types/react": "^16.9.51",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.8",
|
||||||
|
"@types/react-router-dom": "^5.1.7",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
"babel-plugin-styled-components": "^1.10.0",
|
"babel-plugin-styled-components": "^1.10.0",
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
TextField,
|
TextField,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
} from '@material-ui/core';
|
} from '@material-ui/core';
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
|
||||||
|
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
|
|
||||||
@@ -33,11 +32,6 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
marginBottom: 30,
|
marginBottom: 30,
|
||||||
},
|
},
|
||||||
closeButton: {
|
|
||||||
position: 'absolute',
|
|
||||||
right: 0,
|
|
||||||
width: '10%',
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const TransferModal = () => {
|
export const TransferModal = () => {
|
||||||
@@ -65,9 +59,6 @@ export const TransferModal = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={showBankModal} handleClose={_handleClose}>
|
<Modal visible={showBankModal} handleClose={_handleClose}>
|
||||||
<Button className={classes.closeButton} onClick={_handleClose}>
|
|
||||||
<CloseIcon />
|
|
||||||
</Button>
|
|
||||||
<List style={{ marginTop: 20 }}>
|
<List style={{ marginTop: 20 }}>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { AppWrapper } from '../../../ui/components';
|
import { AppWrapper } from '../../../ui/components';
|
||||||
import { AppContent } from '../../../ui/components/AppContent';
|
import { AppContent } from '../../../ui/components/AppContent';
|
||||||
import { usePhotoModal } from '../hooks/usePhotoModal';
|
|
||||||
import { GalleryGrid } from './grid/GalleryGrid';
|
import { GalleryGrid } from './grid/GalleryGrid';
|
||||||
import { GalleryModal } from './modal/GalleryModal';
|
import { GalleryModal } from './modal/GalleryModal';
|
||||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||||
|
import { Route, Switch } from 'react-router-dom';
|
||||||
|
|
||||||
InjectDebugData([
|
InjectDebugData([
|
||||||
{
|
{
|
||||||
@@ -24,19 +24,13 @@ InjectDebugData([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const CameraApp = () => {
|
const CameraApp = () => {
|
||||||
const { modal } = usePhotoModal();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppWrapper id='camera-app'>
|
<AppWrapper id='camera-app'>
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<GalleryModal />
|
|
||||||
{/*<Router>
|
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/camera/image" component={GalleryModal} />
|
<Route path='/camera' exact component={GalleryGrid} />
|
||||||
<Route path="/" exact component={GalleryGrid} />
|
<Route path='/camera/image' exact component={GalleryModal} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>*/}
|
|
||||||
{!modal ? <GalleryGrid /> : null}
|
|
||||||
</AppContent>
|
</AppContent>
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,28 +4,30 @@ import useStyles from './grid.styles';
|
|||||||
import { usePhotos } from '../../hooks/usePhotos';
|
import { usePhotos } from '../../hooks/usePhotos';
|
||||||
import AddIcon from '@material-ui/icons/Add';
|
import AddIcon from '@material-ui/icons/Add';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||||
|
import { addQueryToLocation } from '../../../../common/utils/addQueryToLocation';
|
||||||
|
import { getLocationFromUrl } from '../../../../common/utils/getLocationFromUrl';
|
||||||
|
|
||||||
// isMessage will work as a style handler kinda. If the gallery is rendered in the messages,
|
export const GalleryGrid = () => {
|
||||||
// it will have the value true, which basically means a tweak on the design to fit in a modal
|
|
||||||
export const GalleryGrid = (isMessags) => {
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const history = useHistory();
|
||||||
|
const query = useQueryParams();
|
||||||
|
|
||||||
const { setMeta } = usePhotoMeta();
|
const referal = query.referal
|
||||||
const { setModal } = usePhotoModal();
|
? decodeURIComponent(query.referal)
|
||||||
|
: '/camera/image';
|
||||||
|
|
||||||
const photos = usePhotos();
|
const photos = usePhotos();
|
||||||
|
|
||||||
console.log(photos);
|
|
||||||
|
|
||||||
const handleCamera = () => {
|
const handleCamera = () => {
|
||||||
Nui.send('phone:TakePhoto', {});
|
Nui.send('phone:TakePhoto', {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePhotoOpen = (photo) => {
|
const handlePhotoOpen = (photo) => {
|
||||||
setModal(true);
|
history.push(
|
||||||
setMeta(photo);
|
addQueryToLocation(getLocationFromUrl(referal), 'image', photo.image)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!photos)
|
if (!photos)
|
||||||
@@ -66,7 +68,7 @@ export const GalleryGrid = (isMessags) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
{photos.map((photo) => (
|
{photos.map((photo) => (
|
||||||
<Box onClick={() => handlePhotoOpen(photo)}>
|
<Box key={photo.id} onClick={() => handlePhotoOpen(photo)}>
|
||||||
<div
|
<div
|
||||||
style={{ backgroundImage: `url(${photo.image})` }}
|
style={{ backgroundImage: `url(${photo.image})` }}
|
||||||
className={classes.photo}
|
className={classes.photo}
|
||||||
|
|||||||
@@ -1,48 +1,50 @@
|
|||||||
import React from 'react';
|
import React, { useMemo, useState, useCallback } from 'react';
|
||||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
|
||||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
import { Button, Paper } from '@material-ui/core';
|
import { Button, Paper } from '@material-ui/core';
|
||||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||||
import DeleteIcon from '@material-ui/icons/Delete';
|
import DeleteIcon from '@material-ui/icons/Delete';
|
||||||
import ShareIcon from '@material-ui/icons/Share';
|
import ShareIcon from '@material-ui/icons/Share';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
import { useShareModal } from '../../hooks/useShareModal';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||||
|
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||||
import { ShareModal } from './ShareModal';
|
import { ShareModal } from './ShareModal';
|
||||||
import { useShareLink } from '../../hooks/useShareLink';
|
|
||||||
|
|
||||||
export const GalleryModal = () => {
|
export const GalleryModal = () => {
|
||||||
const { meta, setMeta } = usePhotoMeta();
|
|
||||||
const { modal, setModal } = usePhotoModal();
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const history = useHistory();
|
||||||
|
const query = useQueryParams();
|
||||||
|
const referal = query.referal || '/camera';
|
||||||
|
|
||||||
const { shareModal, setShareModal } = useShareModal();
|
const [shareOpen, setShareOpen] = useState(null);
|
||||||
const { setShareLink } = useShareLink();
|
|
||||||
|
const meta: ICameraPhoto = useMemo(
|
||||||
|
() => ({ id: query.id as string, image: query.image as string }),
|
||||||
|
[query]
|
||||||
|
);
|
||||||
|
|
||||||
const _handleClose = () => {
|
const _handleClose = () => {
|
||||||
setModal(false);
|
history.push(referal);
|
||||||
setMeta(null);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeletePhoto = () => {
|
const handleDeletePhoto = useCallback(() => {
|
||||||
console.log(meta.id);
|
|
||||||
Nui.send('photo:deletePhoto', {
|
Nui.send('photo:deletePhoto', {
|
||||||
id: meta.id,
|
id: meta.id,
|
||||||
});
|
});
|
||||||
setModal(false);
|
history.push(referal);
|
||||||
};
|
}, [history, meta.id, referal]);
|
||||||
|
|
||||||
const handleSharePhoto = () => {
|
const handleSharePhoto = useCallback(() => {
|
||||||
setShareModal(true);
|
setShareOpen(meta);
|
||||||
setShareLink(meta.image);
|
}, [meta]);
|
||||||
};
|
|
||||||
|
|
||||||
if (!meta) return null;
|
if (!meta) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper className={modal ? classes.modal : classes.modalHide}>
|
<>
|
||||||
<ShareModal key={meta.id} {...meta} />
|
<ShareModal referal={referal} meta={shareOpen} onClose={() => setShareOpen(null)} />
|
||||||
<div className={shareModal ? classes.backgroundModal : undefined} />
|
<Paper className={classes.modal}>
|
||||||
|
<div className={shareOpen ? classes.backgroundModal : null} />
|
||||||
<Button onClick={_handleClose}>
|
<Button onClick={_handleClose}>
|
||||||
<ArrowBackIcon />
|
<ArrowBackIcon />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -59,5 +61,6 @@ export const GalleryModal = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,38 +1,33 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Modal from '../../../../ui/components/Modal';
|
import Modal from '../../../../ui/components/Modal';
|
||||||
import { useShareLink } from '../../hooks/useShareLink';
|
|
||||||
import { useShareModal } from '../../hooks/useShareModal';
|
|
||||||
import { Button } from '@material-ui/core';
|
import { Button } from '@material-ui/core';
|
||||||
import MessageIcon from '@material-ui/icons/Message';
|
import MessageIcon from '@material-ui/icons/Message';
|
||||||
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
|
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
|
||||||
|
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
|
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
export const ShareModal = (meta) => {
|
interface IShareModalProps {
|
||||||
|
meta: ICameraPhoto;
|
||||||
|
referal: string;
|
||||||
|
onClose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { shareModal, setShareModal } = useShareModal();
|
const history = useHistory();
|
||||||
const { setShareLink } = useShareLink();
|
|
||||||
|
|
||||||
const _handleClose = () => {
|
|
||||||
setShareModal(false);
|
|
||||||
setShareLink(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCopyImage = () => {
|
const handleCopyImage = () => {
|
||||||
setClipboard(meta.image);
|
setClipboard(meta.image);
|
||||||
|
history.push(referal);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={shareModal} handleClose={_handleClose}>
|
<Modal visible={!!meta} handleClose={onClose}>
|
||||||
<div className={classes.shareModal}>
|
<div className={classes.shareModal}>
|
||||||
<Button
|
|
||||||
style={{ position: 'absolute', right: 0, width: '10%' }}
|
|
||||||
onClick={_handleClose}
|
|
||||||
>
|
|
||||||
<CloseIcon />
|
|
||||||
</Button>
|
|
||||||
<div className={classes.innerShareModal}>
|
<div className={classes.innerShareModal}>
|
||||||
|
<>
|
||||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||||
Where do you want to share the photo?
|
Where do you want to share the photo?
|
||||||
</h4>
|
</h4>
|
||||||
@@ -41,6 +36,7 @@ export const ShareModal = (meta) => {
|
|||||||
<Button onClick={handleCopyImage} variant='contained'>
|
<Button onClick={handleCopyImage} variant='contained'>
|
||||||
Copy image
|
Copy image
|
||||||
</Button>
|
</Button>
|
||||||
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -5,20 +5,4 @@ export const photoState = {
|
|||||||
key: 'galleryPhotos',
|
key: 'galleryPhotos',
|
||||||
default: null,
|
default: null,
|
||||||
}),
|
}),
|
||||||
modal: atom({
|
|
||||||
key: 'photoModal',
|
|
||||||
default: false,
|
|
||||||
}),
|
|
||||||
photoMeta: atom({
|
|
||||||
key: 'photoMeta',
|
|
||||||
default: null,
|
|
||||||
}),
|
|
||||||
shareModal: atom({
|
|
||||||
key: 'phoneShareModal',
|
|
||||||
default: false,
|
|
||||||
}),
|
|
||||||
shareLink: atom({
|
|
||||||
key: 'photoShareLink',
|
|
||||||
default: null,
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { photoState } from './state';
|
|
||||||
|
|
||||||
export const usePhotoMeta = () => {
|
|
||||||
const [meta, setMeta] = useRecoilState(photoState.photoMeta);
|
|
||||||
return { meta, setMeta };
|
|
||||||
};
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { photoState } from './state';
|
|
||||||
|
|
||||||
export const usePhotoModal = () => {
|
|
||||||
const [modal, setModal] = useRecoilState(photoState.modal);
|
|
||||||
return { modal, setModal };
|
|
||||||
};
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { photoState } from './state';
|
import { photoState } from './state';
|
||||||
|
|
||||||
interface IPhotos {
|
export interface ICameraPhoto {
|
||||||
image: string[];
|
id: string;
|
||||||
|
image: string;
|
||||||
map?: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const usePhotos = (): IPhotos | null => {
|
export const usePhotos = (): ICameraPhoto[] | null => {
|
||||||
const photos = useRecoilValue<IPhotos | null>(photoState.photos);
|
return useRecoilValue<ICameraPhoto[] | null>(photoState.photos);
|
||||||
return photos;
|
|
||||||
};
|
};
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { photoState } from './state';
|
|
||||||
|
|
||||||
export const useShareLink = () => {
|
|
||||||
const [shareLink, setShareLink] = useRecoilState(photoState.shareLink);
|
|
||||||
return { shareLink, setShareLink };
|
|
||||||
};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { photoState } from './state';
|
|
||||||
|
|
||||||
interface ShareModalProps {
|
|
||||||
shareModal: boolean;
|
|
||||||
setShareModal: (show: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useShareModal = (): ShareModalProps => {
|
|
||||||
const [ shareModal, setShareModal ] = useRecoilState(photoState.shareModal);
|
|
||||||
return { shareModal, setShareModal }
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import List from '@material-ui/core/List';
|
|||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import Modal from '../../../ui/components/Modal';
|
import Modal from '../../../ui/components/Modal';
|
||||||
import { useModal } from '../hooks/useModal';
|
import { useModal } from '../hooks/useModal';
|
||||||
import ClearIcon from '@material-ui/icons/Clear';
|
|
||||||
import PersonIcon from '@material-ui/icons/Person';
|
import PersonIcon from '@material-ui/icons/Person';
|
||||||
import PhoneIcon from '@material-ui/icons/Phone';
|
import PhoneIcon from '@material-ui/icons/Phone';
|
||||||
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
||||||
@@ -41,9 +40,6 @@ export const AddContactModal = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={showModal} handleClose={_handleClose}>
|
<Modal visible={showModal} handleClose={_handleClose}>
|
||||||
<Button onClick={_handleClose} className={classes.clearButton}>
|
|
||||||
<ClearIcon />
|
|
||||||
</Button>
|
|
||||||
<List style={{ marginTop: 30 }}>
|
<List style={{ marginTop: 30 }}>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<PersonIcon className={classes.icons} />
|
<PersonIcon className={classes.icons} />
|
||||||
|
|||||||
@@ -1,25 +1,67 @@
|
|||||||
|
import './messages.css';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { AppWrapper } from '../../../ui/components';
|
import { AppWrapper } from '../../../ui/components';
|
||||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||||
import { AppContent } from '../../../ui/components/AppContent';
|
import { AppContent } from '../../../ui/components/AppContent';
|
||||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||||
import AlertBar from './AlertBar';
|
import AlertBar from './AlertBar';
|
||||||
import { MessageModal } from './modal/MessageModal';
|
|
||||||
import MessageGroupModal from './modal/MessageGroupModal';
|
import MessageGroupModal from './modal/MessageGroupModal';
|
||||||
import NewMessageGroupButton from './buttons/NewMessageGroupButton';
|
|
||||||
import MessagesList from './list/MessagesList';
|
import MessagesList from './list/MessagesList';
|
||||||
import './messages.css';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
|
import { MessageModal } from './modal/MessageModal';
|
||||||
|
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||||
|
|
||||||
|
InjectDebugData([
|
||||||
|
{
|
||||||
|
app: 'MESSAGES',
|
||||||
|
method: 'phone:fetchMessagesSuccess',
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
message: 'sup!',
|
||||||
|
user_identifier: '1234',
|
||||||
|
phone_number: '444-4444',
|
||||||
|
display: 'kidz',
|
||||||
|
avatar: null,
|
||||||
|
isRead: true,
|
||||||
|
isMine: false,
|
||||||
|
updatedAt: Date.now(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
app: 'MESSAGES',
|
||||||
|
method: 'phone:fetchMessageGroupsSuccess',
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
groupId: '2',
|
||||||
|
groupDisplay: 'dev-chat',
|
||||||
|
isGroupChat: true,
|
||||||
|
avatar: null,
|
||||||
|
label: null,
|
||||||
|
updatedAt: Date.now(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
export const MessagesApp = () => {
|
export const MessagesApp = () => {
|
||||||
const messages = useApp('MESSAGES');
|
const messages = useApp('MESSAGES');
|
||||||
return (
|
return (
|
||||||
<AppWrapper id='messages-app'>
|
<AppWrapper id='messages-app'>
|
||||||
<AppTitle app={messages} />
|
<AppTitle app={messages} />
|
||||||
<MessageModal />
|
|
||||||
<MessageGroupModal />
|
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<MessagesList />
|
<Switch>
|
||||||
<NewMessageGroupButton />
|
<Route
|
||||||
|
exact
|
||||||
|
path='/messages/conversations/:groupId'
|
||||||
|
component={MessageModal}
|
||||||
|
/>
|
||||||
|
</Switch>
|
||||||
|
<Switch>
|
||||||
|
<Route path='/messages' component={MessagesList} />
|
||||||
|
<Route exact path='/messages/new' component={MessageGroupModal} />
|
||||||
|
</Switch>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<AlertBar />
|
<AlertBar />
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React from 'react';
|
|||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { Fab } from '@material-ui/core';
|
import { Fab } from '@material-ui/core';
|
||||||
import AddIcon from '@material-ui/icons/Add';
|
import AddIcon from '@material-ui/icons/Add';
|
||||||
import useModals from '../../hooks/useModals';
|
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles(() => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -12,15 +11,18 @@ const useStyles = makeStyles(() => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export function NewMessageGroupButton() {
|
interface INewMessageGroupButtonProps {
|
||||||
const classes = useStyles();
|
onClick(): void;
|
||||||
const { setShowNewMessageGroup } = useModals();
|
}
|
||||||
|
|
||||||
const handleClick = () => setShowNewMessageGroup(true);
|
export function NewMessageGroupButton({
|
||||||
|
onClick,
|
||||||
|
}: INewMessageGroupButtonProps) {
|
||||||
|
const classes = useStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Fab color='primary' onClick={handleClick}>
|
<Fab color='primary' onClick={onClick}>
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
</Fab>
|
</Fab>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ import useStyles from './form.styles';
|
|||||||
import SendIcon from '@material-ui/icons/Send';
|
import SendIcon from '@material-ui/icons/Send';
|
||||||
import ImageIcon from '@material-ui/icons/Image';
|
import ImageIcon from '@material-ui/icons/Image';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
import { useImageModal } from '../../hooks/useImageModal';
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
onAddImageClick(): void;
|
||||||
messageGroupId: string | undefined;
|
messageGroupId: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MessageInput = ({ messageGroupId }: IProps) => {
|
const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => {
|
||||||
const { setImageModal } = useImageModal();
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [message, setMessage] = useState('');
|
const [message, setMessage] = useState('');
|
||||||
@@ -29,10 +28,6 @@ const MessageInput = ({ messageGroupId }: IProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openImageModal = () => {
|
|
||||||
setImageModal(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!messageGroupId) return null;
|
if (!messageGroupId) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -48,7 +43,7 @@ const MessageInput = ({ messageGroupId }: IProps) => {
|
|||||||
className: classes.messagesInput,
|
className: classes.messagesInput,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button className={classes.sendButton} onClick={openImageModal}>
|
<Button className={classes.sendButton} onClick={onAddImageClick}>
|
||||||
<ImageIcon />
|
<ImageIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button className={classes.sendButton} type='submit'>
|
<Button className={classes.sendButton} type='submit'>
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { TextField, Button } from '@material-ui/core';
|
import { TextField, Button } from '@material-ui/core';
|
||||||
|
|
||||||
import useStyles from './form.styles';
|
import useStyles from './form.styles';
|
||||||
import useModals from '../../hooks/useModals';
|
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
const NewMessageGroupForm = () => {
|
const NewMessageGroupForm = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { setShowNewMessageGroup } = useModals();
|
|
||||||
const [participants, setParticipants] = useState('');
|
const [participants, setParticipants] = useState('');
|
||||||
const [label, setLabel] = useState('');
|
const [label, setLabel] = useState('');
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ const NewMessageGroupForm = () => {
|
|||||||
label: isGroupChat && labelValue ? labelValue : null,
|
label: isGroupChat && labelValue ? labelValue : null,
|
||||||
});
|
});
|
||||||
setParticipants('');
|
setParticipants('');
|
||||||
setShowNewMessageGroup(false); // close modal after submission
|
history.push('/messages');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { List } from '@material-ui/core';
|
import { List } from '@material-ui/core';
|
||||||
|
import qs from 'qs';
|
||||||
import { MessageGroup } from '../../../../common/typings/messages';
|
import { MessageGroup } from '../../../../common/typings/messages';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
import useMessages from '../../hooks/useMessages';
|
import useMessages from '../../hooks/useMessages';
|
||||||
import useModals from '../../hooks/useModals';
|
|
||||||
import MessageSearch from './MessageSearch';
|
import MessageSearch from './MessageSearch';
|
||||||
import MessageGroupItem from './MessageGroupItem';
|
import MessageGroupItem from './MessageGroupItem';
|
||||||
import useStyles from './list.styles';
|
import useStyles from './list.styles';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import NewMessageGroupButton from '../buttons/NewMessageGroupButton';
|
||||||
|
|
||||||
const MessagesList = (): any => {
|
const MessagesList = (): any => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const history = useHistory();
|
||||||
|
|
||||||
const { messageGroups } = useMessages();
|
const { messageGroups } = useMessages();
|
||||||
const { setActiveMessageGroup } = useModals();
|
|
||||||
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Nui.send('phone:fetchMessageGroups');
|
Nui.send('phone:fetchMessageGroups');
|
||||||
@@ -22,8 +25,12 @@ const MessagesList = (): any => {
|
|||||||
if (!messageGroups) return null;
|
if (!messageGroups) return null;
|
||||||
|
|
||||||
const handleClick = (messageGroup: MessageGroup) => () => {
|
const handleClick = (messageGroup: MessageGroup) => () => {
|
||||||
setActiveMessageGroup(messageGroup);
|
|
||||||
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
||||||
|
history.push(
|
||||||
|
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(
|
||||||
|
messageGroup
|
||||||
|
)}`
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formattedSearch = searchValue.toLowerCase().trim();
|
const formattedSearch = searchValue.toLowerCase().trim();
|
||||||
@@ -54,6 +61,7 @@ const MessagesList = (): any => {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Paper, Typography } from '@material-ui/core';
|
import { Paper, Typography } from '@material-ui/core';
|
||||||
|
|
||||||
import { Message, MessageGroup } from '../../../../common/typings/messages';
|
import { Message, MessageGroup } from '../../../../common/typings/messages';
|
||||||
import MessageInput from '../form/MessageInput';
|
import MessageInput from '../form/MessageInput';
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
import { MessageImageModal } from './MessageImageModal';
|
import { MessageImageModal } from './MessageImageModal';
|
||||||
|
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
activeMessageGroup: MessageGroup;
|
activeMessageGroup: MessageGroup;
|
||||||
@@ -15,6 +16,9 @@ export const CONVERSATION_ELEMENT_ID = 'message-modal-conversation';
|
|||||||
|
|
||||||
const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const [imageModalOpen, setImageModalOpen] = useState(false);
|
||||||
|
const query = useQueryParams();
|
||||||
|
const referalImage = query?.image || null;
|
||||||
|
|
||||||
const isImage = (url) => {
|
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);
|
||||||
@@ -22,7 +26,12 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MessageImageModal messageGroupId={activeMessageGroup.groupId} />
|
<MessageImageModal
|
||||||
|
image={referalImage}
|
||||||
|
onClose={() => setImageModalOpen(false)}
|
||||||
|
isOpen={imageModalOpen}
|
||||||
|
messageGroupId={activeMessageGroup.groupId}
|
||||||
|
/>
|
||||||
<div id={CONVERSATION_ELEMENT_ID} className={classes.messageList}>
|
<div id={CONVERSATION_ELEMENT_ID} className={classes.messageList}>
|
||||||
{messages.map((message) => (
|
{messages.map((message) => (
|
||||||
<div key={message.id} className={classes.messageContainer}>
|
<div key={message.id} className={classes.messageContainer}>
|
||||||
@@ -48,7 +57,10 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<MessageInput messageGroupId={activeMessageGroup.groupId} />
|
<MessageInput
|
||||||
|
messageGroupId={activeMessageGroup.groupId}
|
||||||
|
onAddImageClick={() => setImageModalOpen(true)}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,21 +2,18 @@ import React from 'react';
|
|||||||
import { Slide, Paper, Button } from '@material-ui/core';
|
import { Slide, Paper, Button } from '@material-ui/core';
|
||||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
|
|
||||||
import useModals from '../../hooks/useModals';
|
|
||||||
import NewMessageGroupForm from '../form/NewMessageGroupForm';
|
import NewMessageGroupForm from '../form/NewMessageGroupForm';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
const MessageGroupModal = () => {
|
const MessageGroupModal = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { showNewMessageGroup, setShowNewMessageGroup } = useModals();
|
const history = useHistory();
|
||||||
|
|
||||||
const handleClose = () => setShowNewMessageGroup(false);
|
const handleClose = () => history.push('/messages');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slide direction='left' in={showNewMessageGroup}>
|
<Slide direction='left' in>
|
||||||
<Paper
|
<Paper className={classes.modalRoot}>
|
||||||
className={showNewMessageGroup ? classes.modalRoot : classes.modalHide}
|
|
||||||
>
|
|
||||||
<Button onClick={handleClose}>
|
<Button onClick={handleClose}>
|
||||||
<ArrowBackIcon fontSize='large' />
|
<ArrowBackIcon fontSize='large' />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,43 +1,115 @@
|
|||||||
import { TextField, Button } from '@material-ui/core';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import React, { useState } from 'react';
|
import qs from 'qs';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
import Modal from '../../../../ui/components/Modal';
|
import Modal from '../../../../ui/components/Modal';
|
||||||
import { useImageModal } from '../../hooks/useImageModal';
|
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary';
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
import { Box, Button, TextField, Typography } from '@material-ui/core';
|
||||||
|
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
|
import { ContextMenu } from '../../../../ui/components/ContextMenu';
|
||||||
|
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
|
||||||
|
import { PictureResponsive } from '../../../../ui/components/PictureResponsive';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
isOpen: boolean;
|
||||||
messageGroupId: string | undefined;
|
messageGroupId: string | undefined;
|
||||||
|
onClose(): void;
|
||||||
|
image?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MessageImageModal = ({ messageGroupId }: IProps) => {
|
export const MessageImageModal = ({
|
||||||
|
isOpen,
|
||||||
|
messageGroupId,
|
||||||
|
onClose,
|
||||||
|
image,
|
||||||
|
}: IProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { imageModal, setImageModal } = useImageModal();
|
const history = useHistory();
|
||||||
|
const { pathname, search } = useLocation();
|
||||||
|
|
||||||
const [message, setMessage] = useState('');
|
const [message, setMessage] = useState('');
|
||||||
|
const [pasteVisible, setPasteVisible] = useState(false);
|
||||||
|
const [queryParamImagePreview, setQueryParamImagePreview] = useState(null);
|
||||||
|
|
||||||
const _handleClose = () => {
|
const sendImageMessage = useCallback(
|
||||||
setImageModal(false);
|
(m) => {
|
||||||
};
|
|
||||||
|
|
||||||
const sendImageMessage = (event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
Nui.send('phone:sendMessage', {
|
Nui.send('phone:sendMessage', {
|
||||||
groupId: messageGroupId,
|
groupId: messageGroupId,
|
||||||
message,
|
message: m,
|
||||||
});
|
});
|
||||||
setImageModal(false);
|
onClose();
|
||||||
|
},
|
||||||
|
[messageGroupId, onClose]
|
||||||
|
);
|
||||||
|
|
||||||
|
const sendFromQueryParam = useCallback(
|
||||||
|
(image) => {
|
||||||
|
setQueryParamImagePreview(null);
|
||||||
|
sendImageMessage(image);
|
||||||
|
|
||||||
|
console.log('++++', { pathname, search });
|
||||||
|
history.replace(deleteQueryFromLocation({ pathname, search }, 'image'));
|
||||||
|
},
|
||||||
|
[history, pathname, search, sendImageMessage]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!image) return;
|
||||||
|
setQueryParamImagePreview(image);
|
||||||
|
}, [image, sendFromQueryParam]);
|
||||||
|
|
||||||
|
const sendFromClipboard = (event) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
sendImageMessage(message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const menuOptions = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
label: 'Paste from clipboard',
|
||||||
|
icon: <FileCopyIcon />,
|
||||||
|
onClick: () => setPasteVisible(true),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Camera / Gallery',
|
||||||
|
icon: <PhotoLibraryIcon />,
|
||||||
|
onClick: () =>
|
||||||
|
history.push(
|
||||||
|
`/camera?${qs.stringify({
|
||||||
|
referal: encodeURIComponent(pathname + search),
|
||||||
|
})}`
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[history, pathname, search]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={imageModal} handleClose={_handleClose}>
|
<>
|
||||||
<div>
|
<ContextMenu open={isOpen} options={menuOptions} onClose={onClose} />
|
||||||
<Button
|
<Modal
|
||||||
onClick={_handleClose}
|
visible={queryParamImagePreview}
|
||||||
className={classes.imageModalCloseButton}
|
handleClose={() => setQueryParamImagePreview(null)}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<Box py={1}>
|
||||||
|
<Typography paragraph>Do you want to share this image?</Typography>
|
||||||
|
<PictureResponsive
|
||||||
|
src={queryParamImagePreview}
|
||||||
|
alt={'Share gallery image preview'}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
fullWidth
|
||||||
|
variant='contained'
|
||||||
|
onClick={() => sendFromQueryParam(queryParamImagePreview)}
|
||||||
|
>
|
||||||
|
Share
|
||||||
</Button>
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
<Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}>
|
||||||
|
<div>
|
||||||
<TextField
|
<TextField
|
||||||
placeholder='A link to your image or gif'
|
placeholder='A link to your image or gif'
|
||||||
onChange={(e) => setMessage(e.target.value)}
|
onChange={(e) => setMessage(e.target.value)}
|
||||||
@@ -47,9 +119,10 @@ export const MessageImageModal = ({ messageGroupId }: IProps) => {
|
|||||||
className: classes.messagesInput,
|
className: classes.messagesInput,
|
||||||
}}
|
}}
|
||||||
inputRef={(input) => input && input.focus()}
|
inputRef={(input) => input && input.focus()}
|
||||||
onKeyPress={sendImageMessage}
|
onKeyPress={sendFromClipboard}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -4,10 +4,12 @@ import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
|||||||
|
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
import useMessages from '../../hooks/useMessages';
|
import useMessages from '../../hooks/useMessages';
|
||||||
import useModals from '../../hooks/useModals';
|
|
||||||
import Conversation, { CONVERSATION_ELEMENT_ID } from './Conversation';
|
import Conversation, { CONVERSATION_ELEMENT_ID } from './Conversation';
|
||||||
import MessageSkeletonList from './MessageSkeletonList';
|
import MessageSkeletonList from './MessageSkeletonList';
|
||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
|
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||||
|
import { MessageGroup } from '../../../../common/typings/messages';
|
||||||
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
const LARGE_HEADER_CHARS = 30;
|
const LARGE_HEADER_CHARS = 30;
|
||||||
const MAX_HEADER_CHARS = 80;
|
const MAX_HEADER_CHARS = 80;
|
||||||
@@ -16,27 +18,29 @@ const MESSAGES_REFRESH_RATE = 5000;
|
|||||||
|
|
||||||
export const MessageModal = () => {
|
export const MessageModal = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const history = useHistory();
|
||||||
|
const activeMessageGroup = useQueryParams<MessageGroup>();
|
||||||
|
const { groupId } = useParams<{ groupId: string }>();
|
||||||
const { messages, setMessages } = useMessages();
|
const { messages, setMessages } = useMessages();
|
||||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(false);
|
const [minimumLoadPassed, setMimimumLoadPassed] = useState(false);
|
||||||
const { activeMessageGroup, setActiveMessageGroup } = useModals();
|
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
setActiveMessageGroup(null);
|
history.push('/messages');
|
||||||
setMessages(null);
|
setMessages(null);
|
||||||
setMimimumLoadPassed(false);
|
setMimimumLoadPassed(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!activeMessageGroup?.groupId) return;
|
if (!groupId) return;
|
||||||
|
|
||||||
const timeout = window.setTimeout(() => {
|
const timeout = window.setTimeout(() => {
|
||||||
setMimimumLoadPassed(true);
|
setMimimumLoadPassed(true);
|
||||||
}, MINIMUM_LOAD_TIME);
|
}, MINIMUM_LOAD_TIME);
|
||||||
|
|
||||||
const interval = window.setInterval(() => {
|
const interval = window.setInterval(() => {
|
||||||
if (!activeMessageGroup) return;
|
if (!groupId) return;
|
||||||
Nui.send('phone:fetchMessages', {
|
Nui.send('phone:fetchMessages', {
|
||||||
groupId: activeMessageGroup.groupId,
|
groupId,
|
||||||
});
|
});
|
||||||
}, MESSAGES_REFRESH_RATE);
|
}, MESSAGES_REFRESH_RATE);
|
||||||
|
|
||||||
@@ -44,7 +48,7 @@ export const MessageModal = () => {
|
|||||||
window.clearInterval(interval);
|
window.clearInterval(interval);
|
||||||
window.clearTimeout(timeout);
|
window.clearTimeout(timeout);
|
||||||
};
|
};
|
||||||
}, [activeMessageGroup]);
|
}, [groupId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// when we get a new message group we should scroll to the
|
// when we get a new message group we should scroll to the
|
||||||
@@ -61,7 +65,6 @@ export const MessageModal = () => {
|
|||||||
// there isn't a quick flash of loading and immediately
|
// there isn't a quick flash of loading and immediately
|
||||||
// another flash to the tweets screen.
|
// another flash to the tweets screen.
|
||||||
const hasLoaded = messages && minimumLoadPassed;
|
const hasLoaded = messages && minimumLoadPassed;
|
||||||
const isOpen = activeMessageGroup !== null;
|
|
||||||
|
|
||||||
// don't allow too many characters, it takes too much room
|
// don't allow too many characters, it takes too much room
|
||||||
let header = activeMessageGroup ? activeMessageGroup.groupDisplay : '';
|
let header = activeMessageGroup ? activeMessageGroup.groupDisplay : '';
|
||||||
@@ -77,8 +80,8 @@ export const MessageModal = () => {
|
|||||||
: classes.groupdisplay;
|
: classes.groupdisplay;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slide direction='left' in={isOpen}>
|
<Slide direction='left' in={!!activeMessageGroup}>
|
||||||
<Paper className={isOpen ? classes.modalRoot : classes.modalHide}>
|
<Paper className={classes.modalRoot}>
|
||||||
<Paper className={classes.topContainer}>
|
<Paper className={classes.topContainer}>
|
||||||
<Button onClick={closeModal}>
|
<Button onClick={closeModal}>
|
||||||
<ArrowBackIcon fontSize='large' />
|
<ArrowBackIcon fontSize='large' />
|
||||||
@@ -87,7 +90,7 @@ export const MessageModal = () => {
|
|||||||
{header}
|
{header}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Paper>
|
</Paper>
|
||||||
{messages && hasLoaded ? (
|
{hasLoaded ? (
|
||||||
<Conversation
|
<Conversation
|
||||||
messages={messages}
|
messages={messages}
|
||||||
activeMessageGroup={activeMessageGroup}
|
activeMessageGroup={activeMessageGroup}
|
||||||
|
|||||||
@@ -71,11 +71,6 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
height: '80%',
|
height: '80%',
|
||||||
maxHeight: '80%',
|
maxHeight: '80%',
|
||||||
},
|
},
|
||||||
imageModalCloseButton: {
|
|
||||||
position: 'absolute',
|
|
||||||
right: 0,
|
|
||||||
width: '10%',
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default useStyles;
|
export default useStyles;
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { messageState } from './state';
|
|
||||||
|
|
||||||
export const useImageModal = () => {
|
|
||||||
const [imageModal, setImageModal] = useRecoilState(messageState.imageModal);
|
|
||||||
return { imageModal, setImageModal };
|
|
||||||
};
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { MessageGroup } from '../../../common/typings/messages';
|
|
||||||
import { messageState } from './state';
|
|
||||||
|
|
||||||
interface IUseModal {
|
|
||||||
activeMessageGroup: MessageGroup | null;
|
|
||||||
setActiveMessageGroup: (group: MessageGroup | null) => void;
|
|
||||||
showNewMessageGroup: boolean;
|
|
||||||
setShowNewMessageGroup: (value: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default (): IUseModal => {
|
|
||||||
const [
|
|
||||||
activeMessageGroup,
|
|
||||||
setActiveMessageGroup,
|
|
||||||
] = useRecoilState<MessageGroup | null>(messageState.activeMessageGroup);
|
|
||||||
const [showNewMessageGroup, setShowNewMessageGroup] = useRecoilState<boolean>(
|
|
||||||
messageState.showNewMessageGroup
|
|
||||||
);
|
|
||||||
return {
|
|
||||||
activeMessageGroup,
|
|
||||||
setActiveMessageGroup,
|
|
||||||
showNewMessageGroup,
|
|
||||||
setShowNewMessageGroup,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { Button } from '@material-ui/core';
|
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
import Nui from '../../../os/nui-events/utils/Nui';
|
import Nui from '../../../os/nui-events/utils/Nui';
|
||||||
@@ -32,12 +30,6 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
margin: 5,
|
margin: 5,
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
close: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: '12px',
|
|
||||||
right: '4px',
|
|
||||||
zIndex: 2,
|
|
||||||
},
|
|
||||||
buttonsContainer: {
|
buttonsContainer: {
|
||||||
paddingBottom: '8px',
|
paddingBottom: '8px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -160,9 +152,6 @@ export const AddTweetModal = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={modalVisible} handleClose={_handleClose}>
|
<Modal visible={modalVisible} handleClose={_handleClose}>
|
||||||
<Button className={classes.close} onClick={_handleClose}>
|
|
||||||
<CloseIcon color='action' />
|
|
||||||
</Button>
|
|
||||||
<TweetMessage message={message} handleChange={handleMessageChange} />
|
<TweetMessage message={message} handleChange={handleMessageChange} />
|
||||||
<ImagePrompt
|
<ImagePrompt
|
||||||
visible={showImagePrompt}
|
visible={showImagePrompt}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import qs, { ParsedQs } from 'qs';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses all available query params in current location and returns as an object
|
||||||
|
*
|
||||||
|
* @return {T} Querystring object
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* const { id, title } = useQueryParams<{ id: string, title: string }>();
|
||||||
|
*/
|
||||||
|
export function useQueryParams<T = Record<string, string>>() {
|
||||||
|
return qs.parse(useLocation().search, { ignoreQueryPrefix: true }) as T &
|
||||||
|
Partial<ParsedQs>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import qs from 'qs';
|
||||||
|
import url from 'parse-url';
|
||||||
|
|
||||||
|
interface IRouterLocation {
|
||||||
|
pathname: string;
|
||||||
|
search: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addQueryToLocation = (
|
||||||
|
{ pathname = '', search = '' }: Record<string, unknown> & IRouterLocation,
|
||||||
|
key = '',
|
||||||
|
value = ''
|
||||||
|
) => {
|
||||||
|
const { query } = url(pathname + search);
|
||||||
|
return `${pathname}?${qs.stringify({
|
||||||
|
...query,
|
||||||
|
[key]: value,
|
||||||
|
})}`;
|
||||||
|
};
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import qs from 'qs';
|
||||||
|
import url from 'parse-url';
|
||||||
|
|
||||||
|
interface IRouterLocation {
|
||||||
|
pathname: string;
|
||||||
|
search: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteQueryFromLocation = (
|
||||||
|
location: Record<string, unknown> & IRouterLocation,
|
||||||
|
key = ''
|
||||||
|
) => {
|
||||||
|
const { query } = url(location.pathname + location.search);
|
||||||
|
return `${location.pathname}/?${qs.stringify({
|
||||||
|
...query,
|
||||||
|
[key]: undefined,
|
||||||
|
})}`;
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import parseUrl from 'parse-url';
|
||||||
|
|
||||||
|
export const getLocationFromUrl = (url: String) => {
|
||||||
|
const { pathname, search } = parseUrl(url);
|
||||||
|
const searchStr = '?' + (search || '');
|
||||||
|
return { pathname, search: searchStr };
|
||||||
|
};
|
||||||
@@ -59,6 +59,7 @@ const appsState = atom({
|
|||||||
backgroundColor: amber[700],
|
backgroundColor: amber[700],
|
||||||
color: common.white,
|
color: common.white,
|
||||||
path: '/messages',
|
path: '/messages',
|
||||||
|
sharePath: '/messages/new',
|
||||||
Route: () => <Route path='/messages' component={MessagesApp} />,
|
Route: () => <Route path='/messages' component={MessagesApp} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,19 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const ContextMenu = ({ open, onClose, options }) => {
|
interface IContextMenuProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose(): void;
|
||||||
|
options: Array<{
|
||||||
|
onClick(e, option): void;
|
||||||
|
label: string;
|
||||||
|
selected?: boolean;
|
||||||
|
icon?: React.ReactNode;
|
||||||
|
key?: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ContextMenu = ({ open, onClose, options }: IContextMenuProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Slide direction='up' in={open} mountOnEnter unmountOnExit>
|
<Slide direction='up' in={open} mountOnEnter unmountOnExit>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import CloseIcon from '@material-ui/icons/Close';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { Paper } from '@material-ui/core';
|
import { Button, Paper } from '@material-ui/core';
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles(() => ({
|
||||||
root: {
|
root: {
|
||||||
|
padding: '24px',
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
background: '#424242',
|
background: '#424242',
|
||||||
marginTop: '15px',
|
marginTop: '15px',
|
||||||
@@ -24,6 +26,12 @@ const useStyles = makeStyles(() => ({
|
|||||||
displayNone: {
|
displayNone: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
},
|
},
|
||||||
|
imageModalCloseButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const Modal = ({ children, visible, handleClose }) => {
|
export const Modal = ({ children, visible, handleClose }) => {
|
||||||
@@ -48,7 +56,12 @@ export const Modal = ({ children, visible, handleClose }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={showHideClassName}>
|
<div className={showHideClassName}>
|
||||||
<Paper className={classes.root}>{children}</Paper>
|
<Paper className={classes.root}>
|
||||||
|
<Button onClick={handleClose} className={classes.imageModalCloseButton}>
|
||||||
|
<CloseIcon />
|
||||||
|
</Button>
|
||||||
|
{children}
|
||||||
|
</Paper>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+84
-1
@@ -1893,6 +1893,11 @@
|
|||||||
"@types/minimatch" "*"
|
"@types/minimatch" "*"
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/history@*":
|
||||||
|
version "4.7.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934"
|
||||||
|
integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA==
|
||||||
|
|
||||||
"@types/html-minifier-terser@^5.0.0":
|
"@types/html-minifier-terser@^5.0.0":
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#3c9ee980f1a10d6021ae6632ca3e79ca2ec4fb50"
|
resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#3c9ee980f1a10d6021ae6632ca3e79ca2ec4fb50"
|
||||||
@@ -1973,6 +1978,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"
|
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"
|
||||||
integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==
|
integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==
|
||||||
|
|
||||||
|
"@types/qs@^6.9.5":
|
||||||
|
version "6.9.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.5.tgz#434711bdd49eb5ee69d90c1d67c354a9a8ecb18b"
|
||||||
|
integrity sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ==
|
||||||
|
|
||||||
"@types/react-dom@*", "@types/react-dom@^16.9.8":
|
"@types/react-dom@*", "@types/react-dom@^16.9.8":
|
||||||
version "16.9.8"
|
version "16.9.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423"
|
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423"
|
||||||
@@ -1980,6 +1990,23 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
|
"@types/react-router-dom@^5.1.7":
|
||||||
|
version "5.1.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.1.7.tgz#a126d9ea76079ffbbdb0d9225073eb5797ab7271"
|
||||||
|
integrity sha512-D5mHD6TbdV/DNHYsnwBTv+y73ei+mMjrkGrla86HthE4/PVvL1J94Bu3qABU+COXzpL23T1EZapVVpwHuBXiUg==
|
||||||
|
dependencies:
|
||||||
|
"@types/history" "*"
|
||||||
|
"@types/react" "*"
|
||||||
|
"@types/react-router" "*"
|
||||||
|
|
||||||
|
"@types/react-router@*":
|
||||||
|
version "5.1.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.11.tgz#b01ce4cb21bf7d6b32edc862fc1e2c0088044b5b"
|
||||||
|
integrity sha512-ofHbZMlp0Y2baOHgsWBQ4K3AttxY61bDMkwTiBOkPg7U6C/3UwwB5WaIx28JmSVi/eX3uFEMRo61BV22fDQIvg==
|
||||||
|
dependencies:
|
||||||
|
"@types/history" "*"
|
||||||
|
"@types/react" "*"
|
||||||
|
|
||||||
"@types/react-transition-group@^4.2.0":
|
"@types/react-transition-group@^4.2.0":
|
||||||
version "4.4.0"
|
version "4.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.0.tgz#882839db465df1320e4753e6e9f70ca7e9b4d46d"
|
resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.0.tgz#882839db465df1320e4753e6e9f70ca7e9b4d46d"
|
||||||
@@ -6876,6 +6903,13 @@ [email protected]:
|
|||||||
resolved "https://registry.yarnpkg.com/is-root/-/is-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c"
|
resolved "https://registry.yarnpkg.com/is-root/-/is-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c"
|
||||||
integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg==
|
integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg==
|
||||||
|
|
||||||
|
is-ssh@^1.3.0:
|
||||||
|
version "1.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.3.2.tgz#a4b82ab63d73976fd8263cceee27f99a88bdae2b"
|
||||||
|
integrity sha512-elEw0/0c2UscLrNG+OAorbP539E3rhliKPg+hDMWN9VwrDXfYK+4PBEykDPfxlYYtQvl84TascnQyobfQLHEhQ==
|
||||||
|
dependencies:
|
||||||
|
protocols "^1.1.0"
|
||||||
|
|
||||||
is-stream@^1.1.0:
|
is-stream@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||||
@@ -8564,7 +8598,7 @@ [email protected]:
|
|||||||
query-string "^4.1.0"
|
query-string "^4.1.0"
|
||||||
sort-keys "^1.0.0"
|
sort-keys "^1.0.0"
|
||||||
|
|
||||||
normalize-url@^3.0.0:
|
normalize-url@^3.0.0, normalize-url@^3.3.0:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
|
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
|
||||||
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==
|
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==
|
||||||
@@ -8977,6 +9011,26 @@ parse-passwd@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
|
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
|
||||||
integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=
|
integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=
|
||||||
|
|
||||||
|
parse-path@^4.0.0:
|
||||||
|
version "4.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.3.tgz#82d81ec3e071dcc4ab49aa9f2c9c0b8966bb22bf"
|
||||||
|
integrity sha512-9Cepbp2asKnWTJ9x2kpw6Fe8y9JDbqwahGCTvklzd/cEq5C5JC59x2Xb0Kx+x0QZ8bvNquGO8/BWP0cwBHzSAA==
|
||||||
|
dependencies:
|
||||||
|
is-ssh "^1.3.0"
|
||||||
|
protocols "^1.4.0"
|
||||||
|
qs "^6.9.4"
|
||||||
|
query-string "^6.13.8"
|
||||||
|
|
||||||
|
parse-url@^5.0.2:
|
||||||
|
version "5.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-5.0.2.tgz#856a3be1fcdf78dc93fc8b3791f169072d898b59"
|
||||||
|
integrity sha512-Czj+GIit4cdWtxo3ISZCvLiUjErSo0iI3wJ+q9Oi3QuMYTI6OZu+7cewMWZ+C1YAnKhYTk6/TLuhIgCypLthPA==
|
||||||
|
dependencies:
|
||||||
|
is-ssh "^1.3.0"
|
||||||
|
normalize-url "^3.3.0"
|
||||||
|
parse-path "^4.0.0"
|
||||||
|
protocols "^1.4.0"
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
|
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
|
||||||
@@ -10018,6 +10072,11 @@ prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
|
|||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
react-is "^16.8.1"
|
react-is "^16.8.1"
|
||||||
|
|
||||||
|
protocols@^1.1.0, protocols@^1.4.0:
|
||||||
|
version "1.4.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.8.tgz#48eea2d8f58d9644a4a32caae5d5db290a075ce8"
|
||||||
|
integrity sha512-IgjKyaUSjsROSO8/D49Ab7hP8mJgTYcqApOqdPhLoPxAplXmkp+zRvsrSQjFn5by0rhm4VH0GAUELIPpx7B1yg==
|
||||||
|
|
||||||
proxy-addr@~2.0.5:
|
proxy-addr@~2.0.5:
|
||||||
version "2.0.6"
|
version "2.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
|
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
|
||||||
@@ -10098,6 +10157,11 @@ [email protected]:
|
|||||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
|
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
|
||||||
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
|
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
|
||||||
|
|
||||||
|
qs@^6.9.4, qs@^6.9.6:
|
||||||
|
version "6.9.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee"
|
||||||
|
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
|
||||||
|
|
||||||
qs@~6.5.2:
|
qs@~6.5.2:
|
||||||
version "6.5.2"
|
version "6.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||||
@@ -10111,6 +10175,15 @@ query-string@^4.1.0:
|
|||||||
object-assign "^4.1.0"
|
object-assign "^4.1.0"
|
||||||
strict-uri-encode "^1.0.0"
|
strict-uri-encode "^1.0.0"
|
||||||
|
|
||||||
|
query-string@^6.13.8:
|
||||||
|
version "6.13.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.8.tgz#8cf231759c85484da3cf05a851810d8e825c1159"
|
||||||
|
integrity sha512-jxJzQI2edQPE/NPUOusNjO/ZOGqr1o2OBa/3M00fU76FsLXDVbJDv/p7ng5OdQyorKrkRz1oqfwmbe5MAMePQg==
|
||||||
|
dependencies:
|
||||||
|
decode-uri-component "^0.2.0"
|
||||||
|
split-on-first "^1.0.0"
|
||||||
|
strict-uri-encode "^2.0.0"
|
||||||
|
|
||||||
querystring-es3@^0.2.0:
|
querystring-es3@^0.2.0:
|
||||||
version "0.2.1"
|
version "0.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
|
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
|
||||||
@@ -11386,6 +11459,11 @@ spdy@^4.0.2:
|
|||||||
select-hose "^2.0.0"
|
select-hose "^2.0.0"
|
||||||
spdy-transport "^3.0.0"
|
spdy-transport "^3.0.0"
|
||||||
|
|
||||||
|
split-on-first@^1.0.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
|
||||||
|
integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
|
||||||
|
|
||||||
split-string@^3.0.1, split-string@^3.0.2:
|
split-string@^3.0.1, split-string@^3.0.2:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||||
@@ -11500,6 +11578,11 @@ strict-uri-encode@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
||||||
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
|
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
|
||||||
|
|
||||||
|
strict-uri-encode@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
|
||||||
|
integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY=
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
version "0.3.1"
|
version "0.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
|
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
|
||||||
|
|||||||
Reference in new issue
Block a user