Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions apps/geolibre-desktop/src/components/layout/DesktopShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,30 @@
}),
);

const ModelBuilderDialog = lazy(() =>
import("../processing/ModelBuilderDialog")
const BatchToolsDialog = lazy(() =>
import("../processing/BatchToolsDialog")
.then((module) => ({
default: module.ModelBuilderDialog,
default: module.BatchToolsDialog,
}))
.catch((error) => {
// Same chunk-load fallback rationale as ProcessingDialog above.
console.error("Failed to load ModelBuilderDialog", error);
console.error("Failed to load BatchToolsDialog", error);
const Fallback = (() =>
null) as unknown as typeof import("../processing/ModelBuilderDialog").ModelBuilderDialog;
null) as unknown as typeof import("../processing/BatchToolsDialog").BatchToolsDialog;
return { default: Fallback };
}),
);

const ModelBuilderPanel = lazy(() =>
import("../processing/model-builder/ModelBuilderPanel")
.then((module) => ({
default: module.ModelBuilderPanel,
}))
.catch((error) => {
// Same chunk-load fallback rationale as ProcessingDialog above.
console.error("Failed to load ModelBuilderPanel", error);
const Fallback = (() =>
null) as unknown as typeof import("../processing/model-builder/ModelBuilderPanel").ModelBuilderPanel;
return { default: Fallback };
}),
);
Expand Down Expand Up @@ -1754,7 +1768,7 @@
disposed = true;
unlisten?.();
};
}, [

Check warning on line 1771 in apps/geolibre-desktop/src/components/layout/DesktopShell.tsx

View workflow job for this annotation

GitHub Actions / Build and test

React Hook useEffect has a missing dependency: 't'. Either include it or remove the dependency array
clearDropMessageLater,
finishDrop,
addDroppedRasters,
Expand Down Expand Up @@ -1902,7 +1916,7 @@
clearDropMessageLater();
}
},
[

Check warning on line 1919 in apps/geolibre-desktop/src/components/layout/DesktopShell.tsx

View workflow job for this annotation

GitHub Actions / Build and test

React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array
clearDropMessageLater,
finishDrop,
addDroppedRasters,
Expand Down Expand Up @@ -2446,6 +2460,23 @@
>
<FloatingPanels />
</SectionErrorBoundary>
{/* Mounted inside the map area (like FloatingPanels) so the canvas
floats over the map and drag-clamps to it, not to the whole
window — the user keeps their layers in view while building. */}
<SectionErrorBoundary label="Model Builder" displayName={t("shell.section.modelBuilder")}>
<Suspense fallback={null}>
<ModelBuilderPanel
mapControllerRef={mapControllerRef}
onAddRaster={async (bytes, name, fileName) => {
// Same Uint8Array -> BlobPart cast as ProcessingDialog below.
const file = new File([bytes as BlobPart], fileName ?? `${name}.tif`, {
type: "image/tiff",
});
await addRasterToMap(createAppAPI(mapControllerRef), file, { name });
}}
/>
</Suspense>
</SectionErrorBoundary>
{/* Mounted here (inside the map area, like FloatingPanels) so the
selection panels anchor to the map canvas's top-left corner and
drag-clamp to the map, not the whole window (#1314). */}
Expand Down Expand Up @@ -2727,7 +2758,7 @@
<NetworkToolsDialog mapControllerRef={mapControllerRef} />
</Suspense>
<Suspense fallback={null}>
<ModelBuilderDialog mapControllerRef={mapControllerRef} />
<BatchToolsDialog mapControllerRef={mapControllerRef} />
</Suspense>
<Suspense fallback={null}>
<StatisticsToolsDialog mapControllerRef={mapControllerRef} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function ProcessingMenu({
const setVectorToolOpen = useAppStore((s) => s.setVectorToolOpen);
const setStatisticsToolOpen = useAppStore((s) => s.setStatisticsToolOpen);
const setGeocodeOpen = useAppStore((s) => s.setGeocodeOpen);
const setBatchToolsOpen = useAppStore((s) => s.setBatchToolsOpen);
const setModelBuilderOpen = useAppStore((s) => s.setModelBuilderOpen);
const setRasterToolOpen = useAppStore((s) => s.setRasterToolOpen);
const setSegmentationOpen = useAppStore((s) => s.setSegmentationOpen);
Expand Down Expand Up @@ -102,6 +103,7 @@ export function ProcessingMenu({
(!mobile && show("processing.raster"));
const showGeolibreActions =
show("processing.geocode") ||
show("processing.batchTools") ||
show("processing.modelBuilder") ||
(!mobile && show("processing.segmentation")) ||
show("processing.objectDetection") ||
Expand Down Expand Up @@ -498,6 +500,11 @@ export function ProcessingMenu({
{t("toolbar.item.geocode")}
</DropdownMenuItem>
)}
{show("processing.batchTools") && (
<DropdownMenuItem onSelect={() => setBatchToolsOpen(true)}>
{t("toolbar.item.batchTools")}
</DropdownMenuItem>
)}
{show("processing.modelBuilder") && (
<DropdownMenuItem onSelect={() => setModelBuilderOpen(true)}>
{t("toolbar.item.modelBuilder")}
Expand Down
Loading
Loading