aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-07-11 02:32:27 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-07-11 02:32:27 -0400
commit9c4ed0eba1ee65271435a950f50fcbc85417eb0b (patch)
tree1efac2bdc8ef3239b4a869aaa711f59344973e84 /src
parenta1c6b6df4eb6a30bca9603dac449dc937fb479fc (diff)
naming cleanup
Diffstat (limited to 'src')
-rw-r--r--src/Utils.ts6
-rw-r--r--src/client/DocServer.ts4
-rw-r--r--src/client/documents/Documents.ts84
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx4
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx4
-rw-r--r--src/client/views/nodes/DocumentView.tsx2
-rw-r--r--src/client/views/nodes/LinkMenu.tsx2
-rw-r--r--src/client/views/search/FilterBox.tsx4
-rw-r--r--src/client/views/search/IconBar.tsx4
-rw-r--r--src/client/views/search/IconButton.tsx42
-rw-r--r--src/client/views/search/SearchItem.tsx26
11 files changed, 93 insertions, 89 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index a62f9b4ff..e8a80bdc3 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -78,9 +78,9 @@ export class Utils {
socket.emit(message.Message, args);
}
- public static emitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T): Promise<any>;
- public static emitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T, fn: (args: any) => any): void;
- public static emitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T, fn?: (args: any) => any): void | Promise<any> {
+ public static EmitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T): Promise<any>;
+ public static EmitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T, fn: (args: any) => any): void;
+ public static EmitCallback<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T, fn?: (args: any) => any): void | Promise<any> {
this.log("Emit", message.Name, args, false);
if (fn) {
socket.emit(message.Message, args, this.loggingCallback('Receiving', fn, message.Name));
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 895177841..d05793ea2 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -109,7 +109,7 @@ export namespace DocServer {
// synchronously, we emit a single callback to the server requesting the serialized (i.e. represented by a string)
// field for the given ids. This returns a promise, which, when resolved, indicates the the JSON serialized version of
// the field has been returned from the server
- const getSerializedField = Utils.emitCallback(_socket, MessageStore.GetRefField, id);
+ const getSerializedField = Utils.EmitCallback(_socket, MessageStore.GetRefField, id);
// when the serialized RefField has been received, go head and begin deserializing it into an object.
// Here, once deserialized, we also invoke .proto to 'load' the document's prototype, which ensures that all
@@ -179,7 +179,7 @@ export namespace DocServer {
// 2) synchronously, we emit a single callback to the server requesting the serialized (i.e. represented by a string)
// fields for the given ids. This returns a promise, which, when resolved, indicates that all the JSON serialized versions of
// the fields have been returned from the server
- const getSerializedFields: Promise<any> = Utils.emitCallback(_socket, MessageStore.GetRefFields, requestedIds);
+ const getSerializedFields: Promise<any> = Utils.EmitCallback(_socket, MessageStore.GetRefFields, requestedIds);
// 3) when the serialized RefFields have been received, go head and begin deserializing them into objects.
// Here, once deserialized, we also invoke .proto to 'load' the documents' prototypes, which ensures that all
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index b2f69d7af..5a3f9574f 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -41,7 +41,7 @@ import { Scripting } from "../util/Scripting";
var requestImageSize = require('../util/request-image-size');
var path = require('path');
-export enum DocTypes {
+export enum DocumentType {
NONE = "none",
TEXT = "text",
HIST = "histogram",
@@ -60,13 +60,13 @@ export enum DocTypes {
export namespace DocTypeUtils {
export function values(includeNone: boolean = true): string[] {
- let types = Object.values(DocTypes);
- return includeNone ? types : types.filter(key => key !== DocTypes.NONE);
+ let types = Object.values(DocumentType);
+ return includeNone ? types : types.filter(key => key !== DocumentType.NONE);
}
export function keys(includeNone: boolean = true): string[] {
- let types = Object.keys(DocTypes);
- return includeNone ? types : types.filter(key => key !== DocTypes.NONE);
+ let types = Object.keys(DocumentType);
+ return includeNone ? types : types.filter(key => key !== DocumentType.NONE);
}
}
@@ -104,55 +104,55 @@ export namespace Docs {
export namespace Prototypes {
type PrototypeTemplate = { options?: Partial<DocumentOptions>, primary: string, background?: string };
- type TemplateMap = Map<DocTypes, PrototypeTemplate>;
- type PrototypeMap = Map<DocTypes, Doc>;
+ type TemplateMap = Map<DocumentType, PrototypeTemplate>;
+ type PrototypeMap = Map<DocumentType, Doc>;
const TemplateMap: TemplateMap = new Map([
- [DocTypes.TEXT, {
+ [DocumentType.TEXT, {
options: { height: 150, backgroundColor: "#f1efeb" },
primary: FormattedTextBox.LayoutString()
}],
- [DocTypes.HIST, {
+ [DocumentType.HIST, {
options: { nativeWidth: 600, curPage: 0 },
primary: CollectionView.LayoutString("annotations"),
background: HistogramBox.LayoutString()
}],
- [DocTypes.IMG, {
+ [DocumentType.IMG, {
options: { height: 300, backgroundColor: "black" },
primary: CollectionView.LayoutString("annotations"),
background: ImageBox.LayoutString()
}],
- [DocTypes.WEB, {
+ [DocumentType.WEB, {
options: { height: 300 },
primary: WebBox.LayoutString()
}],
- [DocTypes.COL, {
+ [DocumentType.COL, {
options: { panX: 0, panY: 0, scale: 1, width: 500, height: 500 },
primary: CollectionView.LayoutString()
}],
- [DocTypes.KVP, {
+ [DocumentType.KVP, {
options: { height: 150 },
primary: KeyValueBox.LayoutString()
}],
- [DocTypes.VID, {
+ [DocumentType.VID, {
options: { nativeWidth: 600, curPage: 0 },
primary: CollectionVideoView.LayoutString("annotations"),
background: VideoBox.LayoutString()
}],
- [DocTypes.AUDIO, {
+ [DocumentType.AUDIO, {
options: { height: 150 },
primary: AudioBox.LayoutString()
}],
- [DocTypes.PDF, {
+ [DocumentType.PDF, {
options: { nativeWidth: 1200, curPage: 1 },
primary: CollectionPDFView.LayoutString("annotations"),
background: PDFBox.LayoutString()
}],
- [DocTypes.ICON, {
+ [DocumentType.ICON, {
options: { width: Number(MINIMIZED_ICON_SIZE), height: Number(MINIMIZED_ICON_SIZE) },
primary: IconBox.LayoutString()
}],
- [DocTypes.IMPORT, {
+ [DocumentType.IMPORT, {
options: { height: 150 },
primary: DirectoryImportBox.LayoutString()
}]
@@ -178,16 +178,20 @@ export namespace Docs {
// fetch the actual prototype documents from the server
let actualProtos = await DocServer.GetRefFields(prototypeIds);
+ // update this object to include any default values: DocumentOptions for all prototypes
let defaultOptions: DocumentOptions = { x: 0, y: 0, width: 300 };
prototypeIds.map(id => {
let existing = actualProtos[id] as Doc;
- let type = id.replace(suffix, "") as DocTypes;
+ let type = id.replace(suffix, "") as DocumentType;
+ // get or create prototype of the specified type...
let target = existing || buildPrototype(type, id, defaultOptions);
+ // ...and set it if not undefined (can be undefined only if TemplateMap does not contain
+ // an entry dedicated to the given DocumentType)
target && PrototypeMap.set(type, target);
});
}
- export function get(type: DocTypes) {
+ export function get(type: DocumentType) {
return PrototypeMap.get(type)!;
}
@@ -203,7 +207,7 @@ export namespace Docs {
* @param options any value specified in the DocumentOptions object likewise
* becomes the default value for that key for all delegates
*/
- function buildPrototype(type: DocTypes, prototypeId: string, defaultOptions: DocumentOptions): Opt<Doc> {
+ function buildPrototype(type: DocumentType, prototypeId: string, defaultOptions: DocumentOptions): Opt<Doc> {
let template = TemplateMap.get(type);
if (!template) {
return undefined;
@@ -279,7 +283,7 @@ export namespace Docs {
}
export function ImageDocument(url: string, options: DocumentOptions = {}) {
- let inst = InstanceFromProto(Prototypes.get(DocTypes.IMG), new ImageField(new URL(url)), { title: path.basename(url), ...options });
+ let inst = InstanceFromProto(Prototypes.get(DocumentType.IMG), new ImageField(new URL(url)), { title: path.basename(url), ...options });
requestImageSize(window.origin + RouteStore.corsProxy + "/" + url)
.then((size: any) => {
let aspect = size.height / size.width;
@@ -294,27 +298,27 @@ export namespace Docs {
}
export function VideoDocument(url: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.VID), new VideoField(new URL(url)), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.VID), new VideoField(new URL(url)), options);
}
export function AudioDocument(url: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.AUDIO), new AudioField(new URL(url)), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.AUDIO), new AudioField(new URL(url)), options);
}
export function HistogramDocument(histoOp: HistogramOperation, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.HIST), new HistogramField(histoOp), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.HIST), new HistogramField(histoOp), options);
}
export function TextDocument(options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.TEXT), "", options);
+ return InstanceFromProto(Prototypes.get(DocumentType.TEXT), "", options);
}
export function IconDocument(icon: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.ICON), new IconField(icon), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.ICON), new IconField(icon), options);
}
export function PdfDocument(url: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.PDF), new PdfField(new URL(url)), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.PDF), new PdfField(new URL(url)), options);
}
export async function DBDocument(url: string, options: DocumentOptions = {}, columnOptions: DocumentOptions = {}) {
@@ -349,42 +353,42 @@ export namespace Docs {
}
export function WebDocument(url: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.WEB), new WebField(new URL(url)), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.WEB), new WebField(new URL(url)), options);
}
export function HtmlDocument(html: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.WEB), new HtmlField(html), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.WEB), new HtmlField(html), options);
}
export function KVPDocument(document: Doc, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.KVP), document, { title: document.title + ".kvp", ...options });
+ return InstanceFromProto(Prototypes.get(DocumentType.KVP), document, { title: document.title + ".kvp", ...options });
}
export function FreeformDocument(documents: Array<Doc>, options: DocumentOptions, makePrototype: boolean = true) {
if (!makePrototype) {
- return MakeDataDelegate(Prototypes.get(DocTypes.COL), { ...options, viewType: CollectionViewType.Freeform }, new List(documents));
+ return MakeDataDelegate(Prototypes.get(DocumentType.COL), { ...options, viewType: CollectionViewType.Freeform }, new List(documents));
}
- return InstanceFromProto(Prototypes.get(DocTypes.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Freeform });
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Freeform });
}
export function SchemaDocument(schemaColumns: string[], documents: Array<Doc>, options: DocumentOptions) {
- return InstanceFromProto(Prototypes.get(DocTypes.COL), new List(documents), { schemaColumns: new List(schemaColumns), ...options, viewType: CollectionViewType.Schema });
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { schemaColumns: new List(schemaColumns), ...options, viewType: CollectionViewType.Schema });
}
export function TreeDocument(documents: Array<Doc>, options: DocumentOptions) {
- return InstanceFromProto(Prototypes.get(DocTypes.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Tree });
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Tree });
}
export function StackingDocument(documents: Array<Doc>, options: DocumentOptions) {
- return InstanceFromProto(Prototypes.get(DocTypes.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Stacking });
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { schemaColumns: new List(["title"]), ...options, viewType: CollectionViewType.Stacking });
}
export function DockDocument(documents: Array<Doc>, config: string, options: DocumentOptions, id?: string) {
- return InstanceFromProto(Prototypes.get(DocTypes.COL), new List(documents), { ...options, viewType: CollectionViewType.Docking, dockingConfig: config }, id);
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, viewType: CollectionViewType.Docking, dockingConfig: config }, id);
}
export function DirectoryImportDocument(options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocTypes.IMPORT), new List<Doc>(), options);
+ return InstanceFromProto(Prototypes.get(DocumentType.IMPORT), new List<Doc>(), options);
}
export type DocConfig = {
@@ -538,14 +542,14 @@ export namespace DocUtils {
UndoManager.RunInBatch(() => {
let linkDoc = Docs.Create.TextDocument({ width: 100, height: 30, borderRounding: "100%" });
- linkDoc.type = DocTypes.LINK;
+ linkDoc.type = DocumentType.LINK;
let linkDocProto = Doc.GetProto(linkDoc);
linkDocProto.context = targetContext;
linkDocProto.title = title === "" ? source.title + " to " + target.title : title;
linkDocProto.linkDescription = description;
linkDocProto.linkTags = tags;
- linkDocProto.type = DocTypes.LINK;
+ linkDocProto.type = DocumentType.LINK;
linkDocProto.anchor1 = source;
linkDocProto.anchor1Page = source.curPage;
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 9266fc8fd..d26bf5118 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -12,7 +12,7 @@ import "./CollectionStackingView.scss";
import { CollectionSubView } from "./CollectionSubView";
import { undoBatch } from "../../util/UndoManager";
import { DragManager } from "../../util/DragManager";
-import { DocTypes } from "../../documents/Documents";
+import { DocumentType } from "../../documents/Documents";
import { Transform } from "../../util/Transform";
@observer
@@ -50,7 +50,7 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
}
overlays = (doc: Doc) => {
- return doc.type === DocTypes.IMG ? { title: "title", caption: "caption" } : {};
+ return doc.type === DocumentType.IMG ? { title: "title", caption: "caption" } : {};
}
getDisplayDoc(layoutDoc: Doc, d: Doc, dxf: () => Transform) {
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index e88f1a9d0..c8c092760 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -9,7 +9,7 @@ import { List } from '../../../new_fields/List';
import { Document, listSpec } from '../../../new_fields/Schema';
import { BoolCast, Cast, NumCast, StrCast } from '../../../new_fields/Types';
import { emptyFunction, Utils } from '../../../Utils';
-import { Docs, DocUtils, DocTypes } from '../../documents/Documents';
+import { Docs, DocUtils, DocumentType } from '../../documents/Documents';
import { DocumentManager } from '../../util/DocumentManager';
import { DragManager, dropActionType, SetupDrag } from "../../util/DragManager";
import { SelectionManager } from '../../util/SelectionManager';
@@ -316,7 +316,7 @@ class TreeView extends React.Component<TreeViewProps> {
}
@computed get docBounds() {
- if (StrCast(this.props.document.type).indexOf(DocTypes.COL) === -1) return undefined;
+ if (StrCast(this.props.document.type).indexOf(DocumentType.COL) === -1) return undefined;
let layoutDoc = Doc.expandTemplateLayout(this.props.document, this.props.dataDoc);
return Doc.ComputeContentBounds(layoutDoc);
}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 718552dc9..27b45db76 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -10,7 +10,7 @@ import { BoolCast, Cast, FieldValue, StrCast, NumCast, PromiseValue } from "../.
import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils";
import { emptyFunction, Utils, returnFalse, returnTrue } from "../../../Utils";
import { DocServer } from "../../DocServer";
-import { Docs, DocUtils, DocTypes } from "../../documents/Documents";
+import { Docs, DocUtils, DocumentType } from "../../documents/Documents";
import { DocumentManager } from "../../util/DocumentManager";
import { DragManager, dropActionType } from "../../util/DragManager";
import { SearchUtil } from "../../util/SearchUtil";
diff --git a/src/client/views/nodes/LinkMenu.tsx b/src/client/views/nodes/LinkMenu.tsx
index cccf3c329..1eda7d1fb 100644
--- a/src/client/views/nodes/LinkMenu.tsx
+++ b/src/client/views/nodes/LinkMenu.tsx
@@ -14,7 +14,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
library.add(faTrash);
import { Cast, FieldValue, StrCast } from "../../../new_fields/Types";
import { Id } from "../../../new_fields/FieldSymbols";
-import { DocTypes } from "../../documents/Documents";
+import { DocumentType } from "../../documents/Documents";
interface Props {
docView: DocumentView;
diff --git a/src/client/views/search/FilterBox.tsx b/src/client/views/search/FilterBox.tsx
index 23a1b31d8..c6c18f9b4 100644
--- a/src/client/views/search/FilterBox.tsx
+++ b/src/client/views/search/FilterBox.tsx
@@ -6,7 +6,7 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { library } from '@fortawesome/fontawesome-svg-core';
import { Doc } from '../../../new_fields/Doc';
import { Id } from '../../../new_fields/FieldSymbols';
-import { DocTypes } from '../../documents/Documents';
+import { DocumentType } from '../../documents/Documents';
import { Cast, StrCast } from '../../../new_fields/Types';
import * as _ from "lodash";
import { ToggleBar } from './ToggleBar';
@@ -32,7 +32,7 @@ export enum Keys {
export class FilterBox extends React.Component {
static Instance: FilterBox;
- public _allIcons: string[] = [DocTypes.AUDIO, DocTypes.COL, DocTypes.HIST, DocTypes.IMG, DocTypes.LINK, DocTypes.PDF, DocTypes.TEXT, DocTypes.VID, DocTypes.WEB];
+ public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.HIST, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.TEXT, DocumentType.VID, DocumentType.WEB];
//if true, any keywords can be used. if false, all keywords are required.
@observable private _basicWordStatus: boolean = true;
diff --git a/src/client/views/search/IconBar.tsx b/src/client/views/search/IconBar.tsx
index 744dd898a..4712b0abc 100644
--- a/src/client/views/search/IconBar.tsx
+++ b/src/client/views/search/IconBar.tsx
@@ -4,7 +4,7 @@ import { observable, action } from 'mobx';
// import "./SearchBox.scss";
import "./IconBar.scss";
import "./IconButton.scss";
-import { DocTypes } from '../../documents/Documents';
+import { DocumentType } from '../../documents/Documents';
import { faSearch, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote, faMusic, faLink, faChartBar, faGlobeAsia, faBan, faTimesCircle, faCheckCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
@@ -63,7 +63,7 @@ export class IconBar extends React.Component {
<div className="type-outer">
<div className={"type-icon all"}
onClick={this.selectAll}>
- <FontAwesomeIcon className="fontawesome-icon" icon={faCheckCircle} />
+ <FontAwesomeIcon className="fontawesome-icon" icon={faCheckCircle} />
</div>
<div className="filter-description">Select All</div>
</div>
diff --git a/src/client/views/search/IconButton.tsx b/src/client/views/search/IconButton.tsx
index 23ab42de0..bfe2c7d0b 100644
--- a/src/client/views/search/IconButton.tsx
+++ b/src/client/views/search/IconButton.tsx
@@ -6,7 +6,7 @@ import "./IconButton.scss";
import { faSearch, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote, faMusic, faLink, faChartBar, faGlobeAsia, faBan, faVideo, faCaretDown } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { library, icon } from '@fortawesome/fontawesome-svg-core';
-import { DocTypes } from '../../documents/Documents';
+import { DocumentType } from '../../documents/Documents';
import '../globalCssVariables.scss';
import * as _ from "lodash";
import { IconBar } from './IconBar';
@@ -80,25 +80,25 @@ export class IconButton extends React.Component<IconButtonProps>{
@action.bound
getIcon() {
switch (this.props.type) {
- case (DocTypes.NONE):
+ case (DocumentType.NONE):
return faBan;
- case (DocTypes.AUDIO):
+ case (DocumentType.AUDIO):
return faMusic;
- case (DocTypes.COL):
+ case (DocumentType.COL):
return faObjectGroup;
- case (DocTypes.HIST):
+ case (DocumentType.HIST):
return faChartBar;
- case (DocTypes.IMG):
+ case (DocumentType.IMG):
return faImage;
- case (DocTypes.LINK):
+ case (DocumentType.LINK):
return faLink;
- case (DocTypes.PDF):
+ case (DocumentType.PDF):
return faFilePdf;
- case (DocTypes.TEXT):
+ case (DocumentType.TEXT):
return faStickyNote;
- case (DocTypes.VID):
+ case (DocumentType.VID):
return faVideo;
- case (DocTypes.WEB):
+ case (DocumentType.WEB):
return faGlobeAsia;
default:
return faCaretDown;
@@ -149,25 +149,25 @@ export class IconButton extends React.Component<IconButtonProps>{
getFA = () => {
switch (this.props.type) {
- case (DocTypes.NONE):
+ case (DocumentType.NONE):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faBan} />);
- case (DocTypes.AUDIO):
+ case (DocumentType.AUDIO):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faMusic} />);
- case (DocTypes.COL):
+ case (DocumentType.COL):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faObjectGroup} />);
- case (DocTypes.HIST):
+ case (DocumentType.HIST):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faChartBar} />);
- case (DocTypes.IMG):
+ case (DocumentType.IMG):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faImage} />);
- case (DocTypes.LINK):
+ case (DocumentType.LINK):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faLink} />);
- case (DocTypes.PDF):
+ case (DocumentType.PDF):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faFilePdf} />);
- case (DocTypes.TEXT):
+ case (DocumentType.TEXT):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faStickyNote} />);
- case (DocTypes.VID):
+ case (DocumentType.VID):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faVideo} />);
- case (DocTypes.WEB):
+ case (DocumentType.WEB):
return (<FontAwesomeIcon className="fontawesome-icon" icon={faGlobeAsia} />);
default:
return (<FontAwesomeIcon className="fontawesome-icon" icon={faCaretDown} />);
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 87cae5487..b34103254 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -8,7 +8,7 @@ import { Doc, DocListCast, HeightSym, WidthSym } from "../../../new_fields/Doc";
import { Id } from "../../../new_fields/FieldSymbols";
import { Cast, NumCast, StrCast } from "../../../new_fields/Types";
import { emptyFunction, returnFalse, returnOne, Utils } from "../../../Utils";
-import { DocTypes } from "../../documents/Documents";
+import { DocumentType } from "../../documents/Documents";
import { DocumentManager } from "../../util/DocumentManager";
import { SetupDrag, DragManager } from "../../util/DragManager";
import { LinkManager } from "../../util/LinkManager";
@@ -119,7 +119,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
onPointerEnter={action(() => this._displayDim = this._useIcons ? 50 : Number(SEARCH_THUMBNAIL_SIZE))}
onPointerLeave={action(() => this._displayDim = 50)} >
<DocumentView
- fitToBox={StrCast(this.props.doc.type).indexOf(DocTypes.COL) !== -1 ? this.fitToBox : undefined}
+ fitToBox={StrCast(this.props.doc.type).indexOf(DocumentType.COL) !== -1 ? this.fitToBox : undefined}
Document={this.props.doc}
addDocument={returnFalse}
removeDocument={returnFalse}
@@ -142,15 +142,15 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
let layoutresult = StrCast(this.props.doc.type);
- let button = layoutresult.indexOf(DocTypes.PDF) !== -1 ? faFilePdf :
- layoutresult.indexOf(DocTypes.IMG) !== -1 ? faImage :
- layoutresult.indexOf(DocTypes.TEXT) !== -1 ? faStickyNote :
- layoutresult.indexOf(DocTypes.VID) !== -1 ? faFilm :
- layoutresult.indexOf(DocTypes.COL) !== -1 ? faObjectGroup :
- layoutresult.indexOf(DocTypes.AUDIO) !== -1 ? faMusic :
- layoutresult.indexOf(DocTypes.LINK) !== -1 ? faLink :
- layoutresult.indexOf(DocTypes.HIST) !== -1 ? faChartBar :
- layoutresult.indexOf(DocTypes.WEB) !== -1 ? faGlobeAsia :
+ let button = layoutresult.indexOf(DocumentType.PDF) !== -1 ? faFilePdf :
+ layoutresult.indexOf(DocumentType.IMG) !== -1 ? faImage :
+ layoutresult.indexOf(DocumentType.TEXT) !== -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;
return <div onPointerDown={action(() => { this._useIcons = false; this._displayDim = Number(SEARCH_THUMBNAIL_SIZE); })} >
<FontAwesomeIcon icon={button} size="2x" />
@@ -184,7 +184,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
pointerDown = (e: React.PointerEvent) => { e.preventDefault(); e.button === 0 && SearchBox.Instance.openSearch(e); }
highlightDoc = (e: React.PointerEvent) => {
- if (this.props.doc.type === DocTypes.LINK) {
+ if (this.props.doc.type === DocumentType.LINK) {
if (this.props.doc.anchor1 && this.props.doc.anchor2) {
let doc1 = Cast(this.props.doc.anchor1, Doc, null);
@@ -201,7 +201,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
unHighlightDoc = (e: React.PointerEvent) => {
- if (this.props.doc.type === DocTypes.LINK) {
+ if (this.props.doc.type === DocumentType.LINK) {
if (this.props.doc.anchor1 && this.props.doc.anchor2) {
let doc1 = Cast(this.props.doc.anchor1, Doc, null);