aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorAndy Rickert <andrew_rickert@brown.edu>2020-04-15 20:02:58 -0700
committerAndy Rickert <andrew_rickert@brown.edu>2020-04-15 20:02:58 -0700
commit1d5c4510dff326a0f12b914868ac8614ab460e83 (patch)
tree7173f465175c6eb6b5bbfe96c932b49fd621f0b0 /src/client/views/search
parentc7c146adbd0b188eba56139ab914edaf73774d3f (diff)
parente0f16b89cba102a4fcd156bb3d4148432eca2ab7 (diff)
merge
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/FilterBox.tsx2
-rw-r--r--src/client/views/search/IconBar.tsx14
-rw-r--r--src/client/views/search/IconButton.tsx8
-rw-r--r--src/client/views/search/SearchBox.tsx52
-rw-r--r--src/client/views/search/SearchItem.tsx9
5 files changed, 41 insertions, 44 deletions
diff --git a/src/client/views/search/FilterBox.tsx b/src/client/views/search/FilterBox.tsx
index 1c05ff864..662b37d77 100644
--- a/src/client/views/search/FilterBox.tsx
+++ b/src/client/views/search/FilterBox.tsx
@@ -33,7 +33,7 @@ export enum Keys {
export class FilterBox extends React.Component {
static Instance: FilterBox;
- public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.TEXT, DocumentType.VID, DocumentType.WEB];
+ public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.RTF, DocumentType.VID, DocumentType.WEB];
//if true, any keywords can be used. if false, all keywords are required.
//this also serves as an indicator if the word status filter is applied
diff --git a/src/client/views/search/IconBar.tsx b/src/client/views/search/IconBar.tsx
index 46c109934..9cf5a9c87 100644
--- a/src/client/views/search/IconBar.tsx
+++ b/src/client/views/search/IconBar.tsx
@@ -24,9 +24,14 @@ library.add(faChartBar);
library.add(faGlobeAsia);
library.add(faBan);
+export interface IconBarProps {
+ setIcons: (icons: string[]) => {};
+}
+
+
@observer
-export class IconBar extends React.Component {
- public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.TEXT, DocumentType.VID, DocumentType.WEB];
+export class IconBar extends React.Component<IconBarProps> {
+ public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.RTF, DocumentType.VID, DocumentType.WEB];
@observable private _icons: string[] = this._allIcons;
@@ -38,7 +43,10 @@ export class IconBar extends React.Component {
@observable public _select: number = 0;
@action.bound
- updateIcon(newArray: string[]) { this._icons = newArray; }
+ updateIcon(newArray: string[]) {
+ this._icons = newArray;
+ this.props.setIcons?.(this._icons);
+ }
@action.bound
getIcons(): string[] { return this._icons; }
diff --git a/src/client/views/search/IconButton.tsx b/src/client/views/search/IconButton.tsx
index 4f94139d9..52641c543 100644
--- a/src/client/views/search/IconButton.tsx
+++ b/src/client/views/search/IconButton.tsx
@@ -86,15 +86,13 @@ export class IconButton extends React.Component<IconButtonProps>{
return faMusic;
case (DocumentType.COL):
return faObjectGroup;
- case (DocumentType.HIST):
- return faChartBar;
case (DocumentType.IMG):
return faImage;
case (DocumentType.LINK):
return faLink;
case (DocumentType.PDF):
return faFilePdf;
- case (DocumentType.TEXT):
+ case (DocumentType.RTF):
return faStickyNote;
case (DocumentType.VID):
return faVideo;
@@ -158,15 +156,13 @@ export class IconButton extends React.Component<IconButtonProps>{
return (<FontAwesomeIcon className="fontawesome-icon" icon={faMusic} />);
case (DocumentType.COL):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faObjectGroup} />);
- case (DocumentType.HIST):
- return (<FontAwesomeIcon className="fontawesome-icon" icon={faChartBar} />);
case (DocumentType.IMG):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faImage} />);
case (DocumentType.LINK):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faLink} />);
case (DocumentType.PDF):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faFilePdf} />);
- case (DocumentType.TEXT):
+ case (DocumentType.RTF):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faStickyNote} />);
case (DocumentType.VID):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faVideo} />);
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 532b151c5..90f995a8c 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -125,9 +125,7 @@ export class SearchBox extends React.Component<SearchProps> {
@action
- getViews = async (doc: Doc) => {
- return await SearchUtil.GetViewsOfDocument(doc);
- }
+ getViews = (doc: Doc) => SearchUtil.GetViewsOfDocument(doc)
@action.bound
onChange(e: React.ChangeEvent<HTMLInputElement>) {
@@ -166,23 +164,18 @@ export class SearchBox extends React.Component<SearchProps> {
}
}
- public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.TEXT, DocumentType.VID, DocumentType.WEB, DocumentType.TEMPLATE];
+ public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.RTF, DocumentType.VID, DocumentType.WEB];
//if true, any keywords can be used. if false, all keywords are required.
//this also serves as an indicator if the word status filter is applied
@observable private _filterOpen: boolean = false;
//if icons = all icons, then no icon filter is applied
@observable private _icons: string[] = this._allIcons;
//if all of these are true, no key filter is applied
- @observable private _anyKeywordStatus: boolean = true;
- @observable private _allKeywordStatus: boolean = true;
@observable private _titleFieldStatus: boolean = true;
@observable private _authorFieldStatus: boolean = true;
- @observable private _dataFieldStatus: boolean = true;
//this also serves as an indicator if the collection status filter is applied
@observable public _deletedDocsStatus: boolean = false;
@observable private _collectionStatus = false;
- @observable private _collectionSelfStatus = true;
- @observable private _collectionParentStatus = true;
getFinalQuery(query: string): string {
@@ -223,7 +216,7 @@ export class SearchBox extends React.Component<SearchProps> {
@action
filterDocsByType(docs: Doc[]) {
- if (this._icons.length === 9) {
+ if (this._icons.length === this._allIcons.length) {
return docs;
}
const finalDocs: Doc[] = [];
@@ -254,7 +247,7 @@ export class SearchBox extends React.Component<SearchProps> {
}
get filterTypes() {
- return this._icons.length === 9 ? undefined : this._icons;
+ return this._icons.length === this._allIcons.length ? undefined : this._icons;
}
@action.bound
@@ -332,7 +325,7 @@ export class SearchBox extends React.Component<SearchProps> {
@action
submitSearch = async () => {
- let query = this._searchString;
+ const query = this._searchString;
this.getFinalQuery(query);
this._results = [];
this._resultsSet.clear();
@@ -359,8 +352,10 @@ export class SearchBox extends React.Component<SearchProps> {
private get filterQuery() {
const types = this.filterTypes;
- const includeDeleted = this.getDataStatus();
- return "NOT baseProto_b:true" + (includeDeleted ? "" : " AND NOT deleted_b:true") + (types ? ` AND (${types.map(type => `({!join from=id to=proto_i}type_t:"${type}" AND NOT type_t:*) OR type_t:"${type}" OR type_t:"extension"`).join(" ")})` : "");
+ const includeDeleted = this.getDataStatus() ? "" : " AND NOT deleted_b:true";
+ const includeIcons = this.getDataStatus() ? "" : " AND NOT type_t:fonticonbox";
+ // fq: type_t:collection OR {!join from=id to=proto_i}type_t:collection q:text_t:hello
+ return "NOT baseProto_b:true" + includeDeleted + includeIcons + (types ? ` AND (${types.map(type => `({!join from=id to=proto_i}type_t:"${type}" AND NOT type_t:*) OR type_t:"${type}"`).join(" ")})` : "");
}
getDataStatus() { return this._deletedDocsStatus; }
@@ -569,10 +564,10 @@ export class SearchBox extends React.Component<SearchProps> {
handleNodeChange = () => {
this._nodeStatus = !this._nodeStatus;
if (this._nodeStatus) {
- this.expandSection(`node${this.props.id}`)
+ this.expandSection(`node${this.props.id}`);
}
else {
- this.collapseSection(`node${this.props.id}`)
+ this.collapseSection(`node${this.props.id}`);
}
}
@@ -608,13 +603,13 @@ export class SearchBox extends React.Component<SearchProps> {
collapseSection(thing: string) {
- let id = this.props.id;
- let element = document.getElementById(thing)!;
+ const id = this.props.id;
+ const element = document.getElementById(thing)!;
// get the height of the element's inner content, regardless of its actual size
- var sectionHeight = element.scrollHeight;
+ const sectionHeight = element.scrollHeight;
// temporarily disable all css transitions
- var elementTransition = element.style.transition;
+ const elementTransition = element.style.transition;
element.style.transition = '';
// on the next frame (as soon as the previous style change has taken effect),
@@ -628,7 +623,7 @@ export class SearchBox extends React.Component<SearchProps> {
// have the element transition to height: 0
requestAnimationFrame(function () {
element.style.height = 0 + 'px';
- thing == `filterhead${id}` ? document.getElementById(`filterhead${id}`)!.style.padding = "0" : null;
+ thing === `filterhead${id}` ? document.getElementById(`filterhead${id}`)!.style.padding = "0" : null;
});
});
@@ -638,12 +633,11 @@ export class SearchBox extends React.Component<SearchProps> {
expandSection(thing: string) {
console.log("expand");
- let element = document.getElementById(thing)!;
+ const element = document.getElementById(thing)!;
// get the height of the element's inner content, regardless of its actual size
- var sectionHeight = element.scrollHeight;
+ const sectionHeight = element.scrollHeight;
// have the element transition to the height of its inner content
- let temp = element.style.height;
element.style.height = sectionHeight + 'px';
// when the next css transition finishes (which should be the one we just triggered)
@@ -663,7 +657,7 @@ export class SearchBox extends React.Component<SearchProps> {
}
autoset(thing: string) {
- let element = document.getElementById(thing)!;
+ const element = document.getElementById(thing)!;
console.log("autoset");
element.removeEventListener('transitionend', function (e) { });
@@ -715,8 +709,8 @@ export class SearchBox extends React.Component<SearchProps> {
bringToFront={emptyFunction}
ContainingCollectionView={undefined}
ContainingCollectionDoc={undefined}
- zoomToScale={emptyFunction}
- getScale={returnOne}
+ NativeHeight={()=>100}
+ NativeWidth={width}
/>
</div>;
}
@@ -725,10 +719,10 @@ export class SearchBox extends React.Component<SearchProps> {
setupDocTypeButtons() {
let doc = this.props.Document;
- const ficon = (opts: DocumentOptions) => new PrefetchProxy(Docs.Create.FontIconDocument({ ...opts, dontDecorateSelection: true, backgroundColor: "#121721", dropAction: "alias", removeDropProperties: new List<string>(["dropAction"]), _nativeWidth: 100, _nativeHeight: 100, _width: 100, _height: 100 })) as any as Doc;
+ const ficon = (opts: DocumentOptions) => new PrefetchProxy(Docs.Create.FontIconDocument({ ...opts, backgroundColor: "#121721", dropAction: "alias", removeDropProperties: new List<string>(["dropAction"]), _nativeWidth: 100, _nativeHeight: 100, _width: 100, _height: 100 })) as any as Doc;
const blist = (opts: DocumentOptions, docs: Doc[]) => new PrefetchProxy(Docs.Create.LinearDocument(docs, {
...opts,
- _gridGap: 5, _xMargin: 5, _yMargin: 5, _height: 42, _width: 100, boxShadow: "0 0", dontDecorateSelection: true, forceActive: true,
+ _gridGap: 5, _xMargin: 5, _yMargin: 5, _height: 42, _width: 100, boxShadow: "0 0", forceActive: true,
dropConverter: ScriptField.MakeScript("convertToButtons(dragData)", { dragData: DragManager.DocumentDragData.name }),
backgroundColor: "black", treeViewPreventOpen: true, lockedPosition: true, _chromeStatus: "disabled", linearViewIsExpanded: true
})) as any as Doc;
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 0d77026ad..fe2000700 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -68,7 +68,7 @@ export class SelectorContextMenu extends React.Component<SearchItemProps> {
getOnClick({ col, target }: { col: Doc, target: Doc }) {
return () => {
col = Doc.IsPrototype(col) ? Doc.MakeDelegate(col) : col;
- if (NumCast(col._viewType, CollectionViewType.Invalid) === CollectionViewType.Freeform) {
+ if (col._viewType === CollectionViewType.Freeform) {
const newPanX = NumCast(target.x) + NumCast(target._width) / 2;
const newPanY = NumCast(target.y) + NumCast(target._height) / 2;
col._panX = newPanX;
@@ -178,14 +178,13 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
const button = layoutresult.indexOf(DocumentType.PDF) !== -1 ? faFilePdf :
layoutresult.indexOf(DocumentType.IMG) !== -1 ? faImage :
- layoutresult.indexOf(DocumentType.TEXT) !== -1 ? faStickyNote :
+ layoutresult.indexOf(DocumentType.RTF) !== -1 ? faStickyNote :
layoutresult.indexOf(DocumentType.VID) !== -1 ? faFilm :
layoutresult.indexOf(DocumentType.COL) !== -1 ? faObjectGroup :
layoutresult.indexOf(DocumentType.AUDIO) !== -1 ? faMusic :
layoutresult.indexOf(DocumentType.LINK) !== -1 ? faLink :
- layoutresult.indexOf(DocumentType.HIST) !== -1 ? faChartBar :
- layoutresult.indexOf(DocumentType.WEB) !== -1 ? faGlobeAsia :
- faCaretUp;
+ layoutresult.indexOf(DocumentType.WEB) !== -1 ? faGlobeAsia :
+ faCaretUp;
return <div onClick={action(() => { this._useIcons = false; this._displayDim = Number(SEARCH_THUMBNAIL_SIZE); })} >
<FontAwesomeIcon icon={button} size="2x" />
</div>;