Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: implement tags search

thecodrrcca423c659c5
diff --git a/apps/web/src/views/Tags.js b/apps/web/src/views/Tags.js
index 0ebcfe776..9b96e8555 100644
--- a/apps/web/src/views/Tags.js
+++ b/apps/web/src/views/Tags.js
@@ -14,46 +14,47 @@ const TagNode = ({ title }) => (
{title}
</Text>
);
-
+const TagItem = props => (index, item) => {
+ const { title, count } = item;
+ return (
+ <ListItem
+ item={item}
+ selectable={false}
+ index={index}
+ title={<TagNode title={title} />}
+ info={`${count} notes`}
+ onClick={() => {
+ store.getState().setSelectedContext({ type: "tag", value: title });
+ props.navigator.navigate("notes", {
+ title: "#" + title,
+ context: { tags: [title] }
+ });
+ }}
+ />
+ );
+};
const Tags = props => {
const tags = db.tags.all;
return (
<ListContainer
+ term={props.term}
placeholder={TagsPlaceholder}
itemsLength={tags.length}
- item={index => {
- const { title, count } = tags[index];
-
- return (
- <ListItem
- selectable={false}
- index={index}
- title={<TagNode title={title} />}
- info={`${count} notes`}
- onClick={() => {
- store
- .getState()
- .setSelectedContext({ type: "tag", value: title });
- props.navigator.navigate("notes", {
- title: "#" + title,
- context: { tags: [title] }
- });
- }}
- />
- );
- }}
+ searchPlaceholder="Search tags"
+ searchParams={{ type: "tags", items: tags, item: TagItem(props) }}
+ item={index => TagItem(props)(index, tags[index])}
/>
);
};
-const TagsContainer = () => {
+const TagsContainer = props => {
useEffect(() => {
const TagNavigator = require("../navigation/navigators/tagnavigator")
.default;
- if (!TagNavigator.restore()) {
+ if (!TagNavigator.restore(props)) {
TagNavigator.navigate("tags");
}
- }, []);
+ }, [props]);
return (
<Flex className="TagNavigator" flexDirection="column" flex="1 1 auto" />
);