mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
initial commit for camera app
This commit is contained in:
1 parent
580fb12e92
commit
5b85efedf1
13 files changed
+334
No files matched your search
@@ -0,0 +1,65 @@
|
||||
import React from 'react'
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
||||
import useStyles from './modal.styles';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { Button, Paper } from '@material-ui/core';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import DeleteIcon from '@material-ui/icons/Delete';
|
||||
import ShareIcon from '@material-ui/icons/Share';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useImagePrompt } from '../../../twitter/hooks/useImagePrompt';
|
||||
import { useShareModal } from '../../hooks/useShareModal';
|
||||
import { ShareModal } from './ShareModal';
|
||||
import { useShareLink } from '../../hooks/useShareLink';
|
||||
|
||||
export const GalleryModal = () => {
|
||||
|
||||
const { meta, setMeta } = usePhotoMeta();
|
||||
const { modal, setModal } = usePhotoModal();
|
||||
const classes = useStyles();
|
||||
|
||||
const { shareModal ,setShareModal } = useShareModal();
|
||||
const { setShareLink } = useShareLink();
|
||||
|
||||
let history = useHistory();
|
||||
|
||||
const _handleClose = () => {
|
||||
setModal(false)
|
||||
setMeta(null);
|
||||
//history.goBack();
|
||||
}
|
||||
|
||||
const handleDeletePhoto = () => {
|
||||
console.log(meta.id)
|
||||
Nui.send('photo:deletePhoto', {
|
||||
id: meta.id
|
||||
})
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
const handleSharePhoto = () => {
|
||||
setShareModal(true)
|
||||
setShareLink(meta.image)
|
||||
}
|
||||
|
||||
if(!meta) return null;
|
||||
|
||||
return (
|
||||
<Paper className={modal ? classes.modal : classes.modalHide}>
|
||||
<ShareModal />
|
||||
<div className={shareModal ? classes.backgroundModal : undefined} />
|
||||
<Button onClick={_handleClose}><ArrowBackIcon /></Button>
|
||||
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})`}} />
|
||||
<div className={classes.actionDiv}>
|
||||
<Button onClick={handleDeletePhoto}>
|
||||
<DeleteIcon fontSize="large" />
|
||||
</Button>
|
||||
<Button onClick={handleSharePhoto}>
|
||||
<ShareIcon fontSize="large" />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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 TwitterIcon from '@material-ui/icons/Twitter';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useModal } from '../../../twitter/hooks/useModal';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faAd } from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
export const ShareModal = () => {
|
||||
const { shareModal, setShareModal } = useShareModal();
|
||||
const { shareLink, setShareLink } = useShareLink();
|
||||
const { setModalVisible } = useModal();
|
||||
|
||||
|
||||
let history = useHistory();
|
||||
|
||||
const _handleClose = () => {
|
||||
setShareModal(false)
|
||||
setShareLink(null)
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal visible={shareModal} handleClose={_handleClose}>
|
||||
<div style={{ marginBottom: 50 }}>
|
||||
<Button style={{ position: 'absolute', right: 0, width: '10%' }} onClick={_handleClose}><CloseIcon /></Button>
|
||||
<div style={{ marginTop: 40 }}>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>Where do you want to share the photo?</h4>
|
||||
<Button>
|
||||
{<TwitterIcon />} Twitter
|
||||
</Button>
|
||||
<Button>
|
||||
{<FontAwesomeIcon icon={faAd} fixedWidth size="2x"/>} Advert
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundModal: {
|
||||
background: "black",
|
||||
opacity: "0.6",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 5,
|
||||
},
|
||||
modal: {
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
},
|
||||
modalHide: {
|
||||
display: 'none'
|
||||
},
|
||||
image: {
|
||||
width: 'auto',
|
||||
height: 380,
|
||||
maxWidth: 'auto',
|
||||
maxHeight: 380,
|
||||
backgroundPosition: 'center',
|
||||
backgroundSize: 'cover',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
marginTop: '4em'
|
||||
},
|
||||
actionDiv: {
|
||||
marginTop: 15,
|
||||
display: 'flex',
|
||||
justifyContent: 'space-evenly'
|
||||
}
|
||||
}))
|
||||
|
||||
export default useStyles;
|
||||
Reference in new issue
Block a user