aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/documents/Documents.ts30
-rw-r--r--src/client/util/DocumentManager.ts2
-rw-r--r--src/client/util/convertToCSSPTValue.js12
-rw-r--r--src/client/util/jsx-decl.d.ts1
-rw-r--r--src/client/views/OCRUtils.ts7
-rw-r--r--src/client/views/collections/CollectionView.tsx4
-rw-r--r--src/client/views/nodes/DocumentContentsView.tsx3
-rw-r--r--src/client/views/nodes/DocumentView.tsx2
-rw-r--r--src/client/views/nodes/MapBox/MarkerIcons.tsx109
-rw-r--r--src/client/views/nodes/WebBox.tsx2
-rw-r--r--src/client/views/nodes/audio/AudioWaveform.tsx1
11 files changed, 88 insertions, 85 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index ff14eb101..0a4d3a294 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -59,9 +59,7 @@ import { WebBox } from '../views/nodes/WebBox';
import { SearchBox } from '../views/search/SearchBox';
import { CollectionViewType, DocumentType } from './DocumentTypes';
import { CalendarBox } from '../views/nodes/calendarBox/CalendarBox';
-const {
- default: { DFLT_IMAGE_NATIVE_DIM },
-} = require('../views/global/globalCssVariables.module.scss');
+const { default: { DFLT_IMAGE_NATIVE_DIM } } = require('../views/global/globalCssVariables.module.scss'); // prettier-ignore
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace('px', ''));
class EmptyBox {
@@ -179,7 +177,7 @@ export class DocumentOptions {
longitude?: NUMt = new NumInfo('longitude coordinate for map views', false);
routeCoordinates?: STRt = new StrInfo("stores a route's/direction's coordinates (stringified version)"); // for a route document, this stores the route's coordinates
markerType?: STRt = new StrInfo('Defines the marker type for a pushpin document');
- markerColor?: STRt= new StrInfo('Defines the marker color for a pushpin document');
+ markerColor?: STRt = new StrInfo('Defines the marker color for a pushpin document');
map?: STRt = new StrInfo('text location of map');
map_type?: STRt = new StrInfo('type of map view', false);
map_zoom?: NUMt = new NumInfo('zoom of a map view', false);
@@ -790,8 +788,8 @@ export namespace Docs {
{
layout: { view: CalendarBox, dataField: defaultDataKey },
options: {},
- }
- ]
+ },
+ ],
]);
const suffix = 'Proto';
@@ -1032,7 +1030,6 @@ export namespace Docs {
export function LoadingDocument(file: File | string, options: DocumentOptions) {
return InstanceFromProto(Prototypes.get(DocumentType.LOADING), undefined, { _height: 150, _width: 200, title: typeof file == 'string' ? file : file.name, ...options }, undefined, '');
}
-
export function RTFDocument(field: RichTextField, options: DocumentOptions = {}, fieldKey: string = 'text') {
return InstanceFromProto(Prototypes.get(DocumentType.RTF), field, options, undefined, fieldKey);
@@ -1139,14 +1136,7 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.MAP), new List(documents), options);
}
- export function PushpinDocument(
- latitude: number,
- longitude: number,
- infoWindowOpen: boolean,
- documents: Array<Doc>,
- options: DocumentOptions,
- id?: string) {
-
+ export function PushpinDocument(latitude: number, longitude: number, infoWindowOpen: boolean, documents: Array<Doc>, options: DocumentOptions, id?: string) {
return InstanceFromProto(Prototypes.get(DocumentType.PUSHPIN), new List(documents), { latitude, longitude, infoWindowOpen, ...options }, id);
}
@@ -1154,8 +1144,8 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.MAPROUTE), new List(documents), { infoWindowOpen, ...options }, id);
}
- export function CalendarDocument(options: DocumentOptions, documents: Array<Doc>){
- return InstanceFromProto(Prototypes.get(DocumentType.CALENDAR), new List(documents), {...options})
+ export function CalendarDocument(options: DocumentOptions, documents: Array<Doc>) {
+ return InstanceFromProto(Prototypes.get(DocumentType.CALENDAR), new List(documents), { ...options });
}
// shouldn't ever need to create a KVP document-- instead set the LayoutTemplateString to be a KeyValueBox for the DocumentView (see addDocTab in TabDocView)
@@ -1212,8 +1202,8 @@ export namespace Docs {
return doc;
}
- export function CalendarCollectionDocument(documents: Array<Doc>, options: DocumentOptions){
- return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), {...options, _type_collection: CollectionViewType.Calendar});
+ export function CalendarCollectionDocument(documents: Array<Doc>, options: DocumentOptions) {
+ return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _type_collection: CollectionViewType.Calendar });
}
export function StackingDocument(documents: Array<Doc>, options: DocumentOptions, id?: string, protoId?: string) {
@@ -2022,4 +2012,4 @@ ScriptingGlobals.add(function generateLinkTitle(link: Doc) {
const link_anchor_2title = link.link_anchor_2 && link.link_anchor_2 !== link ? Cast(link.link_anchor_2, Doc, null)?.title : '<?>';
const relation = link.link_relationship || 'to';
return `${link_anchor_1title} (${relation}) ${link_anchor_2title}`;
-}); \ No newline at end of file
+});
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 4816f3317..0101c2bcb 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -16,7 +16,7 @@ import { LinkAnchorBox } from '../views/nodes/LinkAnchorBox';
import { PresBox } from '../views/nodes/trails';
import { ScriptingGlobals } from './ScriptingGlobals';
import { SelectionManager } from './SelectionManager';
-const { Howl } = require('howler');
+import { Howl } from 'howler';
export class DocumentManager {
private static _instance: DocumentManager;
diff --git a/src/client/util/convertToCSSPTValue.js b/src/client/util/convertToCSSPTValue.js
index 179557953..66f8db5a1 100644
--- a/src/client/util/convertToCSSPTValue.js
+++ b/src/client/util/convertToCSSPTValue.js
@@ -1,18 +1,16 @@
'use strict';
-Object.defineProperty(exports, "__esModule", {
- value: true
+Object.defineProperty(exports, '__esModule', {
+ value: true,
});
exports.PT_TO_PX_RATIO = exports.PX_TO_PT_RATIO = undefined;
exports.default = convertToCSSPTValue;
exports.toClosestFontPtSize = toClosestFontPtSize;
-// var _FontSizeCommandMenuButton = require('./ui/FontSizeCommandMenuButton');
-
var SIZE_PATTERN = /([\d\.]+)(px|pt)/i;
-var PX_TO_PT_RATIO = exports.PX_TO_PT_RATIO = 0.7518796992481203; // 1 / 1.33.
-var PT_TO_PX_RATIO = exports.PT_TO_PX_RATIO = 1.33;
+var PX_TO_PT_RATIO = (exports.PX_TO_PT_RATIO = 0.7518796992481203); // 1 / 1.33.
+var PT_TO_PX_RATIO = (exports.PT_TO_PX_RATIO = 1.33);
function convertToCSSPTValue(styleValue) {
var matches = styleValue.match(SIZE_PATTERN);
@@ -40,4 +38,4 @@ function toClosestFontPtSize(styleValue) {
return _FontSizeCommandMenuButton.FONT_PT_SIZES.reduce(function (prev, curr) {
return Math.abs(curr - originalPTValue) < Math.abs(prev - originalPTValue) ? curr : prev;
}, Number.NEGATIVE_INFINITY);
-} \ No newline at end of file
+}
diff --git a/src/client/util/jsx-decl.d.ts b/src/client/util/jsx-decl.d.ts
deleted file mode 100644
index 532f06178..000000000
--- a/src/client/util/jsx-decl.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-declare module 'react-jsx-parser';
diff --git a/src/client/views/OCRUtils.ts b/src/client/views/OCRUtils.ts
deleted file mode 100644
index 282ec770e..000000000
--- a/src/client/views/OCRUtils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// import tesseract from "node-tesseract-ocr";
-// const tesseract = require("node-tesseract");
-
-
-export namespace OCRUtils {
-
-}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 0237ec95e..0656843cb 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -28,13 +28,11 @@ import { CollectionTreeView } from './CollectionTreeView';
import './CollectionView.scss';
import { CollectionFreeFormView } from './collectionFreeForm/CollectionFreeFormView';
import { CollectionGridView } from './collectionGrid/CollectionGridView';
-import { CollectionCalendarView} from './CollectionCalendarView';
+import { CollectionCalendarView } from './CollectionCalendarView';
import { CollectionLinearView } from './collectionLinear';
import { CollectionMulticolumnView } from './collectionMulticolumn/CollectionMulticolumnView';
import { CollectionMultirowView } from './collectionMulticolumn/CollectionMultirowView';
import { CollectionSchemaView } from './collectionSchema/CollectionSchemaView';
-const path = require('path');
-
interface CollectionViewProps_ extends FieldViewProps {
isAnnotationOverlay?: boolean; // is the collection an annotation overlay (eg an overlay on an image/video/etc)
isAnnotationOverlayScrollable?: boolean; // whether the annotation overlay can be vertically scrolled (just for tree views, currently)
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx
index 5b2bf4774..fa472312e 100644
--- a/src/client/views/nodes/DocumentContentsView.tsx
+++ b/src/client/views/nodes/DocumentContentsView.tsx
@@ -47,8 +47,7 @@ import { WebBox } from './WebBox';
import { FormattedTextBox } from './formattedText/FormattedTextBox';
import { ImportElementBox } from './importBox/ImportElementBox';
import { PresBox } from './trails/PresBox';
-
-const JsxParser = require('react-jsx-parser').default; //TODO Why does this need to be imported like this?
+import JsxParser from 'react-jsx-parser';
type BindingProps = Without<FieldViewProps, 'fieldKey'>;
export interface JsxBindings {
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 2d5f68a69..2752fa7f5 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -53,7 +53,7 @@ import { LinkAnchorBox } from './LinkAnchorBox';
import { FormattedTextBox } from './formattedText/FormattedTextBox';
import { PresEffect, PresEffectDirection } from './trails';
import { PinProps, PresBox } from './trails/PresBox';
-const { Howl } = require('howler');
+import { Howl } from 'howler';
interface Window {
MediaRecorder: MediaRecorder;
diff --git a/src/client/views/nodes/MapBox/MarkerIcons.tsx b/src/client/views/nodes/MapBox/MarkerIcons.tsx
index 146f296c1..a580fcaa0 100644
--- a/src/client/views/nodes/MapBox/MarkerIcons.tsx
+++ b/src/client/views/nodes/MapBox/MarkerIcons.tsx
@@ -1,11 +1,42 @@
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faShopify } from '@fortawesome/free-brands-svg-icons';
-import { faBasketball, faBicycle, faBowlFood, faBus, faCameraRetro, faCar, faCartShopping, faFilm, faFootball, faFutbol, faHockeyPuck, faHospital, faHotel, faHouse, faLandmark, faLocationDot, faLocationPin, faMapPin, faMasksTheater, faMugSaucer, faPersonHiking, faPlane, faSchool, faShirt, faShop, faSquareParking, faStar, faTrainSubway, faTree, faUtensils, faVolleyball } from '@fortawesome/free-solid-svg-icons';
+import {
+ faBasketball,
+ faBicycle,
+ faBowlFood,
+ faBus,
+ faCameraRetro,
+ faCar,
+ faCartShopping,
+ faFilm,
+ faFootball,
+ faFutbol,
+ faHockeyPuck,
+ faHospital,
+ faHotel,
+ faHouse,
+ faLandmark,
+ faLocationDot,
+ faLocationPin,
+ faMapPin,
+ faMasksTheater,
+ faMugSaucer,
+ faPersonHiking,
+ faPlane,
+ faSchool,
+ faShirt,
+ faShop,
+ faSquareParking,
+ faStar,
+ faTrainSubway,
+ faTree,
+ faUtensils,
+ faVolleyball,
+} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import React = require('react');
+import * as React from 'react';
export class MarkerIcons {
-
// static getMapboxIcon = (color: string) => {
// return (
// <svg xmlns="http://www.w3.org/2000/svg" id="marker" data-name="marker" width="20" height="48" viewBox="0 0 20 35">
@@ -34,43 +65,39 @@ export class MarkerIcons {
iconProps.color = color;
}
- return (<FontAwesomeIcon {...iconProps} size={size} />);
-
-
- }
-
- static FAMarkerIconsMap: {[key: string]: IconProp} = {
- 'MAP_PIN': faLocationDot,
- 'RESTAURANT_ICON': faUtensils,
- 'HOTEL_ICON': faHotel,
- 'HOUSE_ICON': faHouse,
- 'AIRPLANE_ICON': faPlane,
- 'CAR_ICON': faCar,
- 'BUS_ICON': faBus,
- 'TRAIN_ICON': faTrainSubway,
- 'BICYCLE_ICON': faBicycle,
- 'PARKING_ICON': faSquareParking,
- 'PHOTO_ICON': faCameraRetro,
- 'CAFE_ICON': faMugSaucer,
- 'STAR_ICON': faStar,
- 'SHOPPING_CART_ICON': faCartShopping,
- 'SHOPIFY_ICON': faShopify,
- 'SHOP_ICON': faShop,
- 'SHIRT_ICON': faShirt,
- 'FOOD_ICON': faBowlFood,
- 'LANDMARK_ICON': faLandmark,
- 'HOSPITAL_ICON': faHospital,
- 'NATURE_ICON': faTree,
- 'HIKING_ICON': faPersonHiking,
- 'SOCCER_ICON': faFutbol,
- 'VOLLEYBALL_ICON': faVolleyball,
- 'BASKETBALL_ICON': faBasketball,
- 'HOCKEY_ICON': faHockeyPuck,
- 'FOOTBALL_ICON': faFootball,
- 'SCHOOL_ICON': faSchool,
- 'THEATER_ICON': faMasksTheater,
- 'FILM_ICON': faFilm
+ return <FontAwesomeIcon {...iconProps} size={size} />;
}
-
-} \ No newline at end of file
+ static FAMarkerIconsMap: { [key: string]: IconProp } = {
+ MAP_PIN: faLocationDot,
+ RESTAURANT_ICON: faUtensils,
+ HOTEL_ICON: faHotel,
+ HOUSE_ICON: faHouse,
+ AIRPLANE_ICON: faPlane,
+ CAR_ICON: faCar,
+ BUS_ICON: faBus,
+ TRAIN_ICON: faTrainSubway,
+ BICYCLE_ICON: faBicycle,
+ PARKING_ICON: faSquareParking,
+ PHOTO_ICON: faCameraRetro,
+ CAFE_ICON: faMugSaucer,
+ STAR_ICON: faStar,
+ SHOPPING_CART_ICON: faCartShopping,
+ SHOPIFY_ICON: faShopify,
+ SHOP_ICON: faShop,
+ SHIRT_ICON: faShirt,
+ FOOD_ICON: faBowlFood,
+ LANDMARK_ICON: faLandmark,
+ HOSPITAL_ICON: faHospital,
+ NATURE_ICON: faTree,
+ HIKING_ICON: faPersonHiking,
+ SOCCER_ICON: faFutbol,
+ VOLLEYBALL_ICON: faVolleyball,
+ BASKETBALL_ICON: faBasketball,
+ HOCKEY_ICON: faHockeyPuck,
+ FOOTBALL_ICON: faFootball,
+ SCHOOL_ICON: faSchool,
+ THEATER_ICON: faMasksTheater,
+ FILM_ICON: faFilm,
+ };
+}
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 57045e2af..2522a674d 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -1,4 +1,5 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { htmlToText } from 'html-to-text';
import { action, computed, IReactionDisposer, makeObservable, observable, ObservableMap, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
@@ -39,7 +40,6 @@ import { PinProps, PresBox } from './trails';
import './WebBox.scss';
const { CreateImage } = require('./WebBoxRenderer');
const _global = (window /* browser */ || global) /* node */ as any;
-const htmlToText = require('html-to-text');
@observer
export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps & FieldViewProps>() {
public static LayoutString(fieldKey: string) {
diff --git a/src/client/views/nodes/audio/AudioWaveform.tsx b/src/client/views/nodes/audio/AudioWaveform.tsx
index 01392c4a5..c034d95ea 100644
--- a/src/client/views/nodes/audio/AudioWaveform.tsx
+++ b/src/client/views/nodes/audio/AudioWaveform.tsx
@@ -16,7 +16,6 @@ import { ObservableReactComponent } from '../../ObservableReactComponent';
* AudioWaveform
*
* Used in CollectionStackedTimeline to render a canvas with a visual of an audio waveform for AudioBox and VideoBox documents.
- * Uses react-audio-waveform package.
* Bins the audio data into audioBuckets which are passed to package to render the lines.
* Calculates new buckets each time a new zoom factor or new set of trim bounds is created and stores it in a field on the layout doc with a title indicating the bounds and zoom for that list (see audioBucketField)
*/