diff options
author | Monika <monika_hedman@brown.edu> | 2019-06-24 16:07:38 -0400 |
---|---|---|
committer | Monika <monika_hedman@brown.edu> | 2019-06-24 16:07:38 -0400 |
commit | 56394d6631f494526546cb5cd03297b400a85e65 (patch) | |
tree | 406506e35e9c8bb4c4a5b838ad82e5ed154894e9 | |
parent | cfb2e001ab6df21558fb5d7f9c18e47c7b6c21bb (diff) |
clean ups
-rw-r--r-- | src/client/views/search/IconBar.tsx | 8 | ||||
-rw-r--r-- | src/client/views/search/IconButton.tsx | 16 | ||||
-rw-r--r-- | src/client/views/search/NaviconButton.tsx | 1 | ||||
-rw-r--r-- | src/client/views/search/SearchBox.tsx | 17 | ||||
-rw-r--r-- | src/client/views/search/SearchItem.tsx | 9 | ||||
-rw-r--r-- | src/client/views/search/ToggleBar.tsx | 22 |
6 files changed, 9 insertions, 64 deletions
diff --git a/src/client/views/search/IconBar.tsx b/src/client/views/search/IconBar.tsx index ea8c626ca..8746ac6e2 100644 --- a/src/client/views/search/IconBar.tsx +++ b/src/client/views/search/IconBar.tsx @@ -44,14 +44,10 @@ export class IconBar extends React.Component { } @action.bound - getList = (): string[] => { - return SearchBox.Instance.getIcons(); - } + getList = (): string[] => { return SearchBox.Instance.getIcons(); } @action.bound - updateList(newList: string[]) { - SearchBox.Instance.updateIcon(newList); - } + updateList(newList: string[]) { SearchBox.Instance.updateIcon(newList); } @action.bound resetSelf = () => { diff --git a/src/client/views/search/IconButton.tsx b/src/client/views/search/IconButton.tsx index 9df285b70..541fe5ba5 100644 --- a/src/client/views/search/IconButton.tsx +++ b/src/client/views/search/IconButton.tsx @@ -137,24 +137,16 @@ export class IconButton extends React.Component<IconButtonProps>{ }; @action.bound - public reset() { - this.isSelected = false; - } + public reset() { this.isSelected = false; } @action.bound - public select() { - this.isSelected = true; - } + public select() { this.isSelected = true; } @action - onMouseLeave = () => { - this.hover = false; - } + onMouseLeave = () => { this.hover = false; } @action - onMouseEnter = () => { - this.hover = true; - } + onMouseEnter = () => { this.hover = true; } getFA = () => { switch (this.props.type) { diff --git a/src/client/views/search/NaviconButton.tsx b/src/client/views/search/NaviconButton.tsx index 1b8ad7e91..3f9bb030f 100644 --- a/src/client/views/search/NaviconButton.tsx +++ b/src/client/views/search/NaviconButton.tsx @@ -8,7 +8,6 @@ export interface NaviconProps{ onClick(): void; } - export class NaviconButton extends React.Component<NaviconProps> { @observable ref: React.RefObject<HTMLAnchorElement> = React.createRef(); diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 30bd0c3d9..28bcadc6b 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -194,23 +194,17 @@ export class SearchBox extends React.Component { get fieldFiltersApplied() { return !(this.dataFieldStatus && this.authorFieldStatus && this.titleFieldStatus); } + //TODO: basically all of this //gets all of the collections of all the docviews that are selected //if a collection is the only thing selected, search only in that collection (not its container) getCurCollections(): Doc[] { let selectedDocs: DocumentView[] = SelectionManager.SelectedDocuments(); let collections: Doc[] = []; - //TODO: make this some sort of error - if (selectedDocs.length === 0) { - console.log("there is nothing selected!") - } - //also searches in a collection if it is selected - else { selectedDocs.forEach(async element => { let layout: string = StrCast(element.props.Document.baseLayout); //checks if selected view (element) is a collection. if it is, adds to list to search through if (layout.indexOf("Collection") > -1) { - console.log("current doc is a collection") //makes sure collections aren't added more than once if (!collections.includes(element.props.Document)) { collections.push(element.props.Document); @@ -223,7 +217,6 @@ export class SearchBox extends React.Component { collections.push(containingView.props.Document); } }); - } return collections; } @@ -249,7 +242,6 @@ export class SearchBox extends React.Component { query = this.addCollectionFilter(query); query = query.replace(/\s+/g, ' ').trim(); } - console.log(query) return query; } @@ -276,7 +268,6 @@ export class SearchBox extends React.Component { let results: Doc[]; query = this.getFinalQuery(query); - console.log(query) //if there is no query there should be no result if (query === "") { @@ -287,8 +278,6 @@ export class SearchBox extends React.Component { results = await this.getResults(query); } - console.log(results); - runInAction(() => { this._resultsOpen = true; this._results = results; @@ -312,18 +301,14 @@ export class SearchBox extends React.Component { docs.push(field); } } - console.log(docs) return this.filterDocsByType(docs); } //this.icons will now include all the icons that need to be included @action filterDocsByType(docs: Doc[]) { - console.log(this._icons) let finalDocs: Doc[] = []; docs.forEach(doc => { - console.log(doc.layout) let layoutresult = Cast(doc.type, "string", ""); - console.log(layoutresult) if (this._icons.includes(layoutresult)) { finalDocs.push(doc); } diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx index c19057819..e80d42a5c 100644 --- a/src/client/views/search/SearchItem.tsx +++ b/src/client/views/search/SearchItem.tsx @@ -69,7 +69,6 @@ export class SelectorContextMenu extends React.Component<SearchItemProps> { }; } - //these all need class names in order to find ancestor - please do not delete render() { return ( < div className="parents"> @@ -119,9 +118,7 @@ export class SearchItem extends React.Component<SearchItemProps> { } @computed - get linkCount() { - return Cast(this.props.doc.linkedToDocs, listSpec(Doc), []).length + Cast(this.props.doc.linkedFromDocs, listSpec(Doc), []).length; - } + get linkCount() { return Cast(this.props.doc.linkedToDocs, listSpec(Doc), []).length + Cast(this.props.doc.linkedFromDocs, listSpec(Doc), []).length; } @computed get linkString(): string { @@ -132,9 +129,7 @@ export class SearchItem extends React.Component<SearchItemProps> { return num.toString() + " links"; } - pointerDown = (e: React.PointerEvent) => { - SearchBox.Instance.openSearch(e); - } + pointerDown = (e: React.PointerEvent) => { SearchBox.Instance.openSearch(e); } highlightDoc = (e: React.PointerEvent) => { let docViews: DocumentView[] = DocumentManager.Instance.getAllDocumentViews(this.props.doc); diff --git a/src/client/views/search/ToggleBar.tsx b/src/client/views/search/ToggleBar.tsx index 96536794d..b1d22d38c 100644 --- a/src/client/views/search/ToggleBar.tsx +++ b/src/client/views/search/ToggleBar.tsx @@ -33,30 +33,8 @@ export class ToggleBar extends React.Component<ToggleBarProps>{ }); } - @computed get totalWidth() { return this.getTotalWidth(); } - - getTotalWidth() { - let bar = document.getElementById("toggle-bar"); - let tog = document.getElementById("toggle-button"); - let barwidth = 0; - let togwidth = 0; - if (bar && tog) { - console.log("they exist") - barwidth = bar.getBoundingClientRect().width; - // barwidth = bar.clientWidth; - console.log(barwidth) - togwidth = tog.getBoundingClientRect().width; - // togwidth = tog.clientWidth; - console.log(togwidth) - } - let totalWidth = (barwidth - togwidth - 10); - console.log(totalWidth) - return totalWidth; - } - componentDidMount = () => { - // let totalWidth = this.totalWidth; let totalWidth = 265; if (this._originalStatus) { |