|
| 1 | +/* eslint-disable react/jsx-key */ |
| 2 | +/* eslint-disable max-len */ |
1 | 3 | /* eslint-disable no-unused-vars */
|
2 | 4 | /* eslint-disable prefer-template */
|
3 | 5 | import React from 'react'
|
4 | 6 | import { useParams } from 'react-router';
|
| 7 | +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' |
| 8 | +import {faBookmark, faSquareCheck, faRectangleXmark, faLink} from '@fortawesome/free-solid-svg-icons'; |
5 | 9 | import useFetch from '../Journals/useFetch';
|
6 |
| -import { Container } from './styles'; |
| 10 | +import { Container, Head, PolicyContainer, Title, Subhead, Subhead2, Box, List, Que, Misc, UpdateContainer, Icon } from './styles'; |
| 11 | +import { Authors, Head3 } from '../Journals/styles'; |
7 | 12 |
|
8 | 13 |
|
9 | 14 | function Details() {
|
10 | 15 | const { id } = useParams();
|
11 | 16 | const { journalFetch: indv } = useFetch('http://localhost:8000/journals/' + id);
|
12 | 17 |
|
| 18 | + const poli = [ |
| 19 | + { |
| 20 | + ques: 'POLICY TYPE:', |
| 21 | + ans: indv && indv.policies.policy, |
| 22 | + }, |
| 23 | + { |
| 24 | + ques: 'DATA AVAILABILITY STATEMENT PUBLISHED:', |
| 25 | + ans: indv && indv.policies.dataavail ? <FontAwesomeIcon icon={faSquareCheck} color="green"/> : <FontAwesomeIcon icon={faRectangleXmark} color="red"/>, |
| 26 | + }, |
| 27 | + { |
| 28 | + ques: "DATA SHARED:", |
| 29 | + ans: indv && indv.policies.datashared ? <FontAwesomeIcon icon={faSquareCheck} color="green" /> : <FontAwesomeIcon icon={faRectangleXmark} color="red"/> |
| 30 | + }, |
| 31 | + { |
| 32 | + ques: "DATA PEER REVIEWED:", |
| 33 | + ans: indv && indv.policies.peerreview ? <FontAwesomeIcon icon={faSquareCheck} color="green" /> : <FontAwesomeIcon icon={faRectangleXmark} color="red"/> |
| 34 | + }, |
| 35 | + { |
| 36 | + ques: "ENFORCED:", |
| 37 | + ans: indv && indv.policies.enforced, |
| 38 | + }, |
| 39 | + { |
| 40 | + ques: "ENFORCED EVIDENCE:", |
| 41 | + ans: indv && indv.policies.enforcedevidence, |
| 42 | + }, |
| 43 | + ]; |
| 44 | + |
| 45 | + const misc = [ |
| 46 | + { |
| 47 | + ques: "CREATED AT:", |
| 48 | + ans: indv && indv.published, |
| 49 | + }, |
| 50 | + { |
| 51 | + ques: "UPDATED AT:", |
| 52 | + ans: indv && indv.updated, |
| 53 | + }, |
| 54 | + { |
| 55 | + ques: "CREATED BY:", |
| 56 | + ans: indv && indv.authors.map((author) => ( |
| 57 | + <div key={indv.id}> |
| 58 | + {author} |
| 59 | + </div> |
| 60 | + )) |
| 61 | + }, |
| 62 | + ] |
| 63 | + |
13 | 64 | return (
|
14 | 65 | <Container>
|
15 |
| - <h1> |
16 |
| - Journal Detail - { id } |
| 66 | + <Head> |
| 67 | + Journal policies |
| 68 | + </Head> |
17 | 69 | { indv && (
|
18 |
| - <> |
19 |
| - <h2>{indv.title}</h2> |
| 70 | + <PolicyContainer> |
| 71 | + <Title>{indv.title}</Title> |
20 | 72 | <div>
|
21 |
| - <h2>Policy</h2> |
22 |
| - <p>POLICY TYPE: {indv.policies.policy}</p> |
23 |
| - <p>DATA AVAILABILITY STATEMENT PUBLISHED: {indv.policies.dataavail}</p> |
24 |
| - <p>DATA SHARED: {indv.policies.datashared}</p> |
25 |
| - <p>DATA PEER REVIEWED: {indv.policies.peerreview}</p> |
26 |
| - <p>ENFORCED: {indv.policies.enforced}</p> |
27 |
| - <p>ENFORCED EVIDENCE: {indv.policies.enforcedevidence}</p> |
| 73 | + <Subhead> |
| 74 | + <Icon> |
| 75 | + <FontAwesomeIcon icon={faBookmark} color="#EC8D20"/> |
| 76 | + </Icon> |
| 77 | + <Subhead2>Policies</Subhead2> |
| 78 | + </Subhead> |
| 79 | + <Box> |
| 80 | + {poli.map((detail) => ( |
| 81 | + <List primary> |
| 82 | + <Que primary> |
| 83 | + {detail.ques} |
| 84 | + </Que> |
| 85 | + <span style={{color: "black"}}> |
| 86 | + {detail.ans} |
| 87 | + </span> |
| 88 | + </List> |
| 89 | + ))} |
| 90 | + </Box> |
| 91 | + <Misc> |
| 92 | + <span style={{color: "#EC8D20"}}>{indv.topic}</span> | <FontAwesomeIcon icon={faLink} color="#29A3CE"/> <span style={{color: "#A39797"}}>{indv.link}</span> |
| 93 | + <UpdateContainer> |
| 94 | + {misc.map((mis) => ( |
| 95 | + <List> |
| 96 | + <Que> |
| 97 | + {mis.ques} |
| 98 | + </Que> |
| 99 | + <div> |
| 100 | + {mis.ans} |
| 101 | + </div> |
| 102 | + |
| 103 | + </List> |
| 104 | + ))} |
| 105 | + </UpdateContainer> |
| 106 | + </Misc> |
28 | 107 | </div>
|
29 |
| - </> |
| 108 | + </PolicyContainer> |
30 | 109 | )}
|
31 |
| - </h1> |
| 110 | + |
32 | 111 | </Container>
|
33 | 112 |
|
34 | 113 | )
|
|
0 commit comments