Skip to content

Commit 7c851cc

Browse files
authored
Merge pull request #178 from padmajabhol/format
chore: format project with prettier
2 parents 2542e71 + 2388890 commit 7c851cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1334
-930
lines changed
File renamed without changes.

data/db.json

Lines changed: 121 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
"journaltype": "RESEARCH ARTICLE",
1010
"topic": "General Computing",
1111
"published": "12 July 2022",
12-
"issn": "issn-615-682456"
12+
"issn": "issn-615-682456",
13+
"updated": "16th Aug 2022",
14+
"link": "https://doi.org/10.1002/agg2.20287",
15+
"policies": {
16+
"policy": "Policy 1",
17+
"dataavail": true,
18+
"datashared": false,
19+
"peerreview": true,
20+
"enforced": "Yes - before application",
21+
"enforcedevidence": "Random String"
22+
23+
}
1324
},
1425
{
1526
"id": 2,
@@ -20,7 +31,19 @@
2031
"journaltype": "RESEARCH ARTICLE",
2132
"topic": "General Computing",
2233
"published": "12 July 2022",
23-
"issn": "issn-615-682543"
34+
"issn": "issn-615-682543",
35+
"updated": "16th Aug 2022",
36+
"link": "https://doi.org/10.1002/agg2.20287",
37+
38+
"policies": {
39+
"policy": "Policy 1",
40+
"dataavail": false,
41+
"datashared": true,
42+
"peerreview": true,
43+
"enforced": "Yes - before application",
44+
"enforcedevidence": "Random String"
45+
46+
}
2447
},
2548
{
2649
"id": 3,
@@ -31,7 +54,18 @@
3154
"journaltype": "AI Journal",
3255
"topic": "Computer Science",
3356
"published": "23 July 2022",
34-
"issn": "issn-615-892543"
57+
"issn": "issn-615-892543",
58+
"updated": "16th Aug 2022",
59+
"link": "https://doi.org/10.1002/agg2.20287",
60+
"policies": {
61+
"policy": "Policy 1",
62+
"dataavail": true,
63+
"datashared": true,
64+
"peerreview": false,
65+
"enforced": "Yes - before application",
66+
"enforcedevidence": "Random String"
67+
68+
}
3569
},
3670
{
3771
"id": 4,
@@ -42,7 +76,18 @@
4276
"journaltype": "Book",
4377
"topic": "Networking / LINUX",
4478
"published": "29 January 2008",
45-
"issn": "issn-615-892643"
79+
"issn": "issn-615-892643",
80+
"updated": "16th Aug 2022",
81+
"link": "https://doi.org/10.1002/agg2.20287",
82+
"policies": {
83+
"policy": "Policy 1",
84+
"dataavail": true,
85+
"datashared": true,
86+
"peerreview": true,
87+
"enforced": "Yes - before application",
88+
"enforcedevidence": "Random String"
89+
90+
}
4691
},
4792
{
4893
"id": 5,
@@ -53,7 +98,18 @@
5398
"journaltype": "RESEARCH ARTICLE",
5499
"topic": "General Computing",
55100
"published": "12 July 2022",
56-
"issn": "issn-615-682456"
101+
"issn": "issn-615-682456",
102+
"updated": "16th Aug 2022",
103+
"link": "https://doi.org/10.1002/agg2.20287",
104+
"policies": {
105+
"policy": "Policy 1",
106+
"dataavail": true,
107+
"datashared": true,
108+
"peerreview": true,
109+
"enforced": "Yes - before application",
110+
"enforcedevidence": "Random String"
111+
112+
}
57113
},
58114
{
59115
"id": 6,
@@ -64,7 +120,18 @@
64120
"journaltype": "RESEARCH ARTICLE",
65121
"topic": "General Computing",
66122
"published": "12 July 2022",
67-
"issn": "issn-615-682543"
123+
"issn": "issn-615-682543",
124+
"updated": "16th Aug 2022",
125+
"link": "https://doi.org/10.1002/agg2.20287",
126+
"policies": {
127+
"policy": "Policy 1",
128+
"dataavail": true,
129+
"datashared": true,
130+
"peerreview": true,
131+
"enforced": "Yes - before application",
132+
"enforcedevidence": "Random String"
133+
134+
}
68135
},
69136
{
70137
"id": 7,
@@ -75,7 +142,18 @@
75142
"journaltype": "Book",
76143
"topic": "Networking / LINUX",
77144
"published": "29 January 2008",
78-
"issn": "issn-615-892643"
145+
"issn": "issn-615-892643",
146+
"updated": "16th Aug 2022",
147+
"link": "https://doi.org/10.1002/agg2.20287",
148+
"policies": {
149+
"policy": "Policy 1",
150+
"dataavail": true,
151+
"datashared": true,
152+
"peerreview": true,
153+
"enforced": "Yes - before application",
154+
"enforcedevidence": "Random String"
155+
156+
}
79157
},
80158
{
81159
"id": 8,
@@ -86,7 +164,18 @@
86164
"journaltype": "RESEARCH ARTICLE",
87165
"topic": "General Computing",
88166
"published": "12 July 2022",
89-
"issn": "issn-615-682456"
167+
"issn": "issn-615-682456",
168+
"updated": "16th Aug 2022",
169+
"link": "https://doi.org/10.1002/agg2.20287",
170+
"policies": {
171+
"policy": "Policy 1",
172+
"dataavail": true,
173+
"datashared": true,
174+
"peerreview": true,
175+
"enforced": "Yes - before application",
176+
"enforcedevidence": "Random String"
177+
178+
}
90179
},
91180
{
92181
"id": 9,
@@ -97,7 +186,18 @@
97186
"journaltype": "AI Journal",
98187
"topic": "Computer Science",
99188
"published": "23 July 2022",
100-
"issn": "issn-615-892543"
189+
"issn": "issn-615-892543",
190+
"updated": "16th Aug 2022",
191+
"link": "https://doi.org/10.1002/agg2.20287",
192+
"policies": {
193+
"policy": "Policy 1",
194+
"dataavail": true,
195+
"datashared": true,
196+
"peerreview": true,
197+
"enforced": "Yes - before application",
198+
"enforcedevidence": "Random String"
199+
200+
}
101201
},
102202
{
103203
"id": 10,
@@ -108,7 +208,18 @@
108208
"journaltype": "RESEARCH ARTICLE",
109209
"topic": "General Computing",
110210
"published": "12 July 2022",
111-
"issn": "issn-615-682456"
211+
"issn": "issn-615-682456",
212+
"updated": "16th Aug 2022",
213+
"link": "https://doi.org/10.1002/agg2.20287",
214+
"policies": {
215+
"policy": "Policy 1",
216+
"dataavail": true,
217+
"datashared": true,
218+
"peerreview": true,
219+
"enforced": "Yes - before application",
220+
"enforcedevidence": "Random String"
221+
222+
}
112223
}
113224
]
114225
}

src/components/AddJournal/AddJournal.js

Lines changed: 58 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-alert */
22
import { React, useState } from 'react';
33
import { Row, Col, Form, Button } from 'react-bootstrap';
4-
import { showSuccessMessage, showErrorMessage } from "../../helpers/alerts"
4+
import { showSuccessMessage, showErrorMessage } from '../../helpers/alerts';
55
import { JournalValidation } from '../../helpers/validate';
66

77
function AddJournal() {
@@ -15,56 +15,62 @@ function AddJournal() {
1515
const [lastYear, setLastYear] = useState('');
1616
const [policyType, setPolicyType] = useState('');
1717
const [domain, setDomain] = useState('');
18-
const [success,setSuccess] = useState("");
19-
const [error,setError]=useState("");
18+
const [success, setSuccess] = useState('');
19+
const [error, setError] = useState('');
2020

21-
const emptyFields=()=>{
22-
setTitle("");
23-
setUrl("");
24-
setIssn("");
25-
setRating("");
26-
setDate("");
27-
setPolicyTitle("");
28-
setFirstYear("");
29-
setLastYear("");
30-
setPolicyType("");
31-
setDomain("");
32-
}
21+
const emptyFields = () => {
22+
setTitle('');
23+
setUrl('');
24+
setIssn('');
25+
setRating('');
26+
setDate('');
27+
setPolicyTitle('');
28+
setFirstYear('');
29+
setLastYear('');
30+
setPolicyType('');
31+
setDomain('');
32+
};
3333
const handleSubmit = (e) => {
3434
e.preventDefault();
35-
setSuccess("");
36-
setError("");
37-
const check = JournalValidation(title, url, issn, rating, policyTitle, firstYear,
38-
lastYear, policyType, domain, date)
39-
if(check){
40-
const policies = {
41-
title: policyTitle,
42-
first_year: firstYear,
43-
last_year: lastYear,
44-
type: policyType,
45-
};
46-
const journal = { title, url, issn, rating, date, policies, domain };
35+
setSuccess('');
36+
setError('');
37+
const check = JournalValidation(
38+
title,
39+
url,
40+
issn,
41+
rating,
42+
policyTitle,
43+
firstYear,
44+
lastYear,
45+
policyType,
46+
domain,
47+
date,
48+
);
49+
if (check) {
50+
const policies = {
51+
title: policyTitle,
52+
first_year: firstYear,
53+
last_year: lastYear,
54+
type: policyType,
55+
};
56+
const journal = { title, url, issn, rating, date, policies, domain };
4757

48-
try{
49-
window.scrollTo(0,0);
50-
fetch('https://journal-policy-tracker.herokuapp.com/api/journals', {
51-
method: 'POST',
52-
headers: { 'Content-Type': 'application/json' },
53-
body: JSON.stringify(journal),
54-
})
55-
emptyFields();
56-
setSuccess("Journal Added Successfuly")
57-
}
58-
catch(err)
59-
{
60-
setError("Cannot Add Journal")
58+
try {
59+
window.scrollTo(0, 0);
60+
fetch('https://journal-policy-tracker.herokuapp.com/api/journals', {
61+
method: 'POST',
62+
headers: { 'Content-Type': 'application/json' },
63+
body: JSON.stringify(journal),
64+
});
65+
emptyFields();
66+
setSuccess('Journal Added Successfuly');
67+
} catch (err) {
68+
setError('Cannot Add Journal');
69+
}
70+
} else {
71+
window.scrollTo(0, 0);
72+
setError('Invalid Input');
6173
}
62-
}
63-
else{
64-
window.scrollTo(0,0);
65-
setError("Invalid Input")
66-
}
67-
6874
};
6975

7076
return (
@@ -84,8 +90,12 @@ function AddJournal() {
8490
</Form.Group>
8591
<Form.Group className='mb-3' controlId='formBasicUrl'>
8692
<Form.Label>URL</Form.Label>
87-
<Form.Control type='text' placeholder='URL'
88-
onChange={(e) => setUrl(e.target.value)} value={url} />
93+
<Form.Control
94+
type='text'
95+
placeholder='URL'
96+
onChange={(e) => setUrl(e.target.value)}
97+
value={url}
98+
/>
8999
</Form.Group>
90100
<Form.Group className='mb-3' controlId='formBasicIssn'>
91101
<Form.Label>ISSN</Form.Label>

src/components/Authentication/FormSuccess.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ const FormSuccess = () => {
1212
);
1313
};
1414

15-
export default FormSuccess;
15+
export default FormSuccess;

0 commit comments

Comments
 (0)