aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-03-17 12:28:45 +0100
committerSascha <GlancingMind@outlook.com>2021-03-19 17:51:28 +0100
commitcd4b1adebbb009caba47b7dc4f543c4d951841f2 (patch)
tree8ed760969a8d7eea762a4bdf3b7041f9ee43129e /webui/src/pages
parent26ad5fc379749d7effc324ae36e778ee540053a7 (diff)
downloadgit-bug-cd4b1adebbb009caba47b7dc4f543c4d951841f2.tar.gz
Pass BugFragment as prop to EditComment
Diffstat (limited to 'webui/src/pages')
-rw-r--r--webui/src/pages/bug/.Bug.tsx.swpbin0 -> 12288 bytes
-rw-r--r--webui/src/pages/bug/.TimelineQuery.tsx.swpbin0 -> 12288 bytes
-rw-r--r--webui/src/pages/bug/Bug.tsx2
-rw-r--r--webui/src/pages/bug/Message.tsx13
-rw-r--r--webui/src/pages/bug/Timeline.tsx8
-rw-r--r--webui/src/pages/bug/TimelineQuery.tsx9
6 files changed, 23 insertions, 9 deletions
diff --git a/webui/src/pages/bug/.Bug.tsx.swp b/webui/src/pages/bug/.Bug.tsx.swp
new file mode 100644
index 00000000..4a312e0d
--- /dev/null
+++ b/webui/src/pages/bug/.Bug.tsx.swp
Binary files differ
diff --git a/webui/src/pages/bug/.TimelineQuery.tsx.swp b/webui/src/pages/bug/.TimelineQuery.tsx.swp
new file mode 100644
index 00000000..0ad00f67
--- /dev/null
+++ b/webui/src/pages/bug/.TimelineQuery.tsx.swp
Binary files differ
diff --git a/webui/src/pages/bug/Bug.tsx b/webui/src/pages/bug/Bug.tsx
index d85c5296..46a443d5 100644
--- a/webui/src/pages/bug/Bug.tsx
+++ b/webui/src/pages/bug/Bug.tsx
@@ -78,7 +78,7 @@ function Bug({ bug }: Props) {
<div className={classes.container}>
<div className={classes.timeline}>
- <TimelineQuery id={bug.id} />
+ <TimelineQuery bug={bug} />
<IfLoggedIn>
{() => (
<div className={classes.commentForm}>
diff --git a/webui/src/pages/bug/Message.tsx b/webui/src/pages/bug/Message.tsx
index 390f369e..3993b5f7 100644
--- a/webui/src/pages/bug/Message.tsx
+++ b/webui/src/pages/bug/Message.tsx
@@ -9,7 +9,10 @@ import EditIcon from '@material-ui/icons/Edit';
import Author, { Avatar } from 'src/components/Author';
import Content from 'src/components/Content';
import Date from 'src/components/Date';
+import IfLoggedIn from 'src/components/IfLoggedIn/IfLoggedIn';
+import { BugFragment } from './Bug.generated';
+import CommentForm from './CommentForm';
import { AddCommentFragment } from './MessageCommentFragment.generated';
import { CreateFragment } from './MessageCreateFragment.generated';
@@ -65,10 +68,11 @@ const useStyles = makeStyles((theme) => ({
}));
type Props = {
+ bug: BugFragment;
op: AddCommentFragment | CreateFragment;
};
-function Message({ op }: Props) {
+function Message({ bug, op }: Props) {
const classes = useStyles();
const editComment = (id: String) => {
@@ -101,6 +105,13 @@ function Message({ op }: Props) {
<Content markdown={op.message} />
</section>
</Paper>
+ <IfLoggedIn>
+ {() => (
+ <div>
+ <CommentForm bug={bug} />
+ </div>
+ )}
+ </IfLoggedIn>
</article>
);
}
diff --git a/webui/src/pages/bug/Timeline.tsx b/webui/src/pages/bug/Timeline.tsx
index 6e1d242e..60459a53 100644
--- a/webui/src/pages/bug/Timeline.tsx
+++ b/webui/src/pages/bug/Timeline.tsx
@@ -2,6 +2,7 @@ import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
+import { BugFragment } from './Bug.generated';
import LabelChange from './LabelChange';
import Message from './Message';
import SetStatus from './SetStatus';
@@ -18,9 +19,10 @@ const useStyles = makeStyles((theme) => ({
type Props = {
ops: Array<TimelineItemFragment>;
+ bug: BugFragment;
};
-function Timeline({ ops }: Props) {
+function Timeline({ bug, ops }: Props) {
const classes = useStyles();
return (
@@ -28,9 +30,9 @@ function Timeline({ ops }: Props) {
{ops.map((op, index) => {
switch (op.__typename) {
case 'CreateTimelineItem':
- return <Message key={index} op={op} />;
+ return <Message key={index} op={op} bug={bug} />;
case 'AddCommentTimelineItem':
- return <Message key={index} op={op} />;
+ return <Message key={index} op={op} bug={bug} />;
case 'LabelChangeTimelineItem':
return <LabelChange key={index} op={op} />;
case 'SetTitleTimelineItem':
diff --git a/webui/src/pages/bug/TimelineQuery.tsx b/webui/src/pages/bug/TimelineQuery.tsx
index 74eed52b..d66c665b 100644
--- a/webui/src/pages/bug/TimelineQuery.tsx
+++ b/webui/src/pages/bug/TimelineQuery.tsx
@@ -2,17 +2,18 @@ import React from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';
+import { BugFragment } from './Bug.generated';
import Timeline from './Timeline';
import { useTimelineQuery } from './TimelineQuery.generated';
type Props = {
- id: string;
+ bug: BugFragment;
};
-const TimelineQuery = ({ id }: Props) => {
+const TimelineQuery = ({ bug }: Props) => {
const { loading, error, data } = useTimelineQuery({
variables: {
- id,
+ id: bug.id,
first: 100,
},
});
@@ -25,7 +26,7 @@ const TimelineQuery = ({ id }: Props) => {
return null;
}
- return <Timeline ops={nodes} />;
+ return <Timeline ops={nodes} bug={bug} />;
};
export default TimelineQuery;