Skip to content

Commit 5f6b56f

Browse files
committed
integrate edit page
1 parent 446a56c commit 5f6b56f

File tree

13 files changed

+338
-362
lines changed

13 files changed

+338
-362
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"react-router-dom": "^5.3.3",
3030
"react-scripts": "4.0.3",
3131
"react-switch": "^7.0.0",
32+
"react-user-profile": "^1.0.3",
3233
"styled-components": "^5.3.5",
3334
"web-vitals": "^1.0.1"
3435
},

src/App.js

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import './index.css';
1212
import 'bootstrap/dist/css/bootstrap.min.css';
1313
import { BrowserRouter as Router, Switch, Route, Redirect, useHistory } from 'react-router-dom';
1414
import { format } from 'date-fns';
15+
import Profile from './components/Authentication/User-Profile/useprofile';
1516
import { api } from './api/posts';
1617
import { Journal, Contact, Manifesto, Home } from './pages';
1718
import { Footer, Auth, Header, Login, JournalDetails, AddJournal, Layout } from './components';
@@ -69,6 +70,10 @@ function App() {
6970
<Route path='/Login'>
7071
<Login />
7172
</Route>
73+
<Route path='/profile'>
74+
<Profile />
75+
</Route>
76+
7277
<Redirect to='/' />
7378
</Switch>
7479
<Footer />

src/components/AddJournal/AddJournal.js

+10-26
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,16 @@ const AddJournal = () => {
4040
const [dataavail, setDataavail] = useState(false);
4141
const [datashared, setDatashared] = useState(false);
4242
const [peerreview, setPeerreview] = useState(false);
43-
const [enforced, setEnforced] = useState('');
43+
const [enforced, setEnforced] = useState('YES');
4444
const [evidence, setEvidence] = useState('');
4545
const [policyTitle, setPolicyTitle] = useState('');
46-
// const [firstYear] = useState(2000);
46+
const [firstYear, setFirstYear] = useState();
4747

4848
const [createJournal, { data, error }] = useMutation(CREATE_JOURNAL);
4949

5050
console.log({ data });
5151
// console.log(createJournal);
52+
const history = useHistory();
5253

5354
const addJournal = async (event) => {
5455
event.preventDefault();
@@ -67,11 +68,12 @@ const AddJournal = () => {
6768
isDataAvailabilityStatementPublished: dataavail,
6869
isDataShared: datashared,
6970
isDataPeerReviewed: peerreview,
70-
firstYear: 2000,
71+
firstYear,
7172
},
7273
},
7374
},
7475
});
76+
history.push('/journal');
7577
};
7678

7779
const handleChangeData = (nextChecked) => {
@@ -117,28 +119,10 @@ const AddJournal = () => {
117119
</div>
118120
</FirstDiv>
119121
<FirstDiv>
120-
{/* <div>
121-
<Label>Domain</Label>
122-
<Input
123-
type='text'
124-
required
125-
value={topic}
126-
onChange={(e) => setTopic(e.target.value)}
127-
/>
128-
</div> */}
129122
<div>
130123
<Label>Source</Label>
131124
<Input type='text' required value={link} onChange={(e) => setLink(e.target.value)} />
132125
</div>
133-
{/* <div>
134-
<Label>Authors</Label>
135-
<Input
136-
type='text'
137-
required
138-
value={authors}
139-
onChange={(e) => setAuthors(e.target.value)}
140-
/>
141-
</div> */}
142126
</FirstDiv>
143127
<Subhead>
144128
<Icon>
@@ -148,15 +132,15 @@ const AddJournal = () => {
148132
</Subhead>
149133
<Div>
150134
<SecondDiv>
151-
{/* <div>
135+
<div>
152136
<Label>First Year</Label>
153137
<Input
154-
type='text'
138+
type='number'
155139
required
156-
value={policyTitle}
157-
onChange={(e) => setPolicyTitle(e.target.value)}
140+
value={firstYear}
141+
onChange={(e) => setFirstYear(parseInt(e.target.value, 10))}
158142
/>
159-
</div> */}
143+
</div>
160144
<div>
161145
<Label>Policy Title</Label>
162146
<Input
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { useMutation } from '@apollo/client';
3+
import LOGOUT from '../../../graphql/mutation/LOGOUT';
4+
5+
function Logout() {
6+
const [logout, { data, error }] = useMutation(CREATE_JOURNAL);
7+
8+
logoutUser
9+
return (
10+
<>
11+
<div>Logout</div>
12+
<button onClick={}>Logout</button>
13+
</>
14+
);
15+
}
16+
17+
export default Logout;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import UserProfile from 'react-user-profile';
3+
import { useQuery } from '@apollo/client';
4+
import GET_USER from '../../../graphql/queries/GET_USER';
5+
6+
function Profile() {
7+
const { data } = useQuery(GET_USER);
8+
9+
console.log(data);
10+
11+
const photo =
12+
// eslint-disable-next-line max-len
13+
'https://api-cdn.spott.tv/rest/v004/image/images/e91f9cad-a70c-4f75-9db4-6508c37cd3c0?width=587&height=599';
14+
const userName = 'Harvey Specter';
15+
const location = 'New York, USA';
16+
return (
17+
<div style={{ width: '100%', marginTop: '5rem' }}>
18+
<UserProfile photo={photo} userName={userName} location={location} />
19+
</div>
20+
);
21+
}
22+
23+
export default Profile;

0 commit comments

Comments
 (0)