diff --git a/react-components/src/architecture/concrete/pointsOfInterest/CreatePoiCommentCommand.ts b/react-components/src/architecture/concrete/pointsOfInterest/CreatePoiCommentCommand.ts index 52e870c314..1833634bc8 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/CreatePoiCommentCommand.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/CreatePoiCommentCommand.ts @@ -38,7 +38,7 @@ export class CreatePoiCommentCommand extends BaseInputCommand { } const domainObject = this.rootDomainObject.getDescendantByType(PointsOfInterestDomainObject); - domainObject?.postCommentForPoi(this._poi, this._content).then(() => { + void domainObject?.postCommentForPoi(this._poi, this._content).then(() => { this._onFinish?.(); domainObject?.notify(Changes.addedPart); }); diff --git a/react-components/src/architecture/concrete/pointsOfInterest/DeletePointsOfInterestCommand.ts b/react-components/src/architecture/concrete/pointsOfInterest/DeletePointsOfInterestCommand.ts index dd052e046e..cc07ceb42c 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/DeletePointsOfInterestCommand.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/DeletePointsOfInterestCommand.ts @@ -40,7 +40,7 @@ export class DeleteSelectedPointsOfInterestCommand< pois.removePointsOfInterest(selectedOverlay); pois.setSelectedPointOfInterest(undefined); - pois.save(); + void pois.save(); return true; } diff --git a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestCache.ts b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestCache.ts index ee279af684..e1423720e7 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestCache.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestCache.ts @@ -1,11 +1,7 @@ /*! * Copyright 2024 Cognite AS */ -import { - type CommentProperties, - type PointsOfInterestInstance, - type PointsOfInterestProperties -} from './models'; +import { type CommentProperties, type PointsOfInterestInstance } from './models'; import { type PointsOfInterestProvider } from './PointsOfInterestProvider'; /** @@ -68,7 +64,7 @@ export class PointsOfInterestCache { } public async savePointsOfInterest( - pois: PointsOfInterestInstance[] + pois: Array> ): Promise>> { if (pois.length === 0) { return []; diff --git a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject.ts b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject.ts index e710683f16..6861d98300 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject.ts @@ -13,7 +13,6 @@ import { partition, remove } from 'lodash'; import { type CommentProperties, type PointsOfInterestProperties } from './models'; import { Quantity } from '../../base/domainObjectsHelpers/Quantity'; import { type PointsOfInterestProvider } from './PointsOfInterestProvider'; -import { isDefined } from '../../../utilities/isDefined'; export class PointsOfInterestDomainObject extends VisualDomainObject { private _selectedPointsOfInterest: PointOfInterest | undefined; diff --git a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestProvider.ts b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestProvider.ts index b05c7fd97a..a9dae5dda1 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestProvider.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestProvider.ts @@ -9,11 +9,11 @@ import { export type PointsOfInterestProvider = { createPointsOfInterest: ( - pois: { id: ID; properties: PointsOfInterestProperties }[] + pois: Array<{ id: ID; properties: PointsOfInterestProperties }> ) => Promise>>; fetchAllPointsOfInterest: () => Promise>>; getPointsOfInterestComments: (poiId: ID) => Promise; postPointsOfInterestComment: (poiId: ID, content: string) => Promise; deletePointsOfInterest: (poiIds: ID[]) => Promise; - createNewId(): ID; + createNewId: () => ID; }; diff --git a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestSectionCommand.ts b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestSectionCommand.ts index 303da43277..cacd3fb41e 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestSectionCommand.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestSectionCommand.ts @@ -3,7 +3,7 @@ */ import { SectionCommand } from '../../base/commands/SectionCommand'; -import { TranslateKey } from '../../base/utilities/TranslateKey'; +import { type TranslateKey } from '../../base/utilities/TranslateKey'; export class PointsOfInterestSectionCommand extends SectionCommand { public override get isVisible(): boolean { diff --git a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestTool.ts b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestTool.ts index 96c57f3949..c06c4e2d13 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestTool.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/PointsOfInterestTool.ts @@ -12,7 +12,6 @@ import { type AnchoredDialogContent } from '../../base/commands/BaseTool'; import { AnchoredDialogUpdater } from '../../base/reactUpdaters/AnchoredDialogUpdater'; import { NavigationTool } from '../../base/concreteCommands/NavigationTool'; import { CreatePointsOfInterestWithDescriptionCommand } from './CreatePointsOfInterestWithDescriptionCommand'; -import { InitiatePointsOfInterestCommand } from './InitiatePointsOfInterestCommand'; export class PointsOfInterestTool extends NavigationTool { private _isCreating: boolean = false; @@ -110,7 +109,7 @@ export class PointsOfInterestTool extends NavigationTool { this.setAnchoredDialogContent({ contentCommands: [createPointCommand], - position: position, + position, onCloseCallback: onCancelCallback }); } @@ -133,7 +132,7 @@ export class PointsOfInterestTool extends NavigationTool { private async initiateCreatPointOfInterest(event: PointerEvent): Promise { const intersection = await this.getIntersection(event); - if (!intersection || isPointsOfInterestIntersection(intersection)) { + if (intersection === undefined || isPointsOfInterestIntersection(intersection)) { this.closeCreateCommandDialog(); return; } diff --git a/react-components/src/architecture/concrete/pointsOfInterest/SetPointsOfInterestVisibleCommand.tsx b/react-components/src/architecture/concrete/pointsOfInterest/SetPointsOfInterestVisibleCommand.tsx index 8a32639f08..96365a92e3 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/SetPointsOfInterestVisibleCommand.tsx +++ b/react-components/src/architecture/concrete/pointsOfInterest/SetPointsOfInterestVisibleCommand.tsx @@ -29,7 +29,7 @@ export class SetPointsOfInterestVisibleCommand< return true; } - private get poiDomainObject() { + private get poiDomainObject(): PointsOfInterestDomainObject | undefined { return this.rootDomainObject.getDescendantByType(PointsOfInterestDomainObject); } } diff --git a/react-components/src/architecture/concrete/pointsOfInterest/ads/PointsOfInterestAdsProvider.ts b/react-components/src/architecture/concrete/pointsOfInterest/ads/PointsOfInterestAdsProvider.ts index 97e6ab41a9..57d1a573f1 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/ads/PointsOfInterestAdsProvider.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/ads/PointsOfInterestAdsProvider.ts @@ -38,7 +38,7 @@ export class PointsOfInterestAdsProvider implements PointsOfInterestProvider ): Promise>> { const result = await this._sdk.put<{ items: PoiItem[] }>( `${this._sdk.getBaseUrl()}/${this._createUrl(this._sdk.project)}`, diff --git a/react-components/src/architecture/concrete/pointsOfInterest/fdm/PointsOfInterestFdmProvider.ts b/react-components/src/architecture/concrete/pointsOfInterest/fdm/PointsOfInterestFdmProvider.ts index b90793da4e..cc8dd7f4ef 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/fdm/PointsOfInterestFdmProvider.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/fdm/PointsOfInterestFdmProvider.ts @@ -21,7 +21,7 @@ export class PointsOfInterestFdmProvider implements PointsOfInterestProvider ): Promise>> { return await createPointsOfInterestInstances(this._fdmSdk, pois); } diff --git a/react-components/src/architecture/concrete/pointsOfInterest/fdm/network.ts b/react-components/src/architecture/concrete/pointsOfInterest/fdm/network.ts index 040a986f44..252e88c023 100644 --- a/react-components/src/architecture/concrete/pointsOfInterest/fdm/network.ts +++ b/react-components/src/architecture/concrete/pointsOfInterest/fdm/network.ts @@ -9,7 +9,6 @@ import { } from '../../../../data-providers/FdmSDK'; import { type PointsOfInterestInstance, type PointsOfInterestProperties } from '../models'; -import { v4 as uuid } from 'uuid'; import { POI_SOURCE } from './view'; import { restrictToDmsId } from '../../../../utilities/restrictToDmsId'; @@ -30,7 +29,7 @@ export async function fetchPointsOfInterest( export async function createPointsOfInterestInstances( fdmSdk: FdmSDK, - poiOverlays: { id: DmsUniqueIdentifier; properties: PointsOfInterestProperties }[] + poiOverlays: Array<{ id: DmsUniqueIdentifier; properties: PointsOfInterestProperties }> ): Promise>> { const chunks = chunk(poiOverlays, 100); const resultPromises = chunks.map(async (chunk) => { diff --git a/react-components/src/components/Architecture/RevealButtons.tsx b/react-components/src/components/Architecture/RevealButtons.tsx index 4031afd004..a6e5aad067 100644 --- a/react-components/src/components/Architecture/RevealButtons.tsx +++ b/react-components/src/components/Architecture/RevealButtons.tsx @@ -25,7 +25,6 @@ import { Image360ActionCommand } from '../../architecture/base/concreteCommands/ import { type PlacementType } from './types'; import { type Vector3 } from 'three'; import { InitiatePointsOfInterestCommand } from '../../architecture/concrete/pointsOfInterest/InitiatePointsOfInterestCommand'; -import { PoiInfoPanelContent } from './pointsOfInterest'; import { DeleteSelectedPointsOfInterestCommand } from '../../architecture/concrete/pointsOfInterest/DeletePointsOfInterestCommand'; export class RevealButtons { diff --git a/react-components/src/components/Architecture/pointsOfInterest/PoiInfoPanelContent.tsx b/react-components/src/components/Architecture/pointsOfInterest/PoiInfoPanelContent.tsx index 366baf4f09..9d832da510 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/PoiInfoPanelContent.tsx +++ b/react-components/src/components/Architecture/pointsOfInterest/PoiInfoPanelContent.tsx @@ -1,11 +1,9 @@ /*! * Copyright 2024 Cognite AS */ -import { type PointsOfInterestDomainObject } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject'; import { Accordion, Avatar, - Breadcrumbs, Button, Divider, Flex, @@ -111,7 +109,3 @@ export const CreateCommentField = ({ const CommentFieldContainer = styled.div` margin-top: 8px; `; - -const StyledBreadcrumbs = styled(Breadcrumbs)` - overflow: hidden; -`; diff --git a/react-components/src/components/Architecture/pointsOfInterest/PoiList.tsx b/react-components/src/components/Architecture/pointsOfInterest/PoiList.tsx index e5e1065cdb..c2b54a6515 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/PoiList.tsx +++ b/react-components/src/components/Architecture/pointsOfInterest/PoiList.tsx @@ -1,11 +1,10 @@ /*! * Copyright 2024 Cognite AS */ -import { type ReactElement, ReactNode, useMemo, useState } from 'react'; -import { type PointsOfInterestDomainObject } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject'; +import { type ReactNode, useMemo, useState } from 'react'; import { type PointOfInterest } from '../../../architecture/concrete/pointsOfInterest/types'; import { useOnUpdateDomainObject } from '../useOnUpdate'; -import { DataGrid, DatagridColumn } from '@cognite/cogs-lab'; +import { DataGrid, type DatagridColumn } from '@cognite/cogs-lab'; import { usePoiDomainObject } from './usePoiDomainObject'; import { EMPTY_ARRAY } from '../../../utilities/constants'; import { useTranslation } from '../../i18n/I18n'; @@ -31,14 +30,14 @@ export const PoiList = (): ReactNode => { const rowData = useMemo( () => pois.map((poi) => ({ - id: poi.id, + id: JSON.stringify(poi.id), name: poi.id, poi })), [pois] ); - const columns: DatagridColumn[] = [ + const columns: Array> = [ { field: 'name', headerName: t('NAME', 'Name'), @@ -57,7 +56,7 @@ export const PoiList = (): ReactNode => { }} columns={columns} data={rowData} - selectedRows={[selectedPoi?.id]} + selectedRows={[JSON.stringify(selectedPoi?.id)]} pagination={false} disableColumnResize /> diff --git a/react-components/src/components/Architecture/pointsOfInterest/PointsOfInterestSidePanel.tsx b/react-components/src/components/Architecture/pointsOfInterest/PointsOfInterestSidePanel.tsx index 78026ea042..58e0f27738 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/PointsOfInterestSidePanel.tsx +++ b/react-components/src/components/Architecture/pointsOfInterest/PointsOfInterestSidePanel.tsx @@ -5,10 +5,8 @@ import { CollapsablePanel } from '@cognite/cogs.js'; import { type PropsWithChildren, type ReactNode, useState } from 'react'; import { useRenderTarget } from '../../RevealCanvas'; import { PointsOfInterestTool } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestTool'; -import { type PointOfInterest } from '../../../architecture/concrete/pointsOfInterest/types'; import styled from 'styled-components'; -import { useOnUpdate, useOnUpdateDomainObject } from '../useOnUpdate'; -import { type PointsOfInterestDomainObject } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestDomainObject'; +import { useOnUpdate } from '../useOnUpdate'; import { PoiInfoPanelContent } from './PoiInfoPanelContent'; import { PoiList } from './PoiList'; import { useSelectedPoi } from './useSelectedPoi'; diff --git a/react-components/src/components/Architecture/pointsOfInterest/index.ts b/react-components/src/components/Architecture/pointsOfInterest/index.ts index 85843abb49..0b68d61873 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/index.ts +++ b/react-components/src/components/Architecture/pointsOfInterest/index.ts @@ -1,3 +1,6 @@ +/*! + * Copyright 2024 Cognite AS + */ export { PoiInfoPanelContent } from './PoiInfoPanelContent'; export { useSyncSelectedPoi } from './useSyncSelectedPoi'; export { usePoiDomainObject } from './usePoiDomainObject'; diff --git a/react-components/src/components/Architecture/pointsOfInterest/useCommentsForPoiQuery.ts b/react-components/src/components/Architecture/pointsOfInterest/useCommentsForPoiQuery.ts index 5813d4a6d1..6aa824963b 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/useCommentsForPoiQuery.ts +++ b/react-components/src/components/Architecture/pointsOfInterest/useCommentsForPoiQuery.ts @@ -2,7 +2,7 @@ * Copyright 2024 Cognite AS */ import { useQuery, type UseQueryResult } from '@tanstack/react-query'; -import { type PointOfInterest, type PointsOfInterestDomainObject } from '../../../architecture'; +import { type PointOfInterest } from '../../../architecture'; import { type CommentProperties } from '../../../architecture/concrete/pointsOfInterest/models'; import { queryKeys } from '../../../utilities/queryKeys'; import { usePoiDomainObject } from './usePoiDomainObject'; diff --git a/react-components/src/components/Architecture/pointsOfInterest/usePoiDomainObject.ts b/react-components/src/components/Architecture/pointsOfInterest/usePoiDomainObject.ts index e8eb02e006..786bcb9e7d 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/usePoiDomainObject.ts +++ b/react-components/src/components/Architecture/pointsOfInterest/usePoiDomainObject.ts @@ -1,5 +1,8 @@ +/*! + * Copyright 2024 Cognite AS + */ import { useState } from 'react'; -import { PointsOfInterestDomainObject } from '../../../architecture'; +import { type PointsOfInterestDomainObject } from '../../../architecture'; import { PointsOfInterestTool } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestTool'; import { useRenderTarget } from '../../RevealCanvas'; import { useOnUpdate } from '../useOnUpdate'; diff --git a/react-components/src/components/Architecture/pointsOfInterest/useSelectedPoi.ts b/react-components/src/components/Architecture/pointsOfInterest/useSelectedPoi.ts index 2aa0d223b9..bf15632a1f 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/useSelectedPoi.ts +++ b/react-components/src/components/Architecture/pointsOfInterest/useSelectedPoi.ts @@ -1,7 +1,8 @@ +/*! + * Copyright 2024 Cognite AS + */ import { useState } from 'react'; -import { PointOfInterest, PointsOfInterestDomainObject } from '../../../architecture'; -import { PointsOfInterestTool } from '../../../architecture/concrete/pointsOfInterest/PointsOfInterestTool'; -import { useRenderTarget } from '../../RevealCanvas'; +import { type PointOfInterest } from '../../../architecture'; import { useOnUpdateDomainObject } from '../useOnUpdate'; import { usePoiDomainObject } from './usePoiDomainObject'; diff --git a/react-components/src/components/Architecture/pointsOfInterest/useSyncSelectedPoi.ts b/react-components/src/components/Architecture/pointsOfInterest/useSyncSelectedPoi.ts index b236e7fe60..b6ccfa78c2 100644 --- a/react-components/src/components/Architecture/pointsOfInterest/useSyncSelectedPoi.ts +++ b/react-components/src/components/Architecture/pointsOfInterest/useSyncSelectedPoi.ts @@ -1,5 +1,8 @@ +/*! + * Copyright 2024 Cognite AS + */ import { useEffect, useRef } from 'react'; -import { PointOfInterest } from '../../../architecture'; +import { type PointOfInterest } from '../../../architecture'; import { useOnUpdateDomainObject } from '../useOnUpdate'; import { useRenderTarget } from '../../RevealCanvas'; import { usePoiDomainObject } from './usePoiDomainObject'; @@ -7,7 +10,7 @@ import { usePoiDomainObject } from './usePoiDomainObject'; export const useSyncSelectedPoi = ( selectedPoi: PointOfInterest | undefined, setSelectedPoi: (poi: PointOfInterest | undefined) => void -) => { +): void => { const renderTarget = useRenderTarget(); const domainObject = usePoiDomainObject(); @@ -26,7 +29,7 @@ export const useSyncSelectedPoi = ( useEffect(() => { domainObject?.setSelectedPointOfInterest(selectedPoi); - if (selectedPoi) { + if (selectedPoi !== undefined) { domainObject?.setVisibleInteractive(true, renderTarget); } }, [selectedPoi, domainObject]);