11import PropTypes from "prop-types" ;
2- import React from "react" ;
2+ import { useSyncExternalStore } from "react" ;
33import RelatedMaps from "terriajs/lib/ReactViews/RelatedMaps/RelatedMaps" ;
4- import {
5- ExperimentalMenu ,
6- MenuLeft
7- } from "terriajs/lib/ReactViews/StandardUserInterface/customizable/Groups" ;
4+ import { MenuLeft } from "terriajs/lib/ReactViews/StandardUserInterface/customizable/Groups" ;
85import MenuItem from "terriajs/lib/ReactViews/StandardUserInterface/customizable/MenuItem" ;
96import StandardUserInterface from "terriajs/lib/ReactViews/StandardUserInterface/StandardUserInterface" ;
107import version from "../../version" ;
118import "./global.scss" ;
9+ import { Loader } from "./Loader" ;
10+ import { terriaStore } from "./terriaStore" ;
1211
13- export default function UserInterface ( props ) {
14- const relatedMaps = props . viewState . terria . configParameters . relatedMaps ;
12+ export const UserInterface = ( { themeOverrides } ) => {
13+ const { terria, viewState, status } = useSyncExternalStore (
14+ terriaStore . subscribe ,
15+ terriaStore . getSnapshot
16+ ) ;
17+
18+ if ( status === "loading" ) {
19+ return < Loader /> ;
20+ }
21+ const relatedMaps = viewState . terria . configParameters . relatedMaps ;
1522 const aboutButtonHrefUrl =
16- props . viewState . terria . configParameters . aboutButtonHrefUrl ;
23+ viewState . terria . configParameters . aboutButtonHrefUrl ;
1724
1825 return (
19- < StandardUserInterface { ...props } version = { version } >
26+ < StandardUserInterface
27+ terria = { terria }
28+ viewState = { viewState }
29+ themeOverrides = { themeOverrides }
30+ version = { version }
31+ >
2032 < MenuLeft >
2133 { aboutButtonHrefUrl ? (
2234 < MenuItem
@@ -29,12 +41,11 @@ export default function UserInterface(props) {
2941 < RelatedMaps relatedMaps = { relatedMaps } />
3042 ) : null }
3143 </ MenuLeft >
32- < ExperimentalMenu />
44+ { /* <ExperimentalMenu /> */ }
3345 </ StandardUserInterface >
3446 ) ;
35- }
47+ } ;
3648
3749UserInterface . propTypes = {
38- terria : PropTypes . object ,
39- viewState : PropTypes . object
50+ themeOverrides : PropTypes . object
4051} ;
0 commit comments