Browse Source

fetaure(contacts): added search to contacts

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
d264e77641
  1. 17
      app/routes/friends/components/Friends.js
  2. 4
      app/routes/friends/containers/FriendsContainer.js

17
app/routes/friends/components/Friends.js

@ -29,13 +29,14 @@ class Friends extends Component {
render() {
const {
channels,
channels: { searchQuery },
currentChannels,
activeChannels,
nonActiveChannels,
pendingOpenChannels,
closingPendingChannels,
updateChannelSearchQuery,
openFriendsForm,
friendsFormProps,
@ -66,8 +67,8 @@ class Friends extends Component {
<MdSearch />
</label>
<input
value={''}
onChange={event => console.log('event: ', event)}
value={searchQuery}
onChange={event => updateChannelSearchQuery(event.target.value)}
className={`${styles.text} ${styles.input}`}
placeholder='Search your friends list...'
type='text'
@ -77,17 +78,17 @@ class Friends extends Component {
<ul className={styles.friends}>
{
currentChannels.length > 0 && currentChannels.map(channel => {
currentChannels.length > 0 && currentChannels.map((channel, index) => {
console.log('channel: ', channel)
if (channel.active) {
return <OnlineContact channel={channel} />
return <OnlineContact channel={channel} key={index} />
} else if (!channel.active) {
return <OfflineContact channel={channel} />
return <OfflineContact channel={channel} key={index} />
} else if (Object.prototype.hasOwnProperty.call(channel, 'blocks_till_open')) {
return <PendingContact channel={channel} />
return <PendingContact channel={channel} key={index} />
} else if (Object.prototype.hasOwnProperty.call(channel, 'closing_txid')) {
return <ClosingContact channel={channel} />
return <ClosingContact channel={channel} key={index} />
}
})
}

4
app/routes/friends/containers/FriendsContainer.js

@ -4,7 +4,10 @@ import { connect } from 'react-redux'
import {
fetchChannels,
openChannel,
updateChannelSearchQuery,
currentChannels,
channelsSelectors
} from 'reducers/channels'
@ -26,6 +29,7 @@ const mapDispatchToProps = {
closeFriendsForm,
updateFriendFormSearchQuery,
openChannel,
updateChannelSearchQuery,
fetchChannels,
fetchPeers,

Loading…
Cancel
Save