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

Adds ParticipantsView & Route #61

Merged
merged 3 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/Content/ParticipantList/Participant/Participant.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#participant-list {
display: flex;
flex-flow: row wrap;
}

.participant-ctn {
color: #d6d6d6;
padding: 0.5em;
}

.participant-avatar {
height: 75px;
width: 75px;
border: 1px solid #666666;
border-radius: 5px;
vertical-align: center;
text-align: center;
}

.participant-name {
text-align: center;
}
12 changes: 12 additions & 0 deletions src/components/Content/ParticipantList/Participant/Participant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

const Participant = ({ username }) => {
return <div className="participant-ctn">
<div className="participant-avatar"></div>
<div className="participant-name">
{username}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Moe-Shoman Let's make a User widget, or Member widget, and use it all over the place -- when we show users' usernames in ^^this^^, when users are mentioned in LeapChat (and we render the markdown to HTML that includes this widget), when a user is mentioned in the description/deliverables of a task, etc.

</div>
</div>
};

export default Participant;
38 changes: 38 additions & 0 deletions src/components/Content/ParticipantList/ParticipantList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { connect } from 'react-redux';

import { getUsers } from "../../../actions";
import Participant from './Participant/Participant';
import './Participant/Participant.css'

class ParticipantList extends React.Component {
componentWillMount() {
const { getUsers } = this.props;
getUsers();
}

renderList() {
const { users } = this.props;
const participants = [];

for(const key in users) {
const { username } = users[key];
participants.push(<Participant key={username} username={username} />);
}

return participants;
}

render() {
return <div className="content-ctn">
<div id="participant-list">
{this.renderList()}
</div>
</div>
}
}

export default connect(({ pursuances, currentPursuanceId, users }) =>
({ pursuances, currentPursuanceId, users }), {
getUsers
})(ParticipantList);
2 changes: 2 additions & 0 deletions src/components/Pursuance/PursuancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import PursuanceMenu from './PursuanceMenu';
import TaskListView from './views/TaskListView';
import DiscussView from './views/DiscussView';
import './PursuancePage.css';
import ParticipantsView from "./views/ParticipantsView";

class PursuancePage extends Component {

Expand All @@ -27,6 +28,7 @@ class PursuancePage extends Component {
<Route exact path="/pursuance/:pursuanceId" component={TaskListView} />
<Route exact path="/pursuance/:pursuanceId/tasks" component={TaskListView} />
<Route exact path="/pursuance/:pursuanceId/discuss" component={DiscussView} />
<Route exact path="/pursuance/:pursuanceId/participants" component={ParticipantsView} />
</Switch>
</article>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/components/Pursuance/views/ParticipantsView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import ParticipantList from '../../Content/ParticipantList/ParticipantList';

const ParticipantsView = ({ match: { params: { pursuanceId } } }) => {
return (
<ParticipantList pursuanceId={pursuanceId} />
)
};

export default ParticipantsView;