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() { render() {
const { const {
channels, channels: { searchQuery },
currentChannels, currentChannels,
activeChannels, activeChannels,
nonActiveChannels, nonActiveChannels,
pendingOpenChannels, pendingOpenChannels,
closingPendingChannels, closingPendingChannels,
updateChannelSearchQuery,
openFriendsForm, openFriendsForm,
friendsFormProps, friendsFormProps,
@ -66,8 +67,8 @@ class Friends extends Component {
<MdSearch /> <MdSearch />
</label> </label>
<input <input
value={''} value={searchQuery}
onChange={event => console.log('event: ', event)} onChange={event => updateChannelSearchQuery(event.target.value)}
className={`${styles.text} ${styles.input}`} className={`${styles.text} ${styles.input}`}
placeholder='Search your friends list...' placeholder='Search your friends list...'
type='text' type='text'
@ -77,17 +78,17 @@ class Friends extends Component {
<ul className={styles.friends}> <ul className={styles.friends}>
{ {
currentChannels.length > 0 && currentChannels.map(channel => { currentChannels.length > 0 && currentChannels.map((channel, index) => {
console.log('channel: ', channel) console.log('channel: ', channel)
if (channel.active) { if (channel.active) {
return <OnlineContact channel={channel} /> return <OnlineContact channel={channel} key={index} />
} else if (!channel.active) { } else if (!channel.active) {
return <OfflineContact channel={channel} /> return <OfflineContact channel={channel} key={index} />
} else if (Object.prototype.hasOwnProperty.call(channel, 'blocks_till_open')) { } 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')) { } 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 { import {
fetchChannels, fetchChannels,
openChannel, openChannel,
updateChannelSearchQuery,
currentChannels, currentChannels,
channelsSelectors channelsSelectors
} from 'reducers/channels' } from 'reducers/channels'
@ -26,6 +29,7 @@ const mapDispatchToProps = {
closeFriendsForm, closeFriendsForm,
updateFriendFormSearchQuery, updateFriendFormSearchQuery,
openChannel, openChannel,
updateChannelSearchQuery,
fetchChannels, fetchChannels,
fetchPeers, fetchPeers,

Loading…
Cancel
Save