mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 18:23:08 +03:00
Display comment form on edit click
This commit is contained in:
parent
d82c481e00
commit
2483b27296
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import IconButton from '@material-ui/core/IconButton';
|
import IconButton from '@material-ui/core/IconButton';
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from '@material-ui/core/Paper';
|
||||||
@ -74,14 +74,15 @@ type Props = {
|
|||||||
|
|
||||||
function Message({ bug, op }: Props) {
|
function Message({ bug, op }: Props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const [editMode, switchToEditMode] = useState(false);
|
||||||
|
|
||||||
const editComment = (id: String) => {
|
const editComment = (id: String) => {
|
||||||
|
switchToEditMode(true);
|
||||||
console.log(id);
|
console.log(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function readMessageView() {
|
||||||
return (
|
return (
|
||||||
<article className={classes.container}>
|
|
||||||
<Avatar author={op.author} className={classes.avatar} />
|
|
||||||
<Paper elevation={1} className={classes.bubble}>
|
<Paper elevation={1} className={classes.bubble}>
|
||||||
<header className={classes.header}>
|
<header className={classes.header}>
|
||||||
<div className={classes.title}>
|
<div className={classes.title}>
|
||||||
@ -90,6 +91,8 @@ function Message({ bug, op }: Props) {
|
|||||||
<Date date={op.createdAt} />
|
<Date date={op.createdAt} />
|
||||||
</div>
|
</div>
|
||||||
{op.edited && <div className={classes.tag}>Edited</div>}
|
{op.edited && <div className={classes.tag}>Edited</div>}
|
||||||
|
<IfLoggedIn>
|
||||||
|
{() => (
|
||||||
<Tooltip title="Edit Message" placement="top" arrow={true}>
|
<Tooltip title="Edit Message" placement="top" arrow={true}>
|
||||||
<IconButton
|
<IconButton
|
||||||
disableRipple
|
disableRipple
|
||||||
@ -100,18 +103,28 @@ function Message({ bug, op }: Props) {
|
|||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</IfLoggedIn>
|
||||||
</header>
|
</header>
|
||||||
<section className={classes.body}>
|
<section className={classes.body}>
|
||||||
<Content markdown={op.message} />
|
<Content markdown={op.message} />
|
||||||
</section>
|
</section>
|
||||||
</Paper>
|
</Paper>
|
||||||
<IfLoggedIn>
|
);
|
||||||
{() => (
|
}
|
||||||
<div>
|
|
||||||
|
function editMessageView() {
|
||||||
|
return (
|
||||||
|
<div className={classes.bubble}>
|
||||||
<CommentForm bug={bug} />
|
<CommentForm bug={bug} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
</IfLoggedIn>
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<article className={classes.container}>
|
||||||
|
<Avatar author={op.author} className={classes.avatar} />
|
||||||
|
{editMode ? editMessageView() : readMessageView()}
|
||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user