Skip to content

Commit

Permalink
Added types for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Savokr committed Jul 12, 2023
1 parent 5aee57e commit edd1420
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import {
type AddResourceOptions
} from './types';
import { type CogniteExternalId } from '@cognite/sdk';
import { type FdmAssetMappingsConfig, useFdmAssetMappings } from '../../hooks/useFdmAssetMappings';
import { useFdmAssetMappings } from '../../hooks/useFdmAssetMappings';
import { type FdmAssetMappingsConfig } from '../../hooks/types';

export type FdmAssetStylingGroup = {
fdmAssetExternalIds: CogniteExternalId[];
Expand Down
18 changes: 18 additions & 0 deletions react-components/src/hooks/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { type Source } from '../utilities/FdmSDK';

export type FdmAssetMappingsConfig = {
/**
* 3D Data model source
*/
source: Source;
/*
* FDM space where model assets are located
*/
assetFdmSpace: string;
};

export type ThreeDModelMappings = {
modelId: number;
revisionId: number;
mappings: Array<{ nodeId: number; externalId: string }>;
};
19 changes: 1 addition & 18 deletions react-components/src/hooks/useFdmAssetMappings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,8 @@
*/
import { type CogniteExternalId } from '@cognite/sdk';
import { useFdmSdk } from '../components/RevealContainer/SDKProvider';
import { type Source } from '../utilities/FdmSDK';
import { type UseQueryResult, useQuery } from '@tanstack/react-query';

export type FdmAssetMappingsConfig = {
/**
* 3D Data model source
*/
source: Source;
/*
* FDM space where model assets are located
*/
assetFdmSpace: string;
};

export type ThreeDModelMappings = {
modelId: number;
revisionId: number;
mappings: Array<{ nodeId: number; externalId: string }>;
};
import { type FdmAssetMappingsConfig, type ThreeDModelMappings } from './types';

const DefaultFdmConfig: FdmAssetMappingsConfig = {
source: {
Expand Down
3 changes: 2 additions & 1 deletion react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export type {
AddReveal3DModelOptions
} from './components/Reveal3DResources/types';
export { RevealToolbar } from './components/RevealToolbar/RevealToolbar';
export { useFdmAssetMappings, type FdmAssetMappingsConfig } from './hooks/useFdmAssetMappings';
export { useFdmAssetMappings } from './hooks/useFdmAssetMappings';
export { type FdmAssetMappingsConfig } from './hooks/types';

0 comments on commit edd1420

Please sign in to comment.