Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ahmed enawy patch 3 #58

Open
wants to merge 8 commits into
base: react_dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/components/RecommendTask.jsx
Original file line number Diff line number Diff line change
@@ -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 =
"http://localhost:8080/api/users/records/" +
this.state.email +
"/recommendations";
window.location.replace(RecommendTaskUrl);
};
render() {
return (
<div>
<button
type="button"
className="btn btn-success"
onClick={this.getRecommendedTasks.bind(this)}
>
Recomend Task!
</button>
</div>
);
}
}

export default RecommendTask;
10 changes: 9 additions & 1 deletion src/components/email.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<span className="Email text-muted font-weight-bold font-italic">
Email:
Email:{email}
</span>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/masterclassess.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from "react";
class MasterClassess extends Component {
class MasterClassessLink extends Component {
render() {
return (
<div>
Expand All @@ -11,4 +11,4 @@ class MasterClassess extends Component {
}
}

export default MasterClassess;
export default MasterClassessLink;
46 changes: 41 additions & 5 deletions src/components/profilePage.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
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 MasterClassessLink from "./masterclassess";
import RecommendTask from "./recommendTaskbutton";
import Axios from "axios";
class ProfilePage extends Component {
constructor(props) {
super(props);
this.state = {
FullName: "Ahmed",
email: props.email, // it should be passed from the login component,
tasks: [],
user: null,
masterclassess: []
};
}
getTasksfromDb() {
Axios.get("http://localhost:8080/api/tasks/")
.then(res => res)
.then(data => this.setState({ tasks: data }));
}
getUserfromDb() {
Axios.get("http://localhost:8080/api/users/records/" + this.state.email)
.then(res => res)
.then(data => this.setState({ user: data.user }));
}
getMasterClassesFromDb() {
Axios.get("http://localhost:8080/api/masterclasses")
.then(res => res)
.then(data => this.setState({ masterclassess: data.masterclassess }));
}
componentDidMount() {
this.getUserfromDb();
this.getMasterClassesFromDb();
this.getTasksfromDb();
this.setState({FullName})
}
render() {
const { FullName, email, MasterClassess, tasks, user } = this.state;
return (
<div>
<ProfilePic />
<Fullname />
<Email />
<Fullname name={FullName} />
<Email email={email} />
<Skills />
<Tasks />
<MasterClassess />
<MasterClassessLink masterclassess={MasterClassess} />
<Edit />
<p />
<RecommendTask email={email} />
</div>
);
}
Expand Down