Skip to content

Commit

Permalink
Fix displaying 'all' and 'add' buttons on chat with users; fix org na…
Browse files Browse the repository at this point in the history
…me displaying
  • Loading branch information
terrysahaidak committed Mar 27, 2016
1 parent e9998c4 commit d20bad6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
16 changes: 12 additions & 4 deletions app/components/RoomInfo/RoomInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@ import Divider from '../Divider'
const RoomInfo = ({name}) => {
const avatarSrc = createGhAvatarLink(name.split('/')[0], 200)
const channel = channelNameAndOwner(name)

return (
<View style={s.container}>
<View style={s.header}>
<Avatar
src={avatarSrc}
size={50} />
<View style={s.headerTextContainer}>
<Text style={s.name}>{channel.name}</Text>
<Text style={s.owner}>by {channel.owner}</Text>
</View>
{!channel.name
? (
<View style={s.headerTextContainer}>
<Text style={s.name}>{channel.owner}</Text>
</View>
) : (
<View style={s.headerTextContainer}>
<Text style={s.name}>{channel.name}</Text>
<Text style={s.owner}>by {channel.owner}</Text>
</View>
)}
</View>
<Divider />
</View>
Expand Down
34 changes: 19 additions & 15 deletions app/components/RoomInfo/RoomUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Avatar from '../Avatar'
import Heading from '../Heading'
import Button from '../Button'

const RoomUsers = ({ids, entities, onPress, userCount, onAllUsersPress}) => {
const RoomUsers = ({ids, entities, onPress, userCount, onAllUsersPress, oneToOne}) => {
const displayUserHeader = oneToOne === true ? 'People' : `People (${userCount})`
let content = []

if (ids.length >= 30) {
Expand Down Expand Up @@ -48,22 +49,24 @@ const RoomUsers = ({ids, entities, onPress, userCount, onAllUsersPress}) => {
return (
<View style={s.container}>
<Heading
text={`People (${userCount})`} />
text={displayUserHeader} />
<View style={s.usersContainer}>
{content}
</View>
<View style={s.buttonsGroup}>
<Button
onPress={() => {}}
styles={[s.button, s.primaryButton]}>
<Text>Add</Text>
</Button>
<Button
onPress={() => onAllUsersPress()}
styles={s.button}>
<Text>See all</Text>
</Button>
</View>
{!oneToOne && (
<View style={s.buttonsGroup}>
<Button
onPress={() => {}}
styles={[s.button, s.primaryButton]}>
<Text>Add</Text>
</Button>
<Button
onPress={() => onAllUsersPress()}
styles={s.button}>
<Text>See all</Text>
</Button>
</View>
)}
</View>
)
}
Expand All @@ -73,7 +76,8 @@ RoomUsers.propTypes = {
entities: PropTypes.object,
onPress: PropTypes.func,
userCount: PropTypes.number,
onAllUsersPress: PropTypes.func
onAllUsersPress: PropTypes.func,
oneToOne: PropTypes.bool
}

export default RoomUsers
1 change: 1 addition & 0 deletions app/screens/RoomInfoScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class RoomInfoScreen extends Component {
const {users, rooms, route: {roomId}} = this.props
return (
<RoomUsers
oneToOne={rooms[roomId].githubType === 'ONETOONE' ? true : false}
userCount={rooms[roomId].userCount}
ids={users[roomId].ids}
entities={users[roomId].entities}
Expand Down

0 comments on commit d20bad6

Please sign in to comment.