Skip to content

Commit af5744e

Browse files
committed
rename files to minimize change scope
1 parent 83040b7 commit af5744e

File tree

4 files changed

+69
-70
lines changed

4 files changed

+69
-70
lines changed

entry.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UserInterface } from "./lib/Views/UserInterface";
1+
import { UserInterface } from "./lib/Views/root";
22
import Variables from "./lib/Styles/variables.scss";
33
import { createRoot } from "react-dom/client";
44

lib/Views/TerriaUserInterface.jsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

lib/Views/UserInterface.jsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
import PropTypes from "prop-types";
2-
import React, { Suspense } from "react";
3-
import { useSyncExternalStore } from "react";
4-
import "./global.scss";
5-
import { Loader } from "./Loader";
6-
import { terriaStore } from "./terriaStore";
2+
import RelatedMaps from "terriajs/lib/ReactViews/RelatedMaps/RelatedMaps";
3+
import { MenuLeft } from "terriajs/lib/ReactViews/StandardUserInterface/customizable/Groups";
4+
import MenuItem from "terriajs/lib/ReactViews/StandardUserInterface/customizable/MenuItem";
5+
import StandardUserInterface from "terriajs/lib/ReactViews/StandardUserInterface/StandardUserInterface";
6+
import version from "../../version";
77

8-
// Lazy load the entire TerriaUserInterface component
9-
const LazyTerriaUserInterface = React.lazy(() =>
10-
import("./TerriaUserInterface").then((module) => ({
11-
default: module.TerriaUserInterface
12-
}))
13-
);
14-
15-
export const UserInterface = ({ themeOverrides }) => {
16-
const { terria, viewState, status } = useSyncExternalStore(
17-
terriaStore.subscribe,
18-
terriaStore.getSnapshot
19-
);
20-
21-
if (status === "loading") {
22-
return <Loader />;
23-
}
8+
export const TerriaUserInterface = ({ terria, viewState, themeOverrides }) => {
9+
const relatedMaps = viewState.terria.configParameters.relatedMaps;
10+
const aboutButtonHrefUrl =
11+
viewState.terria.configParameters.aboutButtonHrefUrl;
2412

2513
return (
26-
<Suspense fallback={<Loader />}>
27-
<LazyTerriaUserInterface
28-
terria={terria}
29-
viewState={viewState}
30-
themeOverrides={themeOverrides}
31-
/>
32-
</Suspense>
14+
<StandardUserInterface
15+
terria={terria}
16+
viewState={viewState}
17+
themeOverrides={themeOverrides}
18+
version={version}
19+
>
20+
<MenuLeft>
21+
{aboutButtonHrefUrl ? (
22+
<MenuItem
23+
caption="About"
24+
href={aboutButtonHrefUrl}
25+
key="about-link"
26+
/>
27+
) : null}
28+
{relatedMaps && relatedMaps.length > 0 ? (
29+
<RelatedMaps relatedMaps={relatedMaps} />
30+
) : null}
31+
</MenuLeft>
32+
</StandardUserInterface>
3333
);
3434
};
3535

36-
UserInterface.propTypes = {
36+
TerriaUserInterface.propTypes = {
37+
terria: PropTypes.object.isRequired,
38+
viewState: PropTypes.object.isRequired,
3739
themeOverrides: PropTypes.object
3840
};

lib/Views/root.jsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import PropTypes from "prop-types";
2+
import React, { Suspense, useSyncExternalStore } from "react";
3+
import "./global.scss";
4+
import { Loader } from "./Loader";
5+
import { terriaStore } from "./terriaStore";
6+
7+
// Lazy load the entire TerriaUserInterface component
8+
const LazyTerriaUserInterface = React.lazy(() =>
9+
import("./UserInterface").then((module) => ({
10+
default: module.TerriaUserInterface
11+
}))
12+
);
13+
14+
const UserInterface = ({ themeOverrides }) => {
15+
const { terria, viewState, status } = useSyncExternalStore(
16+
terriaStore.subscribe,
17+
terriaStore.getSnapshot
18+
);
19+
20+
if (status === "loading") {
21+
return <Loader />;
22+
}
23+
24+
return (
25+
<Suspense fallback={<Loader />}>
26+
<LazyTerriaUserInterface
27+
terria={terria}
28+
viewState={viewState}
29+
themeOverrides={themeOverrides}
30+
/>
31+
</Suspense>
32+
);
33+
};
34+
35+
UserInterface.propTypes = {
36+
themeOverrides: PropTypes.object
37+
};

0 commit comments

Comments
 (0)