-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
69 lines (58 loc) · 2.02 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import React, { useEffect, useState } from 'react';
import classNames from 'classnames';
import { SystemIntakeGRBReviewDiscussionFragment } from 'gql/gen/graphql';
import Alert from 'components/shared/Alert';
import { DiscussionAlert } from 'types/discussions';
import Discussion from './Discussion';
import DiscussionModalWrapper from './DiscussionModalWrapper';
// import ViewDiscussions from './ViewDiscussions';
// import StartDiscussion from './StartDiscussion';
import './index.scss';
type DiscussionBoardProps = {
systemIntakeID: string;
grbDiscussions: SystemIntakeGRBReviewDiscussionFragment[];
isOpen: boolean;
closeModal: () => void;
};
function DiscussionBoard({
systemIntakeID,
grbDiscussions,
isOpen,
closeModal
}: DiscussionBoardProps) {
/** Discussion alert state for form success and error messages */
const [discussionAlert, setDiscussionAlert] = useState<DiscussionAlert>(null);
// Get the first discussion from the array for testing purposes
const activeDiscussion = grbDiscussions.length > 0 ? grbDiscussions[0] : null;
// Reset discussionAlert when side panel is opened or closed
useEffect(() => {
setDiscussionAlert(null);
}, [setDiscussionAlert, isOpen]);
return (
<DiscussionModalWrapper isOpen={isOpen} closeModal={closeModal}>
{discussionAlert && (
<Alert
slim
{...discussionAlert}
className={classNames('margin-bottom-6', discussionAlert.className)}
isClosable={false}
>
{discussionAlert.message}
</Alert>
)}
{/* <ViewDiscussions grbDiscussions={grbDiscussions} /> */}
{/* <StartDiscussion
systemIntakeID={systemIntakeID}
closeModal={closeModal}
setDiscussionAlert={setDiscussionAlert}
/> */}
<Discussion
// TODO: Update to discussion being viewed
discussion={activeDiscussion}
closeModal={closeModal}
setDiscussionAlert={setDiscussionAlert}
/>
</DiscussionModalWrapper>
);
}
export default DiscussionBoard;