This repository has been archived by the owner on Oct 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tools > People > Following page (#671)
- Added PeopleToolPage. - Refactored tool stylesheets.
- Loading branch information
Showing
15 changed files
with
398 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React from 'react'; | ||
import { Link } from 'react-router'; | ||
|
||
import { | ||
Immutable as ImmutablePropType | ||
} from '../../prop-types/common'; | ||
import Avatar from '../user/avatar'; | ||
import FollowButton from '../follow-button'; | ||
|
||
|
||
export default function UserDetails({ current_user, following, triggers, user }) { | ||
if (!user) { | ||
return null; | ||
} | ||
|
||
const firstName = user.getIn(['more', 'firstName']) || ''; | ||
const lastName = user.getIn(['more', 'lastName']) || ''; | ||
const fullName = `${firstName} ${lastName}`; | ||
|
||
if (user) { | ||
return ( | ||
<div className="tools_page__details_col"> | ||
<div className="tools_details"> | ||
<div className="tools_details__left_col"> | ||
<Avatar isRound={false} size={140} user={user.toJS()} /> | ||
</div> | ||
<div> | ||
<Link className="tools_details__title" to={`/user/${user.get('username')}`}> | ||
{user.get('username')} | ||
</Link> | ||
<div className="tools_details__description"> | ||
{fullName} | ||
</div> | ||
<FollowButton | ||
active_user={current_user.toJS()} | ||
following={following.toJS()} | ||
triggers={triggers} | ||
user={user.toJS()} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
UserDetails.propTypes = { | ||
current_user: ImmutablePropType(FollowButton.propTypes.active_user), | ||
following: ImmutablePropType(FollowButton.propTypes.following), | ||
triggers: FollowButton.propTypes.triggers, | ||
user: ImmutablePropType(FollowButton.propTypes.user) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { PropTypes } from 'react'; | ||
|
||
import { | ||
uuid4 as uuid4PropType, | ||
Immutable as ImmutablePropType | ||
} from '../../prop-types/common'; | ||
import { | ||
ArrayOfUsers as ArrayOfUsersPropType | ||
} from '../../prop-types/users'; | ||
import Avatar from '../user/avatar'; | ||
|
||
|
||
export default function UserList({ onClick, users, selectedUserId }) { | ||
const items = users.map((user, index) => { | ||
const handleClick = () => onClick(user.get('id')); | ||
let className = 'tools_item tools_item-clickable'; | ||
if (user.get('id') === selectedUserId) { | ||
className += ' tools_item-selected'; | ||
} | ||
|
||
return ( | ||
<div | ||
className={className} | ||
key={index} | ||
onClick={handleClick} | ||
> | ||
<Avatar size={23} user={user.toJS()} /> | ||
<span className="tools_item__child-padded">{user.get('username')}</span> | ||
</div> | ||
); | ||
}); | ||
|
||
return ( | ||
<div className="tools_page__list_col"> | ||
{items} | ||
</div> | ||
); | ||
} | ||
|
||
UserList.propTypes = { | ||
onClick: PropTypes.func.isRequired, | ||
selectedUserId: uuid4PropType, | ||
users: ImmutablePropType(ArrayOfUsersPropType).isRequired | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
// The details window for items on tool pages. | ||
.tools_details { | ||
@space: 20px; | ||
@doubleSpace: @space * 2; | ||
@subtextColor: #888; | ||
|
||
display: flex; | ||
padding: 40px; | ||
background-color: white; | ||
border-bottom: 2px solid #EDEDED; | ||
|
||
&__title { | ||
display: block; | ||
margin-bottom: @space; | ||
} | ||
|
||
&__description { | ||
color: @subtextColor; | ||
margin-bottom: @space; | ||
} | ||
|
||
&__left_col { | ||
margin-right: @doubleSpace; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
// Visual block used in item lists on tool pages. | ||
.tools_item { | ||
@space: 20px; | ||
|
||
display: flex; | ||
margin-bottom: 15px; | ||
padding: @space; | ||
background-color: white; | ||
border-bottom: 2px solid #EDEDED; | ||
|
||
&-selected { | ||
background: #FD9315; | ||
color: white; | ||
} | ||
|
||
&-clickable { | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
&__child-padded { | ||
margin-left: @space; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.