aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/search/FilterBox.tsx30
-rw-r--r--src/client/views/search/SearchBox.tsx39
2 files changed, 23 insertions, 46 deletions
diff --git a/src/client/views/search/FilterBox.tsx b/src/client/views/search/FilterBox.tsx
index 8bcfda794..cc1feeaf7 100644
--- a/src/client/views/search/FilterBox.tsx
+++ b/src/client/views/search/FilterBox.tsx
@@ -1,20 +1,13 @@
import * as React from 'react';
import { observer } from 'mobx-react';
-import { observable, action, runInAction } from 'mobx';
+import { observable, action } from 'mobx';
import "./SearchBox.scss";
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faTimes } from '@fortawesome/free-solid-svg-icons';
-import { library, icon } from '@fortawesome/fontawesome-svg-core';
-import * as rp from 'request-promise';
-import { SearchItem } from './SearchItem';
-import { DocServer } from '../../DocServer';
+import { library} from '@fortawesome/fontawesome-svg-core';
import { Doc } from '../../../new_fields/Doc';
import { Id } from '../../../new_fields/FieldSymbols';
-import { SetupDrag } from '../../util/DragManager';
-import { Docs, DocTypes } from '../../documents/Documents';
-import { RouteStore } from '../../../server/RouteStore';
-import { NumCast, Cast, StrCast } from '../../../new_fields/Types';
-import { SearchUtil } from '../../util/SearchUtil';
+import { DocTypes } from '../../documents/Documents';
+import { Cast, StrCast } from '../../../new_fields/Types';
import * as _ from "lodash";
import { ToggleBar } from './ToggleBar';
import { IconBar } from './IconBar';
@@ -24,7 +17,6 @@ import { DocumentView } from '../nodes/DocumentView';
import { CollectionFilters } from './CollectionFilters';
import { NaviconButton } from './NaviconButton';
import * as $ from 'jquery';
-import * as anime from 'animejs';
import "./FilterBox.scss";
import { SearchBox } from './SearchBox';
@@ -63,7 +55,6 @@ export class FilterBox extends React.Component {
FilterBox.Instance = this;
}
- // might need to add to search box
componentDidMount = () => {
document.addEventListener("pointerdown", (e) => {
if (e.timeStamp !== this._pointerTime) {
@@ -125,18 +116,6 @@ export class FilterBox extends React.Component {
CollectionFilters.Instance.resetCollectionFilters();
}
- //--------------------------------------------------------------------------------------------------------------
- // @action.bound
- // onChange(e: React.ChangeEvent<HTMLInputElement>) {
- // this._searchString = e.target.value;
-
- // if (this._searchString === "") {
- // this._results = [];
- // this._openNoResults = false;
- // }
- // }
- //--------------------------------------------------------------------------------------------------------------
-
basicRequireWords(query: string): string {
let oldWords = query.split(" ");
let newWords: string[] = [];
@@ -343,7 +322,6 @@ export class FilterBox extends React.Component {
return (
<div>
<div style={{ display: "flex", flexDirection: "row-reverse" }}>
- <button className="searchBox-barChild searchBox-filter" onClick={this.openFilter} onPointerDown={this.stopProp}>Filter</button>
<SearchBox />
</div>
{this._filterOpen ? (
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index e9eefa29a..3c401138e 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -25,7 +25,7 @@ export class SearchBox extends React.Component {
@observable private _openNoResults: boolean = false;
static Instance: SearchBox;
- constructor(props: any){
+ constructor(props: any) {
super(props);
SearchBox.Instance = this;
@@ -112,8 +112,6 @@ export class SearchBox extends React.Component {
docs.push(field);
}
}
- // this.props.setUnfilteredResults(docs);
- // return docs;
return FilterBox.Instance.filterDocsByType(docs);
}
@@ -177,25 +175,26 @@ export class SearchBox extends React.Component {
}
render() {
- return(
+ return (
<div className="searchBox-container">
- <div className="searchBox-bar">
- <span className="searchBox-barChild searchBox-collection" onPointerDown={SetupDrag(this.collectionRef, this.startDragCollection)} ref={this.collectionRef}>
- <FontAwesomeIcon icon="object-group" size="lg" />
- </span>
- <input value={this._searchString} onChange={this.onChange} type="text" placeholder="Search..."
- className="searchBox-barChild searchBox-input" onPointerDown={this.openSearch} onKeyPress={this.enter}
- style={{ width: this._resultsOpen ? "500px" : "100px" }} />
- </div>
- <div className="searchBox-results" style = {this._resultsOpen ? {display: "flex"} : {display: "none"}}>
- {(this._results.length !== 0) ? (
- this._results.map(result => <SearchItem doc={result} key={result[Id]} />)
- ) :
- this._openNoResults ? (<div className="no-result">No Search Results</div>) : null}
-
- </div>
+ <div className="searchBox-bar">
+ <span className="searchBox-barChild searchBox-collection" onPointerDown={SetupDrag(this.collectionRef, this.startDragCollection)} ref={this.collectionRef}>
+ <FontAwesomeIcon icon="object-group" size="lg" />
+ </span>
+ <input value={this._searchString} onChange={this.onChange} type="text" placeholder="Search..."
+ className="searchBox-barChild searchBox-input" onPointerDown={this.openSearch} onKeyPress={this.enter}
+ style={{ width: this._resultsOpen ? "500px" : "100px" }} />
+ <button className="searchBox-barChild searchBox-filter" onClick={FilterBox.Instance.openFilter} onPointerDown={FilterBox.Instance.stopProp}>Filter</button>
</div>
- )
+ <div className="searchBox-results" style={this._resultsOpen ? { display: "flex" } : { display: "none" }}>
+ {(this._results.length !== 0) ? (
+ this._results.map(result => <SearchItem doc={result} key={result[Id]} />)
+ ) :
+ this._openNoResults ? (<div className="no-result">No Search Results</div>) : null}
+
+ </div>
+ </div>
+ );
}
} \ No newline at end of file