-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
162 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,36 @@ | ||
import { useMemo } from 'preact/hooks'; | ||
|
||
import FeedComponent from '@/components/feed/Feed'; | ||
|
||
import View from '../View'; | ||
|
||
class Search extends View { | ||
constructor() { | ||
super(); | ||
this.state = { sortedMessages: [] }; | ||
this.id = 'message-view'; | ||
this.class = 'public-messages-view'; | ||
} | ||
|
||
componentDidMount() { | ||
this.restoreScrollPosition(); | ||
} | ||
const Search = ({ keyword }) => { | ||
const filterOptions = useMemo(() => { | ||
const filter = { kinds: [1], keywords: [keyword || ''] }; | ||
|
||
renderView() { | ||
const filterFn = (event) => { | ||
// some relays don't support filtering by keyword | ||
return event.content.includes(this.props.keyword); | ||
return event.content.includes(keyword); | ||
}; | ||
const filter = { kinds: [1], keywords: [this.props.keyword || ''] }; | ||
return ( | ||
|
||
return [ | ||
{ | ||
name: 'Search', | ||
filter, | ||
filterFn, | ||
}, | ||
]; | ||
}, [keyword]); | ||
|
||
return ( | ||
<View> | ||
<div className="flex flex-row"> | ||
<div className="flex flex-col w-full"> | ||
<FeedComponent | ||
key={this.props.keyword} | ||
filterOptions={[ | ||
{ | ||
name: 'Search', | ||
filter, | ||
filterFn, | ||
}, | ||
]} | ||
/> | ||
<FeedComponent key={keyword} filterOptions={filterOptions} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
</View> | ||
); | ||
}; | ||
|
||
export default Search; |
Oops, something went wrong.