mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
inital share modal for notes
This commit is contained in:
1 parent
11b9caf611
commit
d5b9f78fa8
3 files changed
+57
-2
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Fab, List, ListItem, ListItemText } from '@material-ui/core';
|
import { Fab, List, ListItem, ListItemText, Box, Typography } from '@material-ui/core';
|
||||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||||
import { useNotes } from '../hooks/useNotes';
|
import { useNotes } from '../hooks/useNotes';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
CircularProgress,
|
CircularProgress,
|
||||||
Box,
|
Box,
|
||||||
} from '@material-ui/core';
|
} from '@material-ui/core';
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||||
import useStyles from './modal.styles';
|
import useStyles from './modal.styles';
|
||||||
@@ -16,6 +16,9 @@ import Nui from '../../../os/nui-events/utils/Nui';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { StatusButton } from '../../../ui/components/StatusButton';
|
import { StatusButton } from '../../../ui/components/StatusButton';
|
||||||
|
import ShareIcon from '@material-ui/icons/Share';
|
||||||
|
import Modal from '../../../ui/components/Modal';
|
||||||
|
import { Autocomplete } from '@material-ui/lab';
|
||||||
|
|
||||||
export const NoteModal = () => {
|
export const NoteModal = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
@@ -23,6 +26,9 @@ export const NoteModal = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { detail, setDetail } = useNoteDetail();
|
const { detail, setDetail } = useNoteDetail();
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const [number, setNumber] = useState('');
|
||||||
|
|
||||||
const onClose = () => history.goBack();
|
const onClose = () => history.goBack();
|
||||||
|
|
||||||
const _handleClose = () => {
|
const _handleClose = () => {
|
||||||
@@ -51,9 +57,43 @@ export const NoteModal = () => {
|
|||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleShareNoteModal = () => setOpen(true);
|
||||||
|
|
||||||
|
const NoteShareModal = () => {
|
||||||
|
const opts = [
|
||||||
|
{
|
||||||
|
title: 'Nice',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'wtf',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleShareNote = () => {
|
||||||
|
Nui.send('phone:shareNote', {});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal visible={open} handleClose={() => setOpen(false)}>
|
||||||
|
<Autocomplete
|
||||||
|
freeSolo
|
||||||
|
disableClearable
|
||||||
|
options={opts.map((op) => op.title)}
|
||||||
|
onChange={(e: any) => setNumber(e.currentTarget.value)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField {...params} label="Search contacts" margin="normal" />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Button onClick={handleShareNote}>Share</Button>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slide direction="left" in={!!detail}>
|
<Slide direction="left" in={!!detail}>
|
||||||
<Paper className={classes.modalRoot}>
|
<Paper className={classes.modalRoot}>
|
||||||
|
<NoteShareModal />
|
||||||
|
<div className={open ? classes.backgroundModal : undefined} />
|
||||||
{!detail ? (
|
{!detail ? (
|
||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
) : (
|
) : (
|
||||||
@@ -126,6 +166,11 @@ export const NoteModal = () => {
|
|||||||
{t('GENERIC_DELETE')}
|
{t('GENERIC_DELETE')}
|
||||||
</StatusButton>
|
</StatusButton>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Box display="inline" p={1}>
|
||||||
|
<Button color="primary" onClick={handleShareNoteModal}>
|
||||||
|
<ShareIcon />
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
lineHeight: 1.2,
|
lineHeight: 1.2,
|
||||||
},
|
},
|
||||||
|
backgroundModal: {
|
||||||
|
background: 'black',
|
||||||
|
opacity: '0.6',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
zIndex: 5,
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default useStyles;
|
export default useStyles;
|
||||||
Reference in new issue
Block a user