From 6642cbbc3da79d06c23c44d442709761232e78ac Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Sun, 8 Sep 2024 19:11:45 +1000 Subject: [PATCH] Tweaks from review. --- lib/Core/getDataType.ts | 4 ++-- lib/ModelMixins/CesiumIonMixin.ts | 6 ++++++ lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/AddData.jsx | 5 ++++- .../ExplorerWindow/Tabs/MyDataTab/CesiumIonConnector.tsx | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/Core/getDataType.ts b/lib/Core/getDataType.ts index db7bbaf657..da6d139b53 100644 --- a/lib/Core/getDataType.ts +++ b/lib/Core/getDataType.ts @@ -1,12 +1,12 @@ import i18next from "i18next"; import { action, observable } from "mobx"; -import { ReactComponentLike } from "prop-types"; +import { type ComponentType } from "react"; interface DataType { value: string; name: string; description?: string; - customComponent?: ReactComponentLike; + customComponent?: ComponentType; } export interface RemoteDataType extends DataType {} diff --git a/lib/ModelMixins/CesiumIonMixin.ts b/lib/ModelMixins/CesiumIonMixin.ts index 6c632c047f..852fcee695 100644 --- a/lib/ModelMixins/CesiumIonMixin.ts +++ b/lib/ModelMixins/CesiumIonMixin.ts @@ -8,6 +8,12 @@ import IonResource from "terriajs-cesium/Source/Core/IonResource"; type BaseType = Model; +/** + * A mixin for a model that can be loaded from Cesium ion via an `ionAssetId`. If an asset ID is supplied, + * the `ionResource` will be populated asynchronously after `loadIonResource` is called (usually from + * `forceLoadMetadata`). If defined, the resource in this property should be used as the "URL" given to + * CesiumJS instead of a regular URL. + */ export default function CesiumIonMixin>( Base: T ) { diff --git a/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/AddData.jsx b/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/AddData.jsx index 61b290f71e..354a84edf3 100644 --- a/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/AddData.jsx +++ b/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/AddData.jsx @@ -1,5 +1,6 @@ import createReactClass from "create-react-class"; import { observer } from "mobx-react"; +import { runInAction } from "mobx"; import PropTypes from "prop-types"; import React from "react"; import { Trans, withTranslation } from "react-i18next"; @@ -76,7 +77,9 @@ class AddData extends React.Component { } selectRemoteOption(option) { - this.props.viewState.remoteDataType = option; + runInAction(() => { + this.props.viewState.remoteDataType = option; + }); } handleUploadFile(e) { diff --git a/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/CesiumIonConnector.tsx b/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/CesiumIonConnector.tsx index b028f01a5a..304bf5bb22 100644 --- a/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/CesiumIonConnector.tsx +++ b/lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/CesiumIonConnector.tsx @@ -461,7 +461,7 @@ function CesiumIonConnector() { function renderAssetRow(asset: CesiumIonAsset) { return ( - +