{(provided) => (
{(() => {
diff --git a/client/src/components/layer-editor/LayerEditor.tsx b/client/src/components/layer-editor/LayerEditor.tsx
index d0f65f9..3c41213 100644
--- a/client/src/components/layer-editor/LayerEditor.tsx
+++ b/client/src/components/layer-editor/LayerEditor.tsx
@@ -26,17 +26,9 @@ import {
startCase,
truncate,
} from "lodash";
-import {
- ForwardedRef,
- ReactNode,
- createElement,
- forwardRef,
- useEffect,
- useMemo,
- useState,
-} from "react";
+import { ReactNode, createElement, useEffect, useMemo, useState } from "react";
import { Layer } from "slices/layers";
-import { useAcrylic, usePaper } from "theme";
+import { usePaper } from "theme";
const compositeOperations = [
"color",
@@ -100,7 +92,10 @@ function useDraft(
] as const;
}
-function Component({ value, onValueChange: onChange }: LayerEditorProps) {
+export function LayerEditor({
+ value,
+ onValueChange: onChange,
+}: LayerEditorProps) {
const paper = usePaper();
const [draft, setDraft] = useDraft(value, onChange, 300, [
"name",
@@ -273,5 +268,3 @@ function Component({ value, onValueChange: onChange }: LayerEditorProps) {
>
);
}
-
-export const LayerEditor = forwardRef(Component);
diff --git a/client/src/layers/trace/index.tsx b/client/src/layers/trace/index.tsx
index a10cda5..5c2fbc7 100644
--- a/client/src/layers/trace/index.tsx
+++ b/client/src/layers/trace/index.tsx
@@ -172,7 +172,7 @@ export const controller = {
notify("Opening trace...");
try {
const output = readUploadedTrace(file);
- return { trace: { ...(await output.read()) } };
+ return { trace: await output.read() };
} catch (e) {
console.error(e);
notify(`Error opening, ${get(e, "message")}`);
@@ -274,7 +274,7 @@ export const controller = {
const parsedTrace = await parseTrace();
produce((l) => {
set(l, "source.parsedTrace", parsedTrace);
- // set(l, "viewKey", id());
+ set(l, "viewKey", id());
});
}
}, [loading, parseTrace]);
diff --git a/client/src/pages/SettingsPage.tsx b/client/src/pages/SettingsPage.tsx
index 9f79157..144490e 100644
--- a/client/src/pages/SettingsPage.tsx
+++ b/client/src/pages/SettingsPage.tsx
@@ -289,6 +289,10 @@ export function SettingsPage({ template: Page }: PageContentProps) {
const a = keys(mapParsers).map((c) => ({ key: c }));
type A = (typeof a)[number];
+function Sink({ children }: { children?: ReactNode }) {
+ return children;
+}
+
export function MapParserListEditor() {
return (
@@ -298,12 +302,12 @@ export function MapParserListEditor() {
addable={false}
deletable={false}
editor={(v) => (
-
+
-
+
)}
icon={null}
value={a}
diff --git a/client/src/pages/TreePage.tsx b/client/src/pages/TreePage.tsx
index 709af8e..9f7a736 100644
--- a/client/src/pages/TreePage.tsx
+++ b/client/src/pages/TreePage.tsx
@@ -219,7 +219,7 @@ export function TreeGraph({
});
const numParents: Dictionary> = {};
- forEach(trace?.events, ({ id, pId, type }, i) => {
+ forEach(trace?.events, ({ id, pId }) => {
if (id && pId) {
numParents[id] = numParents[id] ?? new Set();
numParents[id].add(pId);
@@ -400,8 +400,6 @@ export function TreePage({ template: Page }: PageContentProps) {
const [trackedProperty, setTrackedProperty] = useState("");
const trace = layer?.source?.trace?.content;
- const lastModified = layer?.source?.trace?.lastModified;
- const id = layer?.source?.trace?.key;
// Reset tracked property
useEffect(() => {
@@ -422,12 +420,7 @@ export function TreePage({ template: Page }: PageContentProps) {
return { events, current: findLast(events, (c) => c.step <= step) };
}, [selection, step]);
- const params = useMemo(
- () => ({ trace, mode }),
- [trace, id, lastModified, mode]
- );
-
- const { result: tree, loading } = useTreeMemo(params, [params]);
+ const { result: tree, loading } = useTreeMemo({ trace, mode }, [key, mode]);
const settings = useMemo(
() =>
diff --git a/client/src/pages/ViewportPage.tsx b/client/src/pages/ViewportPage.tsx
index ec2e050..e391388 100644
--- a/client/src/pages/ViewportPage.tsx
+++ b/client/src/pages/ViewportPage.tsx
@@ -1,5 +1,6 @@
import {
BlurCircularOutlined,
+ CameraOutlined,
CenterFocusWeakOutlined,
LayersOutlined,
TimesOneMobiledataOutlined,
@@ -11,6 +12,7 @@ import { Flex } from "components/generic/Flex";
import { IconButtonWithTooltip } from "components/generic/IconButtonWithTooltip";
import { TraceRenderer } from "components/inspector/TraceRenderer";
import { useViewTreeContext } from "components/inspector/ViewTree";
+import download from "downloadjs";
import { inferLayerName } from "layers/inferLayerName";
import {
Dictionary,
@@ -29,6 +31,7 @@ import { useLayers } from "slices/layers";
import { Renderer, useRenderers } from "slices/renderers";
import { PanelState } from "slices/view";
import { useAcrylic, usePaper } from "theme";
+import { generateUsername as id } from "unique-username-generator";
import { PageContentProps } from "./PageMeta";
import { useRendererResolver } from "./useRendererResolver";
@@ -122,7 +125,6 @@ export function ViewportPage({ template: Page }: PageContentProps) {
label="Fit"
icon={}
/>
- {divider}
}
label="1 to 1"
/>
+ {divider}
+ {
+ const a = await rendererInstance?.toDataUrl();
+ if (a) {
+ download(a, id("-"));
+ }
+ }}
+ icon={}
+ label="capture-screenshot"
+ />
diff --git a/client/src/services/BootstrapService.tsx b/client/src/services/BootstrapService.tsx
index f6f8680..9d5e4c2 100644
--- a/client/src/services/BootstrapService.tsx
+++ b/client/src/services/BootstrapService.tsx
@@ -6,9 +6,8 @@ export function BootstrapService() {
const { load } = useWorkspace();
useAsync(async () => {
try {
- const param = new URLSearchParams(location.search).get("workspace");
- if (param) {
- const workspace = decodeURIComponent(param);
+ const workspace = new URLSearchParams(location.search).get("workspace");
+ if (workspace && isWorkspace(workspace)) {
if (isWorkspace(workspace)) {
const name = workspace.split("/").pop() ?? workspace;
const a = await fetch(workspace);
diff --git a/client/src/services/LayerService.tsx b/client/src/services/LayerService.tsx
index 3d0b7be..841cec1 100644
--- a/client/src/services/LayerService.tsx
+++ b/client/src/services/LayerService.tsx
@@ -6,7 +6,7 @@ import { useSyncStatus } from "./SyncService";
function useLayerServices() {
const { isPrimary } = useSyncStatus();
- const [{ layers }, setLayers] = useLayers();
+ const [{ layers }, setLayers, , c1] = useLayers();
return useMemo(() => {
return !isPrimary
? []
@@ -23,7 +23,7 @@ function useLayerServices() {
});
}
});
- }, [layers, setLayers, isPrimary]);
+ }, [c1, setLayers, isPrimary]);
}
export function LayerService() {
diff --git a/client/src/services/SettingsService.tsx b/client/src/services/SettingsService.tsx
index 78afc08..498c2bb 100644
--- a/client/src/services/SettingsService.tsx
+++ b/client/src/services/SettingsService.tsx
@@ -8,7 +8,8 @@ export function SettingsService() {
useSettings();
const [, setUIState] = useUIState();
useEffect(() => {
- if (!minimal && showOnStart && initialised) {
+ const workspace = new URLSearchParams(location.search).get("workspace");
+ if (!minimal && showOnStart && initialised && !workspace) {
setUIState(() => ({ fullscreenModal: showOnStart }));
}
}, [initialised, minimal]);
diff --git a/client/vite.config.ts b/client/vite.config.ts
index d6e43ac..dc07e22 100644
--- a/client/vite.config.ts
+++ b/client/vite.config.ts
@@ -16,7 +16,7 @@ export default defineConfig(({ mode }) => ({
plugins: [
react({
babel: {
- plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
+ // plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
},
}),
viteTsconfigPaths(),
diff --git a/package-lock.json b/package-lock.json
index dc8d126..c0b7df0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,55 @@
"name": "app",
"version": "1.0.5",
"hasInstallScript": true,
- "license": "ISC"
+ "license": "ISC",
+ "dependencies": {
+ "react": "^19.0.0-beta-26f2496093-20240514",
+ "react-dom": "^19.0.0-beta-26f2496093-20240514"
+ }
+ },
+ "node_modules/react": {
+ "version": "19.0.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.0.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-ZsU/WjNZ6GfzMWsq2DcGjElpV9it8JmETHm9mAJuOJNhuJcWJxt8ltCJabONFRpDFq1A/DP0d0KFj9CTJVM4VA==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.0.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-UvQ+K1l3DFQ34LDgfFSNuUGi9EC+yfE9tS6MdpNTd5fx7qC7KLfepfC/KpxWMQZ7JfE3axD4ZO6H4cBSpAZpqw==",
+ "dependencies": {
+ "scheduler": "0.25.0-beta-26f2496093-20240514"
+ },
+ "peerDependencies": {
+ "react": "19.0.0-beta-26f2496093-20240514"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.25.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-vDwOytLHFnA3SW2B1lNcbO+/qKVyLCX+KLpm+tRGNDsXpyxzRgkIaYGWmX+S70AJGchUHCtuqQ50GFeFgDbXUw=="
+ }
+ },
+ "dependencies": {
+ "react": {
+ "version": "19.0.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.0.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-ZsU/WjNZ6GfzMWsq2DcGjElpV9it8JmETHm9mAJuOJNhuJcWJxt8ltCJabONFRpDFq1A/DP0d0KFj9CTJVM4VA=="
+ },
+ "react-dom": {
+ "version": "19.0.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-UvQ+K1l3DFQ34LDgfFSNuUGi9EC+yfE9tS6MdpNTd5fx7qC7KLfepfC/KpxWMQZ7JfE3axD4ZO6H4cBSpAZpqw==",
+ "requires": {
+ "scheduler": "0.25.0-beta-26f2496093-20240514"
+ }
+ },
+ "scheduler": {
+ "version": "0.25.0-beta-26f2496093-20240514",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0-beta-26f2496093-20240514.tgz",
+ "integrity": "sha512-vDwOytLHFnA3SW2B1lNcbO+/qKVyLCX+KLpm+tRGNDsXpyxzRgkIaYGWmX+S70AJGchUHCtuqQ50GFeFgDbXUw=="
}
}
}
diff --git a/package.json b/package.json
index 896db18..3d56e93 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,9 @@
"url": "https://github.com/ShortestPathLab/posthoc-app/issues"
},
"homepage": "posthoc.pathfinding.ai",
- "dependencies": {},
+ "dependencies": {
+ "react": "^19.0.0-beta-26f2496093-20240514",
+ "react-dom": "^19.0.0-beta-26f2496093-20240514"
+ },
"type": "module"
}