mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +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
+481
-294
No files matched your search
@@ -1,46 +1,42 @@
|
||||
import React from 'react';
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { useShareLink } from '../../hooks/useShareLink';
|
||||
import { useShareModal } from '../../hooks/useShareModal';
|
||||
import { Button } from '@material-ui/core';
|
||||
import MessageIcon from '@material-ui/icons/Message';
|
||||
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
|
||||
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 { shareModal, setShareModal } = useShareModal();
|
||||
const { setShareLink } = useShareLink();
|
||||
|
||||
const _handleClose = () => {
|
||||
setShareModal(false);
|
||||
setShareLink(null);
|
||||
};
|
||||
const history = useHistory();
|
||||
|
||||
const handleCopyImage = () => {
|
||||
setClipboard(meta.image);
|
||||
history.push(referal);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={shareModal} handleClose={_handleClose}>
|
||||
<Modal visible={!!meta} handleClose={onClose}>
|
||||
<div className={classes.shareModal}>
|
||||
<Button
|
||||
style={{ position: 'absolute', right: 0, width: '10%' }}
|
||||
onClick={_handleClose}
|
||||
>
|
||||
<CloseIcon />
|
||||
</Button>
|
||||
<div className={classes.innerShareModal}>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||
Where do you want to share the photo?
|
||||
</h4>
|
||||
<Button>{<MessageIcon />} Message</Button>
|
||||
<h4>Or just copy the image here:</h4>
|
||||
<Button onClick={handleCopyImage} variant='contained'>
|
||||
Copy image
|
||||
</Button>
|
||||
<>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||
Where do you want to share the photo?
|
||||
</h4>
|
||||
<Button>{<MessageIcon />} Message</Button>
|
||||
<h4>Or just copy the image here:</h4>
|
||||
<Button onClick={handleCopyImage} variant='contained'>
|
||||
Copy image
|
||||
</Button>
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
Reference in new issue
Block a user