Skip to content

Commit ee442d6

Browse files
committed
simplified user lookup display becuase not all user info may be available
1 parent 4eff158 commit ee442d6

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

src/client/components/Collections/Collection.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export default class CollectionList extends Component {
2828
this.state = {
2929
checkedTweets: [],
3030
findUser: '',
31-
findingUser: false
31+
findingUser: false,
32+
lastUserLookup: ''
3233
}
3334
this.randomTweet = Math.floor(Math.random() * (98))
3435
}
@@ -69,7 +70,8 @@ export default class CollectionList extends Component {
6970
findUser() {
7071
if (this.state.findUser !== '') {
7172
this.setState({
72-
findingUser: true
73+
findingUser: true,
74+
lastUserLookup: this.state.findUser
7375
})
7476
this.props.getTweetsForUser(this.props.searchId, this.state.findUser)
7577
}
@@ -155,21 +157,13 @@ export default class CollectionList extends Component {
155157

156158
if (this.state.findingUser) {
157159
if (this.props.foundUserTweets > 0) {
158-
usersInfo = (<div className={style.FoundUser}>
159-
<div>{this.props.search.users.filter(u => u.screenName === this.state.findUser).map((u, i) => {
160-
return <img className={style.UserImg}
161-
src={u.avatarUrl}
162-
alt={u.screenName}
163-
title={u.screenName} key={`u${i}`} />
164-
})}
165-
<br/> <a href={`https://twitter.com/${this.state.findUser}`}>@{this.state.findUser}</a>
166-
</div>
160+
usersInfo = (
167161
<Typography variant="body2">
168-
Found {this.props.foundUserTweets} tweet{this.props.foundUserTweets > 1 ? 's' : ''} by this user.
169-
</Typography>
170-
</div>)
162+
Found {this.props.foundUserTweets} tweet{this.props.foundUserTweets > 1 ? 's' : ''} by &nbsp;
163+
<a href={`https://twitter.com/${this.state.lastUserLookup}`}>@{this.state.lastUserLookup}</a>.
164+
</Typography>)
171165
} else {
172-
usersInfo = <Typography variant="body2">Could not find user &quot;{this.state.findUser}&quot;.</Typography>
166+
usersInfo = <Typography variant="body2">Could not find user &quot;{this.state.lastUserLookup}&quot;.</Typography>
173167
}
174168
}
175169

0 commit comments

Comments
 (0)