From 5ca22c79ecac2d2147258449324d7f6f4d538a98 Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Tue, 15 Oct 2024 10:29:20 +0200 Subject: [PATCH] wip --- frontend/package-lock.json | 97 ------------------- frontend/package.json | 1 - .../src/lib/components/MenuButton/index.ts | 0 .../lib/components/MenuButton/menuButton.tsx | 19 ++++ .../layers/components/LayersActions.tsx | 16 ++- .../layers/components/ViewComponent.tsx | 12 ++- .../view/components/ReadoutWrapper.tsx | 1 - .../customDeckGlLayers/AdvancedWellsLayer.ts | 2 + .../customDeckGlLayers/WellborePicksLayer.ts | 3 +- 9 files changed, 39 insertions(+), 112 deletions(-) create mode 100644 frontend/src/lib/components/MenuButton/index.ts create mode 100644 frontend/src/lib/components/MenuButton/menuButton.tsx diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a933a3bb5..35804b4bd 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,7 +8,6 @@ "name": "webviz", "version": "0.0.0", "dependencies": { - "@deck.gl/carto": "^8.9.35", "@equinor/eds-core-react": "^0.42.0", "@equinor/eds-icons": "^0.21.0", "@equinor/esv-intersection": "^3.0.10", @@ -505,45 +504,6 @@ "@luma.gl/core": "^8.0.0" } }, - "node_modules/@deck.gl/carto": { - "version": "8.9.35", - "resolved": "https://registry.npmjs.org/@deck.gl/carto/-/carto-8.9.35.tgz", - "integrity": "sha512-Ln9yFQqagQ5Zpfl5SUJl/09lw0S9zkpSVeay976aSPnQt9U7L4ES5lxOZZBQvxHmKATmar5B5V36vXaW2bAezQ==", - "dependencies": { - "@babel/runtime": "^7.0.0", - "@loaders.gl/gis": "^3.4.13", - "@loaders.gl/loader-utils": "^3.4.13", - "@loaders.gl/mvt": "^3.4.13", - "@loaders.gl/tiles": "^3.4.13", - "@luma.gl/constants": "^8.5.21", - "@math.gl/web-mercator": "^3.6.2", - "cartocolor": "^4.0.2", - "d3-array": "^3.2.0", - "d3-color": "^3.1.0", - "d3-format": "^3.1.0", - "d3-scale": "^4.0.0", - "h3-js": "^3.7.0", - "moment-timezone": "^0.5.33", - "pbf": "^3.2.1", - "quadbin": "^0.1.9" - }, - "peerDependencies": { - "@deck.gl/aggregation-layers": "^8.0.0", - "@deck.gl/core": "^8.0.0", - "@deck.gl/extensions": "^8.0.0", - "@deck.gl/geo-layers": "^8.0.0", - "@deck.gl/layers": "^8.0.0", - "@loaders.gl/core": "^3.4.13" - } - }, - "node_modules/@deck.gl/carto/node_modules/d3-format": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", - "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", - "engines": { - "node": ">=12" - } - }, "node_modules/@deck.gl/core": { "version": "8.9.35", "resolved": "https://registry.npmjs.org/@deck.gl/core/-/core-8.9.35.tgz", @@ -2039,14 +1999,6 @@ "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" }, - "node_modules/@mapbox/tile-cover": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@mapbox/tile-cover/-/tile-cover-3.0.1.tgz", - "integrity": "sha512-R8aoFY/87HWBOL9E2eBqzOY2lpfWYXCcTNgBpIxAv67rqQeD4IfnHD0iPXg/Z1cqXrklegEYZCp/7ZR/RsWqBQ==", - "dependencies": { - "tilebelt": "^1.0.1" - } - }, "node_modules/@mapbox/tiny-sdf": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.6.tgz", @@ -7235,14 +7187,6 @@ "element-size": "^1.1.1" } }, - "node_modules/cartocolor": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cartocolor/-/cartocolor-4.0.2.tgz", - "integrity": "sha512-+Gh9mb6lFxsDOLQlBLPxAHCnWXlg2W8q3AcVwqRcy95TdBbcOU89Wrb6h2Hd/6Ww1Kc1pzXmUdpnWD+xeCG0dg==", - "dependencies": { - "colorbrewer": "1.0.0" - } - }, "node_modules/chai": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.0.tgz", @@ -7431,11 +7375,6 @@ "mumath": "^3.3.4" } }, - "node_modules/colorbrewer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/colorbrewer/-/colorbrewer-1.0.0.tgz", - "integrity": "sha512-NZuIOVdErK/C6jDH3jWT/roxWJbJAinMiqEpbuWniKvQAoWdg6lGra3pPrSHvaIf8PlX8wLs/RAC6nULFJbgmg==" - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -11956,25 +11895,6 @@ "ufo": "^1.3.0" } }, - "node_modules/moment": { - "version": "2.30.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", - "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", - "engines": { - "node": "*" - } - }, - "node_modules/moment-timezone": { - "version": "0.5.46", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.46.tgz", - "integrity": "sha512-ZXm9b36esbe7OmdABqIWJuBBiLLwAjrN7CE+7sYdCCx82Nabt1wHDj8TVseS59QIlfFPbOoiBPm6ca9BioG4hw==", - "dependencies": { - "moment": "^2.29.4" - }, - "engines": { - "node": "*" - } - }, "node_modules/mouse-change": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/mouse-change/-/mouse-change-1.4.0.tgz", @@ -13172,17 +13092,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/quadbin": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/quadbin/-/quadbin-0.1.9.tgz", - "integrity": "sha512-5V6m6+cL/6+uBl3hYL+CWF06rRvlHkIepYKGQjTLYaHhu9InPppql0+0ROiCaOQdz8gPNlgge3glk5Qg1mWOYw==", - "dependencies": { - "@mapbox/tile-cover": "3.0.1" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -14650,12 +14559,6 @@ "xtend": "~4.0.1" } }, - "node_modules/tilebelt": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tilebelt/-/tilebelt-1.0.1.tgz", - "integrity": "sha512-cxHzpa5JgsugY9NUVRH43gPaGJw/29LecAn4X7UGOP64+kB8pU4VQ3bIhSyfb5Mk4jDxwl3yk330L/EIhbJ5aw==", - "deprecated": "This module is now under the @mapbox namespace: install @mapbox/tilebelt instead" - }, "node_modules/tiny-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 0b5fe086f..d31c8eb9c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,7 +19,6 @@ "test:ct:ui": "playwright test -c playwright.ct.config.ts --ui" }, "dependencies": { - "@deck.gl/carto": "^8.9.35", "@equinor/eds-core-react": "^0.42.0", "@equinor/eds-icons": "^0.21.0", "@equinor/esv-intersection": "^3.0.10", diff --git a/frontend/src/lib/components/MenuButton/index.ts b/frontend/src/lib/components/MenuButton/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/lib/components/MenuButton/menuButton.tsx b/frontend/src/lib/components/MenuButton/menuButton.tsx new file mode 100644 index 000000000..e48e24875 --- /dev/null +++ b/frontend/src/lib/components/MenuButton/menuButton.tsx @@ -0,0 +1,19 @@ +import React from "react"; + +import { MenuButton as MuiMenuButton } from "@mui/base/MenuButton"; + +export type MenuButtonProps = { + ref?: React.Ref; + label?: string; + disabled?: boolean; + children?: React.ReactNode; +}; + +export function MenuButton(props: MenuButtonProps): React.ReactNode { + return ( + + ); +} diff --git a/frontend/src/modules/2DViewer/layers/components/LayersActions.tsx b/frontend/src/modules/2DViewer/layers/components/LayersActions.tsx index 85add00dd..f063c0a9a 100644 --- a/frontend/src/modules/2DViewer/layers/components/LayersActions.tsx +++ b/frontend/src/modules/2DViewer/layers/components/LayersActions.tsx @@ -1,11 +1,11 @@ import React from "react"; -import { DenseIconButton } from "@lib/components/DenseIconButton"; import { Menu } from "@lib/components/Menu"; +import { MenuButton } from "@lib/components/MenuButton/menuButton"; import { MenuDivider } from "@lib/components/MenuDivider"; import { MenuHeading } from "@lib/components/MenuHeading"; import { MenuItem } from "@lib/components/MenuItem"; -import { Dropdown, MenuButton } from "@mui/base"; +import { Dropdown } from "@mui/base"; import { Add, ArrowDropDown } from "@mui/icons-material"; export type LayersAction = { @@ -54,7 +54,7 @@ export function LayersActions(props: LayersActionsProps): React.ReactNode { } else { content.push( props.onActionClick(item.identifier)} @@ -70,12 +70,10 @@ export function LayersActions(props: LayersActionsProps): React.ReactNode { return ( - - - - Add - - + + + Add + {makeContent(props.layersActionGroups)} diff --git a/frontend/src/modules/2DViewer/layers/components/ViewComponent.tsx b/frontend/src/modules/2DViewer/layers/components/ViewComponent.tsx index 090fe251d..a7f492aef 100644 --- a/frontend/src/modules/2DViewer/layers/components/ViewComponent.tsx +++ b/frontend/src/modules/2DViewer/layers/components/ViewComponent.tsx @@ -33,10 +33,16 @@ export function ViewComponent(props: ViewComponentProps): React.ReactNode { function makeEndAdornment() { const adornments: React.ReactNode[] = []; if (props.actions) { - adornments.push(); + adornments.push( + + ); } - adornments.push(); - adornments.push(); + adornments.push(); + adornments.push(); return adornments; } diff --git a/frontend/src/modules/2DViewer/view/components/ReadoutWrapper.tsx b/frontend/src/modules/2DViewer/view/components/ReadoutWrapper.tsx index 487c4779a..15c1e694d 100644 --- a/frontend/src/modules/2DViewer/view/components/ReadoutWrapper.tsx +++ b/frontend/src/modules/2DViewer/view/components/ReadoutWrapper.tsx @@ -26,7 +26,6 @@ export function ReadoutWrapper(props: ReadooutWrapperProps): React.ReactNode { } function handleMouseHover(event: MapMouseEvent): void { - console.debug("Hover event", event); setLayerPickingInfo(event.infos); } diff --git a/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts b/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts index f8b8d0153..027c1a60b 100644 --- a/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts +++ b/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts @@ -3,6 +3,8 @@ import { GeoJsonLayer } from "@deck.gl/layers/typed"; import { WellsLayer } from "@webviz/subsurface-viewer/dist/layers"; export class AdvancedWellsLayer extends WellsLayer { + static layerName: string = "AdvancedWellsLayer"; + constructor(props: any) { super(props); } diff --git a/frontend/src/modules/2DViewer/view/customDeckGlLayers/WellborePicksLayer.ts b/frontend/src/modules/2DViewer/view/customDeckGlLayers/WellborePicksLayer.ts index 960113e68..f91430d73 100644 --- a/frontend/src/modules/2DViewer/view/customDeckGlLayers/WellborePicksLayer.ts +++ b/frontend/src/modules/2DViewer/view/customDeckGlLayers/WellborePicksLayer.ts @@ -23,8 +23,9 @@ export type WellBorePicksLayerProps = { }; export class WellborePicksLayer extends CompositeLayer { + static layerName: string = "WellborePicksLayer"; + filterSubLayer(context: FilterContext): boolean { - return true; if (context.layer.id.includes("text")) { return context.viewport.zoom > -4; }