Skip to content

Commit

Permalink
restructured folders and removed relative path import (#4330)
Browse files Browse the repository at this point in the history
Co-authored-by: cognite-bulldozer[bot] <51074376+cognite-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
pramodcog and cognite-bulldozer[bot] authored Mar 14, 2024
1 parent 4530cc1 commit 7edd3fc
Show file tree
Hide file tree
Showing 50 changed files with 96 additions and 89 deletions.
2 changes: 1 addition & 1 deletion react-components/src/components/AxisGizmo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { useEffect, type ReactElement } from 'react';

import { AxisGizmoOptions, AxisGizmoTool } from '@cognite/reveal/tools';
import { useReveal } from '..';
import { useReveal } from './RevealCanvas/ViewerContext';

export { AxisGizmoOptions };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import { useState, type ReactElement, useCallback, useEffect } from 'react';
import styled from 'styled-components';
import { Image360HistoricalDetails } from '../Image360HistoricalDetails/Image360HistoricalDetails';
import { useReveal } from '../..';
import { type Image360 } from '@cognite/reveal';
import { Button } from '@cognite/cogs.js';
import { useReveal } from '../RevealCanvas/ViewerContext';

type Image360DetailsProps = {
appLanguage?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { type ReactNode, useEffect, useMemo, useRef, useState, type ReactElement
import { type Color } from 'three';
import { I18nContextProvider } from '../i18n/I18n';
import { ViewerContext } from '../RevealCanvas/ViewerContext';
import { NodeCacheProvider } from '../NodeCacheProvider/NodeCacheProvider';
import { AssetMappingCacheProvider } from '../NodeCacheProvider/AssetMappingCacheProvider';
import { PointCloudAnnotationCacheProvider } from '../NodeCacheProvider/PointCloudAnnotationCacheProvider';
import { NodeCacheProvider } from '../CacheProvider/NodeCacheProvider';
import { AssetMappingCacheProvider } from '../CacheProvider/AssetMappingCacheProvider';
import { PointCloudAnnotationCacheProvider } from '../CacheProvider/PointCloudAnnotationCacheProvider';
import { Reveal3DResourcesCountContextProvider } from '../Reveal3DResources/Reveal3DResourcesCountContext';
import { SDKProvider } from '../RevealCanvas/SDKProvider';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useRevealKeepAlive } from '../RevealKeepAlive/RevealKeepAliveContext';
import { Image360AnnotationCacheProvider } from '../NodeCacheProvider/Image360AnnotationCacheProvider';
import { Image360AnnotationCacheProvider } from '../CacheProvider/Image360AnnotationCacheProvider';

export type RevealContextProps = {
color?: Color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import { type Cognite3DViewer } from '@cognite/reveal';
import { type ReactNode, type ReactElement, useRef, useEffect } from 'react';
import { RevealKeepAliveContext } from './RevealKeepAliveContext';
import { type FdmNodeCache } from '../NodeCacheProvider/FdmNodeCache';
import { type AssetMappingCache } from '../NodeCacheProvider/AssetMappingCache';
import { type PointCloudAnnotationCache } from '../NodeCacheProvider/PointCloudAnnotationCache';
import { type Image360AnnotationCache } from '../NodeCacheProvider/Image360AnnotationCache';
import { type FdmNodeCache } from '../CacheProvider/FdmNodeCache';
import { type AssetMappingCache } from '../CacheProvider/AssetMappingCache';
import { type PointCloudAnnotationCache } from '../CacheProvider/PointCloudAnnotationCache';
import { type Image360AnnotationCache } from '../CacheProvider/Image360AnnotationCache';

export function RevealKeepAlive({ children }: { children?: ReactNode }): ReactElement {
const viewerRef = useRef<Cognite3DViewer>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import { type Cognite3DViewer } from '@cognite/reveal';
import { type MutableRefObject, createContext, useContext } from 'react';
import { type FdmNodeCache } from '../NodeCacheProvider/FdmNodeCache';
import { type AssetMappingCache } from '../NodeCacheProvider/AssetMappingCache';
import { type PointCloudAnnotationCache } from '../NodeCacheProvider/PointCloudAnnotationCache';
import { type Image360AnnotationCache } from '../NodeCacheProvider/Image360AnnotationCache';
import { type FdmNodeCache } from '../CacheProvider/FdmNodeCache';
import { type AssetMappingCache } from '../CacheProvider/AssetMappingCache';
import { type PointCloudAnnotationCache } from '../CacheProvider/PointCloudAnnotationCache';
import { type Image360AnnotationCache } from '../CacheProvider/Image360AnnotationCache';

export type RevealKeepAliveData = {
viewerRef: MutableRefObject<Cognite3DViewer | undefined>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type Image360Collection
} from '@cognite/reveal';
import { useReveal } from '../RevealCanvas/ViewerContext';
import { use3DModelName } from '../../hooks/use3DModelName';
import { use3DModelName } from '../../query/use3DModelName';
import { isEqual } from 'lodash';
import { useLayersUrlParams } from './hooks/useUrlStateParam';
import { useTranslation } from '../i18n/I18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { type ReactElement } from 'react';

import { Menu } from '@cognite/cogs.js';
import { use3dScenes } from '../../hooks/use3dScenes';
import { use3dScenes } from '../../query/use3dScenes';
import { type DmsUniqueIdentifier } from '../../utilities/FdmSDK';

export type SceneListProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { type ReactElement } from 'react';

import { Button, Dropdown, Menu, Tooltip as CogsTooltip } from '@cognite/cogs.js';
import { use3dScenes } from '../../hooks/use3dScenes';
import { use3dScenes } from '../../query/use3dScenes';
import { useTranslation } from '../i18n/I18n';
import { type DmsUniqueIdentifier } from '../../utilities/FdmSDK';
import { SceneList } from './SceneList';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import { useCallback, useMemo } from 'react';
import { distancesInFeetAndMeters } from '../MeasurementButton';
import { type Measurement, MeasurementTool } from '@cognite/reveal/tools';
import { useReveal } from '../../..';
import { Vector3 } from 'three';
import { useReveal } from '../../RevealCanvas/ViewerContext';

type SerializedMeasurement = number[];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { type ReactElement } from 'react';

import { Button, Dropdown, Menu, Tooltip as CogsTooltip } from '@cognite/cogs.js';
import { use3dScenes } from '../../hooks/use3dScenes';
import { use3dScenes } from '../../query/use3dScenes';
import { useTranslation } from '../i18n/I18n';
import { type DmsUniqueIdentifier } from '../../utilities/FdmSDK';
import { SceneList } from '../RevealToolbar/SceneList';
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/components/Widgets/WindowWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { useTranslation } from '../i18n/I18n';
import { withSuppressRevealEvents } from '../../higher-order-components/withSuppressRevealEvents';
import { StyledComponent, WidgetBody, WidgetContent } from './elements';
import { useReveal } from '../..';
import { useReveal } from '../RevealCanvas/ViewerContext';

type WindowWidgetProps = {
title?: string;
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/hooks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { type Node3D, type CogniteExternalId, type Asset } from '@cognite/sdk';
import { type AssetAnnotationImage360Info } from '@cognite/reveal';
import { type DmsUniqueIdentifier } from '..';
import { type DmsUniqueIdentifier } from '../utilities/FdmSDK';

export type ThreeDModelFdmMappings = {
modelId: number;
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/hooks/use3dModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/

import { useMemo } from 'react';
import { useReveal } from '..';
import { useReveal3DResourcesCount } from '../components/Reveal3DResources/Reveal3DResourcesCountContext';
import { type CogniteModel } from '@cognite/reveal';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export const use3dModels = (): CogniteModel[] => {
const viewer = useReveal();
Expand Down
8 changes: 4 additions & 4 deletions react-components/src/hooks/useCalculateModelsStyling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ import { type Node3D, type CogniteExternalId } from '@cognite/sdk';
import {
useFdmAssetMappings,
useMappedEdgesForRevisions
} from '../components/NodeCacheProvider/NodeCacheProvider';
} from '../components/CacheProvider/NodeCacheProvider';
import { useMemo } from 'react';
import {
type NodeId,
type FdmEdgeWithNode,
type AssetId,
type ModelRevisionAssetNodesResult
} from '../components/NodeCacheProvider/types';
} from '../components/CacheProvider/types';
import {
type NodeStylingGroup,
type TreeIndexStylingGroup
} from '../components/CadModelContainer/useApplyCadModelStyling';
import { type AssetMapping } from '../components/NodeCacheProvider/AssetMappingCache';
import { type AssetMapping } from '../components/CacheProvider/AssetMappingCache';
import {
useAssetMappedNodesForRevisions,
useNodesForAssets
} from '../components/NodeCacheProvider/AssetMappingCacheProvider';
} from '../components/CacheProvider/AssetMappingCacheProvider';
import { isSameCadModel } from '../utilities/isSameModel';
import { isAssetMappingStylingGroup, isFdmAssetStylingGroup } from '../utilities/StylingGroupUtils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { isSamePointCloudModel } from '../utilities/isSameModel';
import {
usePointCloudAnnotationMappingsForModels,
usePointCloudAnnotationIdsForModels
} from '../components/NodeCacheProvider/PointCloudAnnotationCacheProvider';
} from '../components/CacheProvider/PointCloudAnnotationCacheProvider';
import { EMPTY_ARRAY } from '../utilities/constants';
import { type PointCloudAnnotationModel } from '../components/NodeCacheProvider/types';
import { type PointCloudAnnotationModel } from '../components/CacheProvider/types';

export type StyledPointCloudModel = {
model: PointCloudModelOptions;
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/hooks/useCameraNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { type CameraState, type CogniteCadModel } from '@cognite/reveal';
import { useReveal } from '../components/RevealCanvas/ViewerContext';
import { useFdmNodeCache } from '../components/NodeCacheProvider/NodeCacheProvider';
import { useFdmNodeCache } from '../components/CacheProvider/NodeCacheProvider';
import { Box3 } from 'three';

export type CameraNavigationActions = {
Expand Down
13 changes: 7 additions & 6 deletions react-components/src/hooks/useClickedNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import {
type PointerEventData,
type Image360AnnotationIntersection
} from '@cognite/reveal';
import { type DmsUniqueIdentifier, type Source, useReveal } from '../';
import { useEffect, useState } from 'react';
import { useFdm3dNodeDataPromises } from '../components/NodeCacheProvider/NodeCacheProvider';
import { useFdm3dNodeDataPromises } from '../components/CacheProvider/NodeCacheProvider';
import { type CogniteInternalId, type Node3D } from '@cognite/sdk';
import { type FdmNodeDataPromises } from '../components/NodeCacheProvider/types';
import { useAssetMappingForTreeIndex } from '../components/NodeCacheProvider/AssetMappingCacheProvider';
import { type NodeAssetMappingResult } from '../components/NodeCacheProvider/AssetMappingCache';
import { usePointCloudAnnotationMappingForAssetId } from '../components/NodeCacheProvider/PointCloudAnnotationCacheProvider';
import { type FdmNodeDataPromises } from '../components/CacheProvider/types';
import { useAssetMappingForTreeIndex } from '../components/CacheProvider/AssetMappingCacheProvider';
import { type NodeAssetMappingResult } from '../components/CacheProvider/AssetMappingCache';
import { usePointCloudAnnotationMappingForAssetId } from '../components/CacheProvider/PointCloudAnnotationCacheProvider';
import { type PointCloudAnnotationMappedAssetData } from './types';
import { MOUSE } from 'three';
import { type DmsUniqueIdentifier, type Source } from '../utilities/FdmSDK';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export type AssetMappingDataResult = {
cadNode: Node3D;
Expand Down
4 changes: 2 additions & 2 deletions react-components/src/hooks/useGroundPlaneFromScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

import { useEffect } from 'react';
import { useSceneConfig } from './useSceneConfig';
import { useSceneConfig } from '../query/useSceneConfig';
import { DoubleSide, Mesh, MeshBasicMaterial, PlaneGeometry, TextureLoader } from 'three';
import { useReveal } from '..';
import { useQuery } from '@tanstack/react-query';
import { useSDK } from '../components/RevealCanvas/SDKProvider';
import { CDF_TO_VIEWER_TRANSFORMATION, CustomObject } from '@cognite/reveal';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export const useGroundPlaneFromScene = (sceneExternalId: string, sceneSpaceId: string): void => {
const { data: scene } = useSceneConfig(sceneExternalId, sceneSpaceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2023 Cognite AS
*/

import { useSceneConfig } from './useSceneConfig';
import { useSceneConfig } from '../query/useSceneConfig';
import { type CogniteClient } from '@cognite/sdk';
import {
type AddResourceOptions,
Expand Down
4 changes: 2 additions & 2 deletions react-components/src/hooks/useSceneDefaultCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/

import { useMemo } from 'react';
import { useSceneConfig } from './useSceneConfig';
import { useSceneConfig } from '../query/useSceneConfig';
import { Vector3, Quaternion, Euler, MathUtils, Box3 } from 'three';
import { useReveal } from '..';
import { CDF_TO_VIEWER_TRANSFORMATION, type Cognite3DViewer } from '@cognite/reveal';
import { type SceneConfiguration } from '../components/SceneContainer/SceneTypes';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export const useSceneDefaultCamera = (
sceneExternalId: string | undefined,
Expand Down
4 changes: 2 additions & 2 deletions react-components/src/hooks/useSkyboxFromScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

import { useEffect } from 'react';
import { useSceneConfig } from './useSceneConfig';
import { useSceneConfig } from '../query/useSceneConfig';
import * as THREE from 'three';
import { useReveal } from '..';
import { useQuery } from '@tanstack/react-query';
import { useSDK } from '../components/RevealCanvas/SDKProvider';
import { type Cognite3DViewer, CustomObject } from '@cognite/reveal';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export const useSkyboxFromScene = (sceneExternalId: string, sceneSpaceId: string): void => {
const scene = useSceneConfig(sceneExternalId, sceneSpaceId);
Expand Down
55 changes: 29 additions & 26 deletions react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,61 @@ export { Image360HistoricalDetails } from './components/Image360HistoricalDetail
export { Image360Details } from './components/Image360Details/Image360Details';
export { ViewerAnchor } from './components/ViewerAnchor/ViewerAnchor';
export { RevealKeepAlive } from './components/RevealKeepAlive/RevealKeepAlive';
export {
SceneContainer,
type SceneContainerProps
} from './components/SceneContainer/SceneContainer';

export { RevealToolbar, type RevealToolbarProps } from './components/RevealToolbar/RevealToolbar';
export { RevealTopbar } from './components/RevealTopbar/RevealTopbar';
export { AxisGizmo, AxisGizmoOptions } from './components/AxisGizmo';
export { WindowWidget } from './components/Widgets/WindowWidget';

// Hooks
export { useReveal } from './components/RevealCanvas/ViewerContext';
export { use3DModelName } from './hooks/use3DModelName';
export { useFdmAssetMappings } from './components/NodeCacheProvider/NodeCacheProvider';
export { useFdmAssetMappings } from './components/CacheProvider/NodeCacheProvider';
export { useSceneDefaultCamera } from './hooks/useSceneDefaultCamera';
export {
useClickedNodeData,
type ClickedNodeData,
type FdmNodeDataResult
} from './hooks/useClickedNode';
export { useCameraNavigation } from './hooks/useCameraNavigation';
export { use3dScenes } from './hooks/use3dScenes';
export { use3dModels } from './hooks/use3dModels';
export { useMappedEdgesForRevisions } from './components/NodeCacheProvider/NodeCacheProvider';
export { useMappedEdgesForRevisions } from './components/CacheProvider/NodeCacheProvider';
export { useIsRevealInitialized } from './hooks/useIsRevealInitialized';
export { use3dNodeByExternalId } from './hooks/use3dNodeByExternalId';

export {
usePointCloudAnnotationMappingsForModels,
usePointCloudAnnotationMappingsForAssetIds
} from './components/CacheProvider/PointCloudAnnotationCacheProvider';
export { useImage360AnnotationMappingsForAssetIds } from './components/CacheProvider/Image360AnnotationCacheProvider';

// Queries
export { use3DModelName } from './query/use3DModelName';
export { use3dScenes } from './query/use3dScenes';
export { use3dRelatedEdgeConnections } from './query/use3dRelatedEdgeConnections';
export { use3dRelatedDirectConnections } from './query/use3dRelatedDirectConnections';
export { use3dNodeByExternalId } from './query/use3dNodeByExternalId';
export {
useAllMappedEquipmentFDM,
useSearchMappedEquipmentFDM,
type SearchResultsWithView
} from './hooks/useSearchMappedEquipmentFDM';
} from './query/useSearchMappedEquipmentFDM';
export {
useSearchMappedEquipmentAssetMappings,
useAllMappedEquipmentAssetMappings,
type ModelMappings,
type ModelMappingsWithAssets
} from './hooks/useSearchMappedEquipmentAssetMappings';
} from './query/useSearchMappedEquipmentAssetMappings';
export {
useSearchAssetsMapped360Annotations,
useAllAssetsMapped360Annotations
} from './hooks/useSearchAssetsMapped360Annotations';
} from './query/useSearchAssetsMapped360Annotations';
export {
useAllAssetsMappedPointCloudAnnotations,
useSearchAssetsMappedPointCloudAnnotations
} from './hooks/useSearchAssetsMappedPointCloudAnnotations';
export {
usePointCloudAnnotationMappingsForModels,
usePointCloudAnnotationMappingsForAssetIds
} from './components/NodeCacheProvider/PointCloudAnnotationCacheProvider';
export {
type PointCloudAnnotationMappedAssetData,
type Image360AnnotationMappedAssetData
} from './hooks/types';
export { useImage360AnnotationMappingsForAssetIds } from './components/NodeCacheProvider/Image360AnnotationCacheProvider';
export { type Image360AnnotationAssetInfo } from './components/NodeCacheProvider/types';
} from './query/useSearchAssetsMappedPointCloudAnnotations';

// Higher order components
export { withSuppressRevealEvents } from './higher-order-components/withSuppressRevealEvents';
Expand All @@ -90,19 +95,17 @@ export {
type DefaultResourceStyling,
type Image360AssetStylingGroup
} from './components/Reveal3DResources/types';
export {
SceneContainer,
type SceneContainerProps
} from './components/SceneContainer/SceneContainer';
export type {
AddImageCollection360Options,
AddResourceOptions,
AddReveal3DModelOptions
} from './components/Reveal3DResources/types';
export {
type PointCloudAnnotationMappedAssetData,
type Image360AnnotationMappedAssetData
} from './hooks/types';
export type { CameraNavigationActions } from './hooks/useCameraNavigation';
export type { Source, DmsUniqueIdentifier } from './utilities/FdmSDK';
export type { FdmInstanceWithView } from './utilities/types';
export type { QualitySettings } from './components/RevealToolbar/SettingsContainer/types';
export { WindowWidget } from './components/Widgets/WindowWidget';
export { use3dRelatedEdgeConnections } from './hooks/use3dRelatedEdgeConnections';
export { use3dRelatedDirectConnections } from './hooks/use3dRelatedDirectConnections';
export { type Image360AnnotationAssetInfo } from './components/CacheProvider/types';
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* Copyright 2023 Cognite AS
*/
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
import { useFdmNodeCache } from '../components/NodeCacheProvider/NodeCacheProvider';
import { type DmsUniqueIdentifier, useReveal } from '../index';
import { useFdmNodeCache } from '../components/CacheProvider/NodeCacheProvider';
import { type Node3D } from '@cognite/sdk';
import { type DmsUniqueIdentifier } from '../utilities/FdmSDK';
import { useReveal } from '../components/RevealCanvas/ViewerContext';

export const use3dNodeByExternalId = ({
externalId,
Expand Down
Loading

0 comments on commit 7edd3fc

Please sign in to comment.