diff --git a/app/components/Highlight.js b/app/components/Highlight.js index dea98fd57..85f0040bb 100644 --- a/app/components/Highlight.js +++ b/app/components/Highlight.js @@ -18,6 +18,7 @@ function Highlight({ ...rest }: Props) { let regex; + let index = 0; if (highlight instanceof RegExp) { regex = highlight; } else { @@ -29,8 +30,10 @@ function Highlight({ return ( {highlight - ? replace(text, regex, (tag, index) => ( - {processResult ? processResult(tag) : tag} + ? replace(text, regex, (tag) => ( + + {processResult ? processResult(tag) : tag} + )) : text} diff --git a/app/scenes/Search/Search.js b/app/scenes/Search/Search.js index 48b876354..4b8bbfcae 100644 --- a/app/scenes/Search/Search.js +++ b/app/scenes/Search/Search.js @@ -302,31 +302,29 @@ class Search extends React.Component { )} {showEmpty && ( - - - - No documents found for your search filters.
- Create a new document? -
- - {this.collectionId ? ( - - ) : ( - - )} -    - - -
-
+ ) : ( + + )} +    + + +
)} diff --git a/app/scenes/Search/components/CollectionFilter.js b/app/scenes/Search/components/CollectionFilter.js index 88a5d7c49..de7cad195 100644 --- a/app/scenes/Search/components/CollectionFilter.js +++ b/app/scenes/Search/components/CollectionFilter.js @@ -5,7 +5,7 @@ import CollectionsStore from "stores/CollectionsStore"; import FilterOptions from "./FilterOptions"; const defaultOption = { - key: undefined, + key: "", label: "Any collection", }; diff --git a/app/scenes/Search/components/DateFilter.js b/app/scenes/Search/components/DateFilter.js index 8fca6047e..f8fafff12 100644 --- a/app/scenes/Search/components/DateFilter.js +++ b/app/scenes/Search/components/DateFilter.js @@ -3,7 +3,7 @@ import * as React from "react"; import FilterOptions from "./FilterOptions"; const options = [ - { key: undefined, label: "Any time" }, + { key: "", label: "Any time" }, { key: "day", label: "Past day" }, { key: "week", label: "Past week" }, { key: "month", label: "Past month" }, diff --git a/app/scenes/Search/components/FilterOptions.js b/app/scenes/Search/components/FilterOptions.js index b0faa9d72..68f31d5ee 100644 --- a/app/scenes/Search/components/FilterOptions.js +++ b/app/scenes/Search/components/FilterOptions.js @@ -8,7 +8,7 @@ import FilterOption from "./FilterOption"; type Props = { options: { - key: ?string, + key: string, label: string, note?: string, }[], @@ -20,7 +20,7 @@ type Props = { const FilterOptions = ({ options, - activeKey, + activeKey = "", defaultLabel, selectedPrefix = "", onSelect, diff --git a/app/scenes/Search/components/StatusFilter.js b/app/scenes/Search/components/StatusFilter.js index 2a17b5501..7685d69ed 100644 --- a/app/scenes/Search/components/StatusFilter.js +++ b/app/scenes/Search/components/StatusFilter.js @@ -4,7 +4,7 @@ import FilterOptions from "./FilterOptions"; const options = [ { - key: undefined, + key: "", label: "Active documents", note: "Documents in collections you are able to access", }, diff --git a/app/scenes/Search/components/UserFilter.js b/app/scenes/Search/components/UserFilter.js index 1c9e7bddc..6f9c42e4f 100644 --- a/app/scenes/Search/components/UserFilter.js +++ b/app/scenes/Search/components/UserFilter.js @@ -5,7 +5,7 @@ import UsersStore from "stores/UsersStore"; import FilterOptions from "./FilterOptions"; const defaultOption = { - key: undefined, + key: "", label: "Any author", };