diff options
| author | Monika Hedman <monika_hedman@brown.edu> | 2019-05-07 16:57:52 -0400 |
|---|---|---|
| committer | Monika Hedman <monika_hedman@brown.edu> | 2019-05-07 16:57:52 -0400 |
| commit | 1785f0b27d95b29c28a94f0ed05f32056ed69d42 (patch) | |
| tree | 127f6468722002deece5000ca3c3d4a0e526b4d1 /src/client/views/SearchBox.tsx | |
| parent | ef54fbecd832e4c8f31144ab9fa217146833a397 (diff) | |
| parent | 6683c5450eb25da291090091421e791bf0498aba (diff) | |
pulled again
Diffstat (limited to 'src/client/views/SearchBox.tsx')
| -rw-r--r-- | src/client/views/SearchBox.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx index ff215efab..a52598f4c 100644 --- a/src/client/views/SearchBox.tsx +++ b/src/client/views/SearchBox.tsx @@ -3,7 +3,6 @@ import { observer } from 'mobx-react'; import { observable, action, runInAction } from 'mobx'; import { Utils } from '../../Utils'; import { MessageStore } from '../../server/Message'; -import { Server } from '../Server'; import "./SearchBox.scss"; import { faSearch } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -12,10 +11,12 @@ import { library } from '@fortawesome/fontawesome-svg-core'; // import * as express from 'express'; import { Search } from '../../server/Search'; import * as rp from 'request-promise'; -import { Document } from '../../fields/Document'; import { SearchItem } from './SearchItem'; import { isString } from 'util'; import { constant } from 'async'; +import { DocServer } from '../DocServer'; +import { Doc } from '../../new_fields/Doc'; +import { Id } from '../../new_fields/RefField'; library.add(faSearch); @@ -29,7 +30,7 @@ export class SearchBox extends React.Component { @observable private _resultsOpen: boolean = false; @observable - private _results: Document[] = []; + private _results: Doc[] = []; @action.bound onChange(e: React.ChangeEvent<HTMLInputElement>) { @@ -58,8 +59,8 @@ export class SearchBox extends React.Component { @action getResults = async (res: string[]) => { res.map(async result => { - const doc = await Server.GetField(result); - if (doc instanceof Document) { + const doc = await DocServer.GetRefField(result); + if (doc instanceof Doc) { runInAction(() => this._results.push(doc)); } }); @@ -103,7 +104,7 @@ export class SearchBox extends React.Component { <button className="filter-button" onClick={this.toggleDisplay}> Filter </button> <div className="submit-search" id="submit" onClick={this.submitSearch}><FontAwesomeIcon style={{ height: "100%" }} icon="search" size="lg" /></div> <div className="results" style={this._resultsOpen ? { display: "flex" } : { display: "none" }}> - {this._results.map(result => <SearchItem doc={result} key={result.Id} />)} + {this._results.map(result => <SearchItem doc={result} key={result[Id]} />)} </div> </div> <div className="filter-form" id="filter" style={this._open ? { display: "flex" } : { display: "none" }}> |
