Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Add roles section to UserDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
voidxnull committed Nov 13, 2016
1 parent 3e16340 commit 56b9cc5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/tools/user-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from '../../prop-types/common';
import Avatar from '../user/avatar';
import FollowButton from '../follow-button';
import UserRoles from './user-roles';


export default function UserDetails({ current_user, following, triggers, user }) {
Expand Down Expand Up @@ -52,6 +53,7 @@ export default function UserDetails({ current_user, following, triggers, user })
{user.getIn(['more', 'bio'])}
</div>
}
<UserRoles roles={user.getIn(['user', 'more', 'roles'])} />
<FollowButton
active_user={current_user}
following={following}
Expand Down
35 changes: 35 additions & 0 deletions src/components/tools/user-roles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
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';


export default function UserRoles({ roles }) {
if (!roles || !roles.size) {
return null;
}

const roleElements = roles.map(role => (
<span key={role.get('id')} title={role.get('description')}>{role.get('title')}</span>
));

return (
<div>
{roleElements}
</div>
);
}

0 comments on commit 56b9cc5

Please sign in to comment.