|
@@ -13,23 +13,22 @@ import {
|
|
Typography,
|
|
Typography,
|
|
Box,
|
|
Box,
|
|
Divider,
|
|
Divider,
|
|
- TextField
|
|
|
|
} from '@mui/material'
|
|
} from '@mui/material'
|
|
import {
|
|
import {
|
|
FavoriteBorderRounded,
|
|
FavoriteBorderRounded,
|
|
Send,
|
|
Send,
|
|
ChatBubbleOutline,
|
|
ChatBubbleOutline,
|
|
TurnedInNot,
|
|
TurnedInNot,
|
|
- AccountCircle,
|
|
|
|
- AddComment
|
|
|
|
} from '@mui/icons-material/'
|
|
} from '@mui/icons-material/'
|
|
|
|
+
|
|
import Grid from '@mui/material/Unstable_Grid2';
|
|
import Grid from '@mui/material/Unstable_Grid2';
|
|
|
|
|
|
-import Comments from "./comments";
|
|
|
|
|
|
+import CCommentsFeed from "./comments_feed";
|
|
|
|
+import CommentField from "./comment_field";
|
|
|
|
|
|
|
|
|
|
export function CardPost({ postData }) {
|
|
export function CardPost({ postData }) {
|
|
- console.log('postData: ', postData)
|
|
|
|
|
|
+ // console.log('postData: ', postData)
|
|
|
|
|
|
const history = useHistory()
|
|
const history = useHistory()
|
|
|
|
|
|
@@ -46,7 +45,7 @@ export function CardPost({ postData }) {
|
|
history.push(`/user/${postData?.owner?._id}`)
|
|
history.push(`/user/${postData?.owner?._id}`)
|
|
}
|
|
}
|
|
|
|
|
|
- function AddCommentFocus() {
|
|
|
|
|
|
+ function addCommentFocus() {
|
|
document.getElementById('addCommentField').focus()
|
|
document.getElementById('addCommentField').focus()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,10 +98,12 @@ export function CardPost({ postData }) {
|
|
<Grid
|
|
<Grid
|
|
container
|
|
container
|
|
spacing={2}
|
|
spacing={2}
|
|
|
|
+ sx={{
|
|
|
|
+ marginBottom: 3
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
<Grid
|
|
<Grid
|
|
xs={2}
|
|
xs={2}
|
|
-
|
|
|
|
sx={{
|
|
sx={{
|
|
flex: '0 0 45px'
|
|
flex: '0 0 45px'
|
|
}}
|
|
}}
|
|
@@ -124,7 +125,8 @@ export function CardPost({ postData }) {
|
|
variant="subtitle2"
|
|
variant="subtitle2"
|
|
color="text.secondary"
|
|
color="text.secondary"
|
|
sx={{
|
|
sx={{
|
|
- cursor: 'pointer'
|
|
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
+ width: 'fit-content'
|
|
}}
|
|
}}
|
|
onClick={toAccount}
|
|
onClick={toAccount}
|
|
>
|
|
>
|
|
@@ -133,7 +135,7 @@ export function CardPost({ postData }) {
|
|
|
|
|
|
<Typography
|
|
<Typography
|
|
variant="subtitle2"
|
|
variant="subtitle2"
|
|
- color="text.secondary"
|
|
|
|
|
|
+ color="text.primary"
|
|
>
|
|
>
|
|
{postData?.title}
|
|
{postData?.title}
|
|
</Typography>
|
|
</Typography>
|
|
@@ -148,7 +150,8 @@ export function CardPost({ postData }) {
|
|
</Grid>
|
|
</Grid>
|
|
|
|
|
|
<Grid>
|
|
<Grid>
|
|
- <Comments data={postData?.comments} />
|
|
|
|
|
|
+ {/* <CommentsFeed data={postData?.comments} /> */}
|
|
|
|
+ <CCommentsFeed />
|
|
</Grid>
|
|
</Grid>
|
|
</CardContent>
|
|
</CardContent>
|
|
|
|
|
|
@@ -160,98 +163,66 @@ export function CardPost({ postData }) {
|
|
flexGrow: 1
|
|
flexGrow: 1
|
|
}}>
|
|
}}>
|
|
<Grid
|
|
<Grid
|
|
|
|
+ xs={12}
|
|
container
|
|
container
|
|
|
|
+ justifyContent="space-between"
|
|
|
|
+ alignItems="center"
|
|
|
|
+ sx={{
|
|
|
|
+ fontSize: '12px'
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
- <Grid
|
|
|
|
- xs={12}
|
|
|
|
- container
|
|
|
|
- justifyContent="space-between"
|
|
|
|
- alignItems="center"
|
|
|
|
- sx={{
|
|
|
|
- fontSize: '12px'
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <Grid
|
|
|
|
- container
|
|
|
|
- columnSpacing={1}
|
|
|
|
- >
|
|
|
|
- <Grid>
|
|
|
|
- <IconButton
|
|
|
|
- aria-label="add to favorites"
|
|
|
|
- onClick={() => (console.log('click like main post'))}
|
|
|
|
- >
|
|
|
|
- <FavoriteBorderRounded />
|
|
|
|
- </IconButton>
|
|
|
|
- </Grid>
|
|
|
|
-
|
|
|
|
- <Grid>
|
|
|
|
- <IconButton
|
|
|
|
- onClick={AddCommentFocus}
|
|
|
|
- >
|
|
|
|
- <ChatBubbleOutline />
|
|
|
|
- </IconButton>
|
|
|
|
- </Grid>
|
|
|
|
|
|
+ <Grid container>
|
|
|
|
+ <Grid>
|
|
|
|
+ <IconButton
|
|
|
|
+ aria-label="add to favorites"
|
|
|
|
+ onClick={() => (console.log('click like main post'))}
|
|
|
|
+ >
|
|
|
|
+ <FavoriteBorderRounded />
|
|
|
|
+ </IconButton>
|
|
|
|
+ </Grid>
|
|
|
|
|
|
- <Grid>
|
|
|
|
- <IconButton
|
|
|
|
- aria-label="share"
|
|
|
|
- >
|
|
|
|
- <Send />
|
|
|
|
- </IconButton>
|
|
|
|
- </Grid>
|
|
|
|
|
|
+ <Grid>
|
|
|
|
+ <IconButton
|
|
|
|
+ onClick={addCommentFocus}
|
|
|
|
+ >
|
|
|
|
+ <ChatBubbleOutline />
|
|
|
|
+ </IconButton>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
|
|
- <Grid
|
|
|
|
- sx={{
|
|
|
|
- order: { xs: 1, sm: 2 }
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <IconButton>
|
|
|
|
- <TurnedInNot />
|
|
|
|
|
|
+ <Grid>
|
|
|
|
+ <IconButton
|
|
|
|
+ aria-label="share"
|
|
|
|
+ >
|
|
|
|
+ <Send />
|
|
</IconButton>
|
|
</IconButton>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
+
|
|
|
|
+ <Grid>
|
|
|
|
+ <IconButton>
|
|
|
|
+ <TurnedInNot />
|
|
|
|
+ </IconButton>
|
|
|
|
+ </Grid>
|
|
|
|
+ </Grid>
|
|
|
|
+
|
|
|
|
+ <Grid container>
|
|
|
|
+ <Typography
|
|
|
|
+ variant="subtitle1"
|
|
|
|
+ color="text.secondary"
|
|
|
|
+ sx={{
|
|
|
|
+ padding: 1
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ Нравится: {postData.likesCount ? postData.likesCount : '0'}
|
|
|
|
+ </Typography>
|
|
</Grid>
|
|
</Grid>
|
|
</Box>
|
|
</Box>
|
|
</CardActions>
|
|
</CardActions>
|
|
|
|
|
|
- <CardContent>
|
|
|
|
- Нравится: {postData.likesCount ? postData.likesCount : '0'}
|
|
|
|
- {/* Нравится: {postData.likesCount || '0'} // сработает или нет - проверить */}
|
|
|
|
- </CardContent>
|
|
|
|
-
|
|
|
|
<Divider />
|
|
<Divider />
|
|
|
|
|
|
<CardActions>
|
|
<CardActions>
|
|
- <Box
|
|
|
|
- sx={{
|
|
|
|
- display: 'flex',
|
|
|
|
- alignItems: 'flex-end',
|
|
|
|
- justifyContent: 'space-between'
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <AccountCircle
|
|
|
|
- sx={{
|
|
|
|
- color: 'action.active',
|
|
|
|
- mr: 1,
|
|
|
|
- my: 0.5
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <TextField
|
|
|
|
- id="addCommentField"
|
|
|
|
- label="Add comment..."
|
|
|
|
- variant="standard"
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <Send
|
|
|
|
- sx={{
|
|
|
|
- color: 'action.active',
|
|
|
|
- mr: 1,
|
|
|
|
- my: 0.5
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
- </Box>
|
|
|
|
|
|
+ <CommentField id={postData?._id} />
|
|
</CardActions>
|
|
</CardActions>
|
|
</Card>
|
|
</Card>
|
|
)
|
|
)
|