Skip to content

Commit

Permalink
ADD commenting functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dolf321 committed Jul 20, 2023
1 parent cb2a3ad commit fb6b531
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion web/src/components/forums/Comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {useStyles} from './Comment.styles';
import standardErrorHandler from '../../../utils/standardErrorHandler';
import standardStatusHandler from '../../../utils/standardStatusHandler';
import {toRelativeDate} from '../../../utils/datetime';
import RichTextEditor from '../Editor/RichTextEditor';

export default function Comment({
threadStart = false,
Expand Down Expand Up @@ -42,7 +43,7 @@ export default function Comment({
</Typography>
</Box>
<Typography className={classes.content}>
{content}
<RichTextEditor content={content} readOnly={true} enableToolbar={false}/>
</Typography>
<Box className={classes.replyActions}>
{hasReplies &&
Expand Down
7 changes: 4 additions & 3 deletions web/src/components/forums/CommentsList/CommentsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, {useState} from 'react';

import Box from '@mui/material/Box';
import Comment from '../Comment/Comment';

import Publisher from '../Publisher/Publisher';
import {useStyles} from './CommentsList.styles';

export default function CommentsList({comments}) {
export default function CommentsList({comments, handleCreateComment}) {
const classes = useStyles();

const [isReplying, setIsReplying] = useState(false);
Expand Down Expand Up @@ -39,7 +39,8 @@ export default function CommentsList({comments}) {
/>
))}
{isReplying &&
<input />
<Publisher mode="comment" setOpen={setIsReplying}
handlePublish={(comment) => handleCreateComment({...comment, comment_id: comment.id})}/>
}
</Box>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const useStyles = makeStyles((theme) => ({
flexDirection: 'column',
borderLeft: `1px solid ${theme.palette.dark.blue['200']}`,
paddingLeft: theme.spacing(1.5),
overflow: 'scroll',
},
replies: {
display: 'flex',
Expand Down

0 comments on commit fb6b531

Please sign in to comment.