From 94e33dfcfd2bfe4682528ff05e098bdcceef6d16 Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Sun, 14 Apr 2019 16:39:17 +0200 Subject: [PATCH 1/8] Update email.jsx --- src/components/email.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/email.jsx b/src/components/email.jsx index 1005a61..0210e00 100644 --- a/src/components/email.jsx +++ b/src/components/email.jsx @@ -1,10 +1,18 @@ import React, { Component } from "react"; class Email extends Component { + constructor(props) { + super(props); + this.state = { + email: props.email + }; + } + render() { + const { email } = this.state; return (
- Email: + Email:{email}
); From 882f1bccbad9c6a4af4c96b482017bfb218c2aeb Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Sun, 14 Apr 2019 16:45:42 +0200 Subject: [PATCH 2/8] Update profilePage.jsx --- src/components/profilePage.jsx | 47 ++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/components/profilePage.jsx b/src/components/profilePage.jsx index bceed90..216ceac 100644 --- a/src/components/profilePage.jsx +++ b/src/components/profilePage.jsx @@ -1,23 +1,60 @@ import React, { Component } from "react"; import "bootstrap/dist/css/bootstrap.css"; import Edit from "./edit"; -import MasterClassess from "./masterclassess"; -import Tasks from "./tasks"; import Email from "./email"; +import Tasks from "./tasks"; import ProfilePic from "./uploadProfilePic"; import Fullname from "./fullName"; import Skills from "./skills"; +import RecommendTask from "./recommendTaskbutton"; +import Axios from "axios"; class ProfilePage extends Component { + constructor(props) { + super(props); + this.state = { + firstName:null, + middleName:null, + lastName:null, + FullName: firstName+" "+" "+middleName+" "+lastName+" ", + email: props.email, // it should be passed from the login component, + tasks: [], + user: null, + masterclassess: [] + }; + } + getTasksfromDb() { + Axios.get(""api/tasks/") + .then(res => res) + .then(data => this.setState({ tasks: data })); + } + getUserfromDb() { + Axios.get("api/users/records/" + this.state.email) + .then(res => res) + .then(data => this.setState({ user: data.user })); + } + getMasterClassesFromDb() { + Axios.get("api/masterclasses") + .then(res => res) + .then(data => this.setState({ masterclassess: data.masterclassess })); + } + componentDidMount() { + this.getUserfromDb(); + this.getMasterClassesFromDb(); + this.getTasksfromDb(); + } render() { + const { FullName, email, MasterClassess, tasks, user } = this.state; return (
- - + + - + +

+

); } From 32415941625e127798e0a53ba37a7101cc98fd5b Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:08:19 +0200 Subject: [PATCH 3/8] Update profilePage.jsx --- src/components/profilePage.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/profilePage.jsx b/src/components/profilePage.jsx index 216ceac..b3c6dcd 100644 --- a/src/components/profilePage.jsx +++ b/src/components/profilePage.jsx @@ -6,16 +6,14 @@ import Tasks from "./tasks"; import ProfilePic from "./uploadProfilePic"; import Fullname from "./fullName"; import Skills from "./skills"; +import MasterClassessLink from "./masterclassess"; import RecommendTask from "./recommendTaskbutton"; import Axios from "axios"; class ProfilePage extends Component { constructor(props) { super(props); this.state = { - firstName:null, - middleName:null, - lastName:null, - FullName: firstName+" "+" "+middleName+" "+lastName+" ", + FullName: "Ahmed", email: props.email, // it should be passed from the login component, tasks: [], user: null, @@ -41,6 +39,7 @@ class ProfilePage extends Component { this.getUserfromDb(); this.getMasterClassesFromDb(); this.getTasksfromDb(); + this.setState({FullName}) } render() { const { FullName, email, MasterClassess, tasks, user } = this.state; @@ -51,7 +50,7 @@ class ProfilePage extends Component { - +

From c1f434269eabaaf7c251ccc0af75478006b53f2d Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:10:24 +0200 Subject: [PATCH 4/8] Create RecommendTask.jsx --- src/components/RecommendTask.jsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/components/RecommendTask.jsx diff --git a/src/components/RecommendTask.jsx b/src/components/RecommendTask.jsx new file mode 100644 index 0000000..4070961 --- /dev/null +++ b/src/components/RecommendTask.jsx @@ -0,0 +1,31 @@ +import React from "react"; +class RecommendTask extends React.Component { + constructor(props) { + super(props); + this.state = { + email: props.email + }; + } + getRecommendedTasks = () => { + var RecommendTaskUrl = + "api/users/records/" + + this.state.email + + "/recommendations"; + window.location.replace(RecommendTaskUrl); + }; + render() { + return ( +

+ +
+ ); + } +} + +export default RecommendTask; From 2aabefd319af573932c0bdefcb0e8b9d9554aa58 Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:11:08 +0200 Subject: [PATCH 5/8] Update masterclassess.jsx --- src/components/masterclassess.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/masterclassess.jsx b/src/components/masterclassess.jsx index 3d0a4c1..ed846a1 100644 --- a/src/components/masterclassess.jsx +++ b/src/components/masterclassess.jsx @@ -1,5 +1,5 @@ import React, { Component } from "react"; -class MasterClassess extends Component { +class MasterClassessLink extends Component { render() { return (
@@ -11,4 +11,4 @@ class MasterClassess extends Component { } } -export default MasterClassess; +export default MasterClassessLink; From f5e68aebf1bf305be740f60bca9fd7181fc4bb3b Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Mon, 15 Apr 2019 18:08:44 +0200 Subject: [PATCH 6/8] Update profilePage.jsx --- src/components/profilePage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/profilePage.jsx b/src/components/profilePage.jsx index b3c6dcd..7894d80 100644 --- a/src/components/profilePage.jsx +++ b/src/components/profilePage.jsx @@ -21,7 +21,7 @@ class ProfilePage extends Component { }; } getTasksfromDb() { - Axios.get(""api/tasks/") + Axios.get("http://localhost:8080/api/tasks/") .then(res => res) .then(data => this.setState({ tasks: data })); } From 42dde884233a2c855248456f98e46f40a3a2780d Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Mon, 15 Apr 2019 18:09:25 +0200 Subject: [PATCH 7/8] Update RecommendTask.jsx --- src/components/RecommendTask.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/RecommendTask.jsx b/src/components/RecommendTask.jsx index 4070961..b04bb38 100644 --- a/src/components/RecommendTask.jsx +++ b/src/components/RecommendTask.jsx @@ -8,7 +8,7 @@ class RecommendTask extends React.Component { } getRecommendedTasks = () => { var RecommendTaskUrl = - "api/users/records/" + + "http://localhost:8080/api/users/records/" + this.state.email + "/recommendations"; window.location.replace(RecommendTaskUrl); From b1da288206a1dac3cb62b95f2fcfbf6458a4e5b9 Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <47159033+ahmed-enawy@users.noreply.github.com> Date: Mon, 15 Apr 2019 18:10:12 +0200 Subject: [PATCH 8/8] Update profilePage.jsx --- src/components/profilePage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/profilePage.jsx b/src/components/profilePage.jsx index 7894d80..d136544 100644 --- a/src/components/profilePage.jsx +++ b/src/components/profilePage.jsx @@ -26,12 +26,12 @@ class ProfilePage extends Component { .then(data => this.setState({ tasks: data })); } getUserfromDb() { - Axios.get("api/users/records/" + this.state.email) + Axios.get("http://localhost:8080/api/users/records/" + this.state.email) .then(res => res) .then(data => this.setState({ user: data.user })); } getMasterClassesFromDb() { - Axios.get("api/masterclasses") + Axios.get("http://localhost:8080/api/masterclasses") .then(res => res) .then(data => this.setState({ masterclassess: data.masterclassess })); }