aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionMapView.scss18
-rw-r--r--src/client/views/collections/CollectionMapView.tsx30
-rw-r--r--src/client/views/collections/CollectionViewChromes.tsx18
3 files changed, 45 insertions, 21 deletions
diff --git a/src/client/views/collections/CollectionMapView.scss b/src/client/views/collections/CollectionMapView.scss
index c74433902..4956ad946 100644
--- a/src/client/views/collections/CollectionMapView.scss
+++ b/src/client/views/collections/CollectionMapView.scss
@@ -1,4 +1,22 @@
.collectionMapView-contents {
width: 100%;
height: 100%;
+}
+
+.loadingWrapper {
+ width: 100%;
+ height: 100%;
+ background-color: yellow;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+
+ .loadingGif {
+ align-self: center;
+ justify-self: center;
+ width: 20%;
+ height: 20%
+ }
} \ No newline at end of file
diff --git a/src/client/views/collections/CollectionMapView.tsx b/src/client/views/collections/CollectionMapView.tsx
index 2bf3d7c32..a2d3c328d 100644
--- a/src/client/views/collections/CollectionMapView.tsx
+++ b/src/client/views/collections/CollectionMapView.tsx
@@ -12,19 +12,19 @@ import React = require("react");
import { DocumentManager } from "../../util/DocumentManager";
import { UndoManager } from "../../util/UndoManager";
-type MapDocument = makeInterface<[typeof documentSchema]>;
-const MapDocument = makeInterface(documentSchema);
+type MapSchema = makeInterface<[typeof documentSchema]>;
+const MapSchema = makeInterface(documentSchema);
export type LocationData = google.maps.LatLngLiteral & { address?: string };
@observer
-class CollectionMapView extends CollectionSubView<MapDocument, Partial<MapProps> & { google: any }>(MapDocument) {
+class CollectionMapView extends CollectionSubView<MapSchema, Partial<MapProps> & { google: any }>(MapSchema) {
getLocation = (doc: Opt<Doc>, fieldKey: string) => {
if (doc) {
let lat: Opt<number> = Cast(doc[fieldKey + "-lat"], "number", null);
let lng: Opt<number> = Cast(doc[fieldKey + "-lng"], "number", null);
- let zoom: Opt<number> = Cast(doc[fieldKey + "-zoom"], "number", null);
+ const zoom: Opt<number> = Cast(doc[fieldKey + "-zoom"], "number", null);
const address = Cast(doc[fieldKey + "-address"], "string", null);
if (address) {
// use geo service to convert to lat/lng
@@ -79,12 +79,12 @@ class CollectionMapView extends CollectionSubView<MapDocument, Partial<MapProps>
google={this.props.google}
zoom={center.zoom || 10}
initialCenter={center}
- center={center}
- onBoundsChanged={e => console.log(e)}
- onRecenter={e => console.log(e)}
- onDragend={e => console.log(e)}
- onProjectionChanged={e => console.log(e)}
- onCenterChanged={(e => {
+ onBoundsChanged={(props, map, e) => console.log("ON_BOUNDS_CHANGED", props, map, e)}
+ onRecenter={(props, map, e) => console.log("ON_RECENTER", props, map, e)}
+ onDragend={(centerMoved, center) => console.log("ON_DRAGEND", centerMoved, center)}
+ onProjectionChanged={(props, map, e) => console.log("ON_PROJ_CHANGED", props, map, e)}
+ onCenterChanged={((props, map, e) => {
+ console.log("ON_CENTER_CHANGED", props, map, e);
Document[this.props.fieldKey + "-mapCenter-lat"] = typeof e?.center?.lat === "number" ? e.center.lat : center!.lat;
Document[this.props.fieldKey + "-mapCenter-lng"] = typeof e?.center?.lng === "number" ? e.center.lng : center!.lng;
})}
@@ -92,7 +92,9 @@ class CollectionMapView extends CollectionSubView<MapDocument, Partial<MapProps>
{childLayoutPairs.map(({ layout }) => {
let icon: Opt<google.maps.Icon>, iconUrl: Opt<string>;
if ((iconUrl = StrCast(Document.mapIconUrl, null))) {
- const iconSize = new google.maps.Size(NumCast(layout["mapLocation-iconWidth"], 45), NumCast(layout["mapLocation-iconHeight"], 45));
+ const iconWidth = NumCast(layout["mapLocation-iconWidth"], 45);
+ const iconHeight = NumCast(layout["mapLocation-iconHeight"], 45);
+ const iconSize = new google.maps.Size(iconWidth, iconHeight);
icon = {
size: iconSize,
scaledSize: iconSize,
@@ -107,4 +109,8 @@ class CollectionMapView extends CollectionSubView<MapDocument, Partial<MapProps>
}
-export default GoogleApiWrapper({ apiKey: process.env.GOOGLE_MAPS! })(CollectionMapView) as any; \ No newline at end of file
+const LoadingContainer = () => {
+ return <div className={"loadingWrapper"}><img className={"loadingGif"} src={"/assets/loading.gif"} /></div>;
+};
+
+export default GoogleApiWrapper({ apiKey: process.env.GOOGLE_MAPS!, LoadingContainer })(CollectionMapView) as any; \ No newline at end of file
diff --git a/src/client/views/collections/CollectionViewChromes.tsx b/src/client/views/collections/CollectionViewChromes.tsx
index e494c337a..66f627083 100644
--- a/src/client/views/collections/CollectionViewChromes.tsx
+++ b/src/client/views/collections/CollectionViewChromes.tsx
@@ -402,15 +402,15 @@ export class CollectionViewBaseChrome extends React.Component<CollectionViewChro
onPointerDown={stopPropagation}
onChange={this.viewChanged}
value={StrCast(this.props.CollectionView.props.Document._viewType)}>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="freeform">Freeform</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="schema">Schema</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="tree">Tree</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="stacking">Stacking</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="masonry">Masonry</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="multicolumn">MultiCol</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="multirow">MultiRow</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="time">Pivot/Time</option>
- <option className="collectionViewBaseChrome-viewOption" onPointerDown={stopPropagation} value="carousel">Carousel</option>
+ {Object.values(CollectionViewType).map(type => ["invalid", "docking"].includes(type) ? (null) : (
+ <option
+ key={Utils.GenerateGuid()}
+ className="collectionViewBaseChrome-viewOption"
+ onPointerDown={stopPropagation}
+ value={type}>
+ {type[0].toUpperCase() + type.substring(1)}
+ </option>
+ ))}
</select>
</div>
</div>