Skip to content
This repository was archived by the owner on Feb 7, 2020. It is now read-only.

remove room #74

Open
wants to merge 2 commits into
base: master
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: 18 additions & 13 deletions src/components/UserList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ import React from 'react'
import style from './index.module.css'

export const UserList = ({ room, current, createConvo, removeUser }) => (
<ul className={style.component}>
{room.users.map(user => (
<li
key={user.id}
className={user.presence.state === 'online' ? style.online : null}
onClick={e => createConvo({ user })}
style={{ order: user.presence.state === 'online' && -1 }}
>
<img src={user.avatarURL} alt={user.name} />
<p>{user.name}</p>
</li>
))}
</ul>
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect indentation

<button onClick={e => removeUser(room)}>
<span>Leave Room</span>
</button>
<ul className={style.component}>
{room.users.map(user => (
<li
key={user.id}
className={user.presence.state === 'online' ? style.online : null}
onClick={e => createConvo({ user })}
style={{ order: user.presence.state === 'online' && -1 }}
>
<img src={user.avatarURL} alt={user.name} />
<p>{user.name}</p>
</li>
))}
</ul>
</div>
)
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ class View extends React.Component {
this.actions.scrollToEnd()
},

removeRoom: room => this.setState({ room: {} }),
removeRoom: room => {
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect indentation

this.state.user.leaveRoom({
roomId: room.id,
})
this.setState({ room: {} })
},

joinRoom: room => {
this.actions.setRoom(room)
Expand Down Expand Up @@ -221,7 +226,7 @@ class View extends React.Component {
sidebarOpen,
userListOpen,
} = this.state
const { createRoom, createConvo, removeUserFromRoom } = this.actions
const { createRoom, createConvo/*, removeUserFromRoom*/ } = this.actions
Copy link
Contributor

Choose a reason for hiding this comment

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

remove commented code or add todo comment


return (
<main>
Expand Down Expand Up @@ -255,7 +260,7 @@ class View extends React.Component {
room={room}
current={user.id}
createConvo={createConvo}
removeUser={removeUserFromRoom}
removeUser={this.actions.removeRoom}
/>
)}
</row->
Expand Down