((a, { layers, ...b }) => {
if (!b || !b.isVisible) {
return a;
}
- if (b.layers?.length) {
- return [...a, ...flattenLayers(b.layers)];
+ if (layers?.length) {
+ return [...a, { ...b, hiddden: true }, ...flattenLayers(layers)];
}
if (!b.pluginId || !b.extensionId) return a;
return [...a, b];
diff --git a/src/config.ts b/src/config.ts
index f74db3567..1548e120d 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -21,7 +21,7 @@ declare global {
export const defaultConfig: Config = {
api: "/api",
plugins: "/plugins",
- published: "/published.html?alias={}",
+ published: window.origin + "/p/{}",
};
export default async function loadConfig() {
diff --git a/src/theme/index.ts b/src/theme/index.ts
index 5116c9f34..55807fa2e 100644
--- a/src/theme/index.ts
+++ b/src/theme/index.ts
@@ -3,7 +3,7 @@ export * from "./styled";
export { default as colors } from "./colors";
export { default as styles } from "./styles";
export { default as fonts } from "./fonts";
-export { default as metrics } from "./metrics";
+export { default as metrics, metricsSizes } from "./metrics";
export { default } from "./darkTheme";
export { default as Provider } from "./provider";
export { default as PublishedAppProvider } from "./publishedAppProvider";
diff --git a/src/util/use-bind.ts b/src/util/use-bind.ts
index a495f8198..99a33e97d 100644
--- a/src/util/use-bind.ts
+++ b/src/util/use-bind.ts
@@ -7,10 +7,13 @@ export const useBind = an
p: P,
a?: A,
): { [K in keyof P]?: OmitFunc> } => {
- return mapValues(p, f => {
- // eslint-disable-next-line react-hooks/rules-of-hooks, react-hooks/exhaustive-deps
- return useMemo(() => (f && isPresent(a) ? (...args) => f(a, ...args) : undefined), [f, a]);
- });
+ return useMemo(
+ () =>
+ mapValues(p, f => {
+ return f && isPresent(a) ? (...args) => f(a, ...args) : undefined;
+ }),
+ [a, p],
+ );
};
export const useBind2 = any }, A, B>(
@@ -18,36 +21,33 @@ export const useBind2 =
> } => {
- return mapValues(p, f => {
- // eslint-disable-next-line react-hooks/rules-of-hooks
- return useMemo(
- () => (f && isPresent(a) && isPresent(b) ? (...args) => f(a, b, ...args) : undefined),
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [f, a, b],
- );
- });
+ return useMemo(
+ () =>
+ mapValues(p, f => {
+ return f && isPresent(a) && isPresent(b) ? (...args) => f(a, b, ...args) : undefined;
+ }),
+ [a, b, p],
+ );
};
export const useBind3 = <
P extends { [key in string]?: (a: A, b: B, ...args: any) => any },
A,
B,
- C
+ C,
>(
p: P,
a?: A,
b?: B,
c?: C,
): { [K in keyof P]?: OmitFunc3> } => {
- return mapValues(p, f => {
- // eslint-disable-next-line react-hooks/rules-of-hooks
- return useMemo(
- () =>
- f && isPresent(a) && isPresent(b) && isPresent(c)
+ return useMemo(
+ () =>
+ mapValues(p, f => {
+ return f && isPresent(a) && isPresent(b) && isPresent(c)
? (...args) => f(a, b, c, ...args)
- : undefined,
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [f, a, b, c],
- );
- });
+ : undefined;
+ }),
+ [p, a, b, c],
+ );
};
diff --git a/src/util/use-double-click.ts b/src/util/use-double-click.ts
index 01efecbe7..62f2a970e 100644
--- a/src/util/use-double-click.ts
+++ b/src/util/use-double-click.ts
@@ -1,18 +1,20 @@
import { useCallback, useRef } from "react";
const useDoubleClick = (
- onClick: () => void,
+ onClick: (() => void) | undefined,
onDoubleClick: (() => void) | undefined,
): [() => void, () => void] => {
const t = useRef();
const handleClick = useCallback(() => {
- t.current && clearTimeout(t.current);
- t.current = setTimeout(onClick, 200);
+ if (t.current) clearTimeout(t.current);
+ if (onClick) {
+ t.current = setTimeout(onClick, 200);
+ }
}, [onClick]);
const handleDoubleClick = useCallback(() => {
- t.current && clearTimeout(t.current);
+ if (t.current) clearTimeout(t.current);
onDoubleClick?.();
}, [onDoubleClick]);
diff --git a/webpack.config.js b/webpack.config.js
index cf102f1c6..f8fbee893 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -51,6 +51,7 @@ module.exports = (env, args = {}) => {
app.get("/reearth_config.json", (_req, res) => {
res.json({
api: "http://localhost:8080/api",
+ published: "/published.html?alias={}",
...Object.fromEntries(Object.entries(config).filter(([, v]) => Boolean(v))),
});
});
diff --git a/yarn.lock b/yarn.lock
index 561b95c82..2ad84d25c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15365,17 +15365,12 @@ react-clientside-effect@^1.2.2:
dependencies:
"@babel/runtime" "^7.12.13"
-react-colorful@^4.4.4:
- version "4.4.4"
- resolved "https://registry.yarnpkg.com/react-colorful/-/react-colorful-4.4.4.tgz#38e7c5b7075bbf63d3cce22d8c61a439a58b7561"
- integrity sha512-01V2/6rr6sa1vaZntWZJXZxnU7ew02NG2rqq0eoVp4d3gFU5Ug9lDzNMbr+8ns0byXsJbBR8LbwQTlAjz6x7Kg==
-
react-colorful@^5.0.1:
version "5.1.4"
resolved "https://registry.yarnpkg.com/react-colorful/-/react-colorful-5.1.4.tgz#7391568db7c0a4163436bfb076e5da8ef394e87c"
integrity sha512-WOEpRNz8Oo2SEU4eYQ279jEKFSjpFPa9Vi2U/K0DGwP9wOQ8wYkJcNSd5Qbv1L8OFvyKDCbWekjftXaU5mbmtg==
-react-colorful@^5.1.2:
+react-colorful@^5.1.2, react-colorful@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/react-colorful/-/react-colorful-5.3.0.tgz#bcbae49c1affa9ab9a3c8063398c5948419296bd"
integrity sha512-zWE5E88zmjPXFhv6mGnRZqKin9s5vip1O3IIGynY9EhZxN8MATUxZkT3e/9OwTEm4DjQBXc6PFWP6AetY+Px+A==