| 3719 |
stevensc |
1 |
import React from 'react';
|
|
|
2 |
import { useDispatch, useSelector } from 'react-redux';
|
|
|
3 |
import { Avatar, Box, Button, Typography, styled } from '@mui/material';
|
|
|
4 |
import Image from '@mui/icons-material/Image';
|
|
|
5 |
import Create from '@mui/icons-material/Create';
|
|
|
6 |
import Article from '@mui/icons-material/Article';
|
|
|
7 |
import PostAdd from '@mui/icons-material/PostAdd';
|
|
|
8 |
import Subscriptions from '@mui/icons-material/Subscriptions';
|
|
|
9 |
|
|
|
10 |
import { openShareModal } from '@app/redux/share-modal/shareModal.actions';
|
|
|
11 |
import { shareModalTypes } from '@app/redux/share-modal/shareModal.types';
|
|
|
12 |
|
|
|
13 |
import Widget from '@app/components/UI/Widget';
|
|
|
14 |
import Input from '@components/UI/inputs/Input';
|
|
|
15 |
|
|
|
16 |
const Option = styled(Button)(({ theme }) => ({
|
|
|
17 |
borderRadius: '50%',
|
|
|
18 |
cursor: 'pointer',
|
|
|
19 |
padding: 5,
|
|
|
20 |
minWidth: 'auto',
|
|
|
21 |
span: {
|
|
|
22 |
display: 'none'
|
|
|
23 |
},
|
|
|
24 |
'&:hover': {
|
|
|
25 |
backgroundColor: 'whitesmoke'
|
|
|
26 |
},
|
|
|
27 |
[theme.breakpoints.up('md')]: {
|
|
|
28 |
alignItems: 'center',
|
|
|
29 |
borderRadius: theme.shape.borderRadius,
|
|
|
30 |
display: 'inline-flex',
|
|
|
31 |
gap: 1,
|
|
|
32 |
flex: 1,
|
|
|
33 |
span: {
|
|
|
34 |
display: 'initial'
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
}));
|
|
|
38 |
|
|
|
39 |
const ShareComponent = ({ feedType, postUrl = '', image = '' }) => {
|
|
|
40 |
const labels = useSelector(({ intl }) => intl.labels);
|
|
|
41 |
const dispatch = useDispatch();
|
|
|
42 |
|
|
|
43 |
const onClickHandler = (postType) => dispatch(openShareModal(postUrl, postType, feedType));
|
|
|
44 |
|
|
|
45 |
return (
|
|
|
46 |
<Widget>
|
|
|
47 |
<Widget.Body>
|
|
|
48 |
<Box
|
|
|
49 |
sx={{
|
|
|
50 |
display: 'flex',
|
|
|
51 |
alignItems: 'center',
|
|
|
52 |
marginBottom: 0.5,
|
|
|
53 |
gap: 0.5
|
|
|
54 |
}}
|
|
|
55 |
>
|
|
|
56 |
<Avatar
|
|
|
57 |
src={image}
|
|
|
58 |
sx={{
|
|
|
59 |
width: { xs: 40, sm: 50 },
|
|
|
60 |
height: { xs: 40, sm: 50 }
|
|
|
61 |
}}
|
|
|
62 |
/>
|
|
|
63 |
|
|
|
64 |
<Input
|
|
|
65 |
type='text'
|
|
|
66 |
placeholder={labels.what_are_you_thinking}
|
|
|
67 |
onClick={() => onClickHandler(shareModalTypes.POST)}
|
|
|
68 |
icon={<Create />}
|
|
|
69 |
variant='search'
|
|
|
70 |
readOnly
|
|
|
71 |
/>
|
|
|
72 |
</Box>
|
|
|
73 |
|
|
|
74 |
<Box
|
|
|
75 |
sx={{
|
|
|
76 |
display: 'flex',
|
|
|
77 |
justifyContent: 'space-between',
|
|
|
78 |
gap: 0.5
|
|
|
79 |
}}
|
|
|
80 |
>
|
|
|
81 |
<Option onClick={() => onClickHandler(shareModalTypes.IMAGE)}>
|
|
|
82 |
<Image sx={{ color: '#7405f9 !important' }} />
|
|
|
83 |
<Typography variant='overline'>{labels.image}</Typography>
|
|
|
84 |
</Option>
|
|
|
85 |
|
|
|
86 |
<Option onClick={() => onClickHandler(shareModalTypes.VIDEO)}>
|
|
|
87 |
<Subscriptions sx={{ color: '#E7A33E !important' }} />
|
|
|
88 |
<Typography variant='overline'>{labels.video}</Typography>
|
|
|
89 |
</Option>
|
|
|
90 |
|
|
|
91 |
<Option onClick={() => onClickHandler(shareModalTypes.FILE)}>
|
|
|
92 |
<Article sx={{ color: '#C0C8CD !important' }} />
|
|
|
93 |
<Typography variant='overline'>{labels.document}</Typography>
|
|
|
94 |
</Option>
|
|
|
95 |
|
|
|
96 |
<Option onClick={() => onClickHandler(shareModalTypes.POST)}>
|
|
|
97 |
<PostAdd sx={{ color: '#7FC15E !important' }} />
|
|
|
98 |
<Typography variant='overline'>{labels.write}</Typography>
|
|
|
99 |
</Option>
|
|
|
100 |
</Box>
|
|
|
101 |
</Widget.Body>
|
|
|
102 |
</Widget>
|
|
|
103 |
);
|
|
|
104 |
};
|
|
|
105 |
|
|
|
106 |
export default ShareComponent;
|