Skip to content

Commit

Permalink
Merge pull request #19 from yannick1691/dev
Browse files Browse the repository at this point in the history
Added Profile and Edit profile
  • Loading branch information
Yannick authored Nov 22, 2017
2 parents 61c3abd + 24cd9dd commit 3eb3eae
Show file tree
Hide file tree
Showing 15 changed files with 522 additions and 54 deletions.
Binary file removed assets/img/boardshowcase.jpg
Binary file not shown.
Binary file removed assets/img/boardshowcase@0,1x.jpg
Binary file not shown.
Binary file removed assets/img/boardshowcase@0,25x.jpg
Binary file not shown.
Binary file removed assets/img/boardshowcase@0,5x.jpg
Binary file not shown.
Binary file removed assets/img/boardshowcase@0,75x.jpg
Binary file not shown.
16 changes: 13 additions & 3 deletions components/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { h, Component } from 'preact';
import { Router } from 'preact-router';
import NotifyChange from 'preact-notify-change';

import Header from './header';
import Home from '../routes/home';
Expand All @@ -11,6 +12,7 @@ import Teams from '../routes/Teams';
import firebase from 'firebase/app';
require('firebase/auth');
import fireApp from '../base2';
import Edit from '../routes/edit/index';

const github = new firebase.auth.GithubAuthProvider();
github.addScope('user:email');
Expand All @@ -33,7 +35,8 @@ export default class App extends Component {
uid: null,
owner: null,
username: null,
userProfilePic: null
userProfilePic: null,
email: null
};
}

Expand Down Expand Up @@ -65,7 +68,7 @@ export default class App extends Component {
logout() {
// base.unauth();
firebase.auth(fireApp).signOut();
this.setState({ uid: null, username: null, userProfilePic: null });
this.setState({ uid: null, username: null, userProfilePic: null, email: null });
}

authHandler(err, authData) {
Expand Down Expand Up @@ -94,6 +97,7 @@ export default class App extends Component {
owner: data.owner || authData.user.uid,
username: authData.user.displayName,
userProfilePic: authData.user.photoURL,
email: authData.user.email
});
});

Expand All @@ -112,7 +116,9 @@ export default class App extends Component {
<Router onChange={this.handleRoute}>
<Home path="/" />
<Profile path="/profile/" user="me" />
<Profile path="/profile/:user" />
<Profile path="/profile/:user"
uid={this.state.uid}
/>
<Team path="/team/" teamName="test" />
<Team path="/team/:teamName" uid={this.state.uid} />
<Team path="/team/:teamName/board/:boardName" uid={this.state.uid} />
Expand All @@ -123,8 +129,12 @@ export default class App extends Component {
github={github}
uid={this.state.uid}
/>
<Edit path="/profile/:user/edit"
uid={this.state.uid}
/>
<Teams path="/teams" uuid={this.state.uid} />
</Router>
<NotifyChange />
</div>
);
}
Expand Down
3 changes: 1 addition & 2 deletions components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default class Header extends Component {
return (
<div class={style.headWrap}>
<nav>
<Link activeClassName={style.activeBoard} href={`/teams`}>teams</Link>
<Link>add to team</Link>
<UserMenu
username={this.props.username}
userProfilePic={this.props.userProfilePic}
logout={this.props.logout}
uid={this.props.uid}
/>
</nav>
</div>
Expand All @@ -37,7 +37,6 @@ export default class Header extends Component {
<div class={style.headWrap}>
<nav>
<Link activeClassName={style.active} href="/">start</Link>
<Link activeClassName={style.active} href="/profile">Me</Link>
<Link activeClassName={style.active} href="/login">login</Link>
</nav>
</div>
Expand Down
43 changes: 42 additions & 1 deletion components/header/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
padding-left: 15px;
}

.headWrap nav a div div ul a p{
padding-left: 15px;
margin: 10px 0;
}

.headWrap nav a div div ul li{
transition: all .3s ease;
background: #fff;
Expand All @@ -76,4 +81,40 @@
.header nav a.active {
background: #320b86;
color: #ffffff;
}
}

.headWrap nav a div div ul a{
position: relative;
padding: 0 16px;
margin: 0;
outline: none;
color: inherit;
text-decoration: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 1rem;
font-weight: 400;
letter-spacing: 0.04em;
line-height: 1.75rem;
text-decoration: inherit;
text-transform: inherit;
color: rgb(0,0,0);
display: flex;
width: 100%;
height: 100%;
align-items: center;
pointer-events: all;
transition: all .3s ease;
background: #fff;
}

.headWrap nav a div div ul a:hover{
background-color: #f3f3f3;
color: rgb(0,0,0);
}

15 changes: 8 additions & 7 deletions components/statusComp/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Wrapper */
.statusComp{
background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%);
/* background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%); */
background: linear-gradient(75deg ,#7028E4 -30%, #4776E6 120%);
display: block;
width: calc(100% - 30px);
margin: 15px;
Expand Down Expand Up @@ -68,26 +69,26 @@
}

.progBar span.done{
background: rgb(0, 200, 117);
background: rgb(128, 255, 202);
}

.progBar span.readyForTesting{
background: rgb(0, 134, 192);
background: rgb(111, 212, 252);
}
.progBar span.workingOnIt{
background: rgb(253, 171, 61);
}
.progBar span.workNeeded{
background: rgb(162, 93, 220);
background: rgb(202, 141, 255);
}
.progBar span.needHelp{
background: rgb(226, 68, 92);
background: rgb(255, 120, 143);
}
.progBar span.toDo{
background: rgb(196, 196, 196);
background: rgb(245, 255, 192);
}
.progBar span.cancelled{
background: rgb(160, 0, 55);
background: rgb(255, 81, 142);
}


Expand Down
19 changes: 11 additions & 8 deletions components/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import 'preact-material-components/List/style.css';
import 'preact-material-components/Menu/style.css';
import 'preact-material-components/Button/style.css';
import style from './style';
import { Router } from 'preact-router';
import { Link } from 'preact-router';

export default class UserMenu extends Component {

render() {
return (
<a style={`padding: 0;`}>
Expand All @@ -30,23 +33,23 @@ export default class UserMenu extends Component {
open-from-top-right
class={style.boooooi}
>
<Menu.Item>
<Link class={style.link} href={`/profile/${this.props.uid}`}>
<i className="material-icons">account_circle</i>
<p>profile</p>
</Menu.Item>
<Menu.Item>
</Link>
<Link class={style.link} href={`/profile/${this.props.uid}/edit`}>
<i className="material-icons">account_circle</i>
<p>edit profile</p>
</Menu.Item>
<Menu.Item>
</Link>
<Link class={style.link} href={`/teams`}>
<i className="material-icons">account_circle</i>
<p>teams</p>
</Menu.Item>
</Link>
<li role="separator" class="mdc-list-divider"></li>
<Menu.Item>
<Link class={style.link} href={`/settings`}>
<i className="material-icons">account_circle</i>
<p>settings</p>
</Menu.Item>
</Link>
<Menu.Item onclick={this.props.logout}>
<i className="material-icons">account_circle</i>
<p>logout</p>
Expand Down
28 changes: 28 additions & 0 deletions components/user/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,32 @@ a.boooi{

div.boooooi{
top: 50px !important;
}

ul a.link{
position: relative;
padding: 0 16px;
outline: none;
color: inherit;
text-decoration: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 1rem;
font-weight: 400;
letter-spacing: 0.04em;
line-height: 1.75rem;
text-decoration: inherit;
text-transform: inherit;
color: rgb(0,0,0);
display: flex;
width: 100%;
height: 100%;
align-items: center;
pointer-events: all;
/* margin: 0; */
}
124 changes: 124 additions & 0 deletions routes/edit/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import { h, Component } from 'preact';
import style from './style';
import base from '../../base';

export default class Edit extends Component {
constructor(props) {
super(props);

this.handleChange = this.handleChange.bind(this);
this.updateUser = this.updateUser.bind(this);

this.state = {
user: {},
friends: {}
};
}

componentWillMount(nextProps) {
this.ref = base.syncState(`users/${this.props.user}`, {
context: this,
state: 'user'
});
this.ref2 = base.syncState(`users/${this.props.user}/friends`, {
context: this,
state: 'friends'
});
}

componentWillUnmount() {
base.removeBinding(this.ref);
base.removeBinding(this.ref2);
}

// Function to update User.
updateUser(updatedUser) {
let user = { ...this.state.user };
user = updatedUser;
this.setState({ user });
}

// Function to handle change.
handleChange(e) {
const userData = this.state.user;
const updatedUser = {
...userData,
[e.target.name]: e.target.value
};
this.updateUser(updatedUser);
}

// Note: `user` comes from the URL, courtesy of our router
render({ user }) {
return (
<div class={style.profile}>
<div class={style.profileWrap}>
<div class={style.profileDesc}>
<div class={style.inputGroup}>
<input
class={style.editProfileInput}
name="name"
placeholder="Display name"
value={this.state.user.name}
onChange={(e) => this.handleChange(e)}
id="name"
/>
<label for="name">Display name</label>
</div>
<div class={style.inputGroup}>
<input
class={style.editProfileInput}
placeholder="Your function / Title"
name="functie"
value={this.state.user.functie}
onChange={(e) => this.handleChange(e)}
id="function"
/>
<label for="function">Your function / Title</label>
</div>
<div class={style.inputGroup}>
<input
class={style.editProfileInput}
placeholder="[email protected]"
name="email"
value={this.state.user.email}
onChange={(e) => this.handleChange(e)}
id="email"
/>
<label for="email">Your email</label>
</div>
<div class={style.inputGroup}>
<input
class={style.editProfileInput}
placeholder="06 xxxx xxxx"
name="phone"
value={this.state.user.phone}
onChange={(e) => this.handleChange(e)}
id="number"
/>
<label for="number">Your number</label>
</div>
<div class={style.inputGroup}>
<textarea
placeholder="Your bio, describe yourself here"
class={style.editProfileInput}
onChange={(e) => this.handleChange(e)}
name="bio"
rows="8"
cols="40"
maxlength="150"
id="bio"
>
{this.state.user.bio}
</textarea>
<label for="bio">Your bio</label>
</div>
</div>
<div class={style.profilePicWrap}>
<img class={style.profilePic} src={this.state.user.profilePic} />
</div>
</div>
</div>
);
}
}
Loading

0 comments on commit 3eb3eae

Please sign in to comment.