Skip to content

Commit

Permalink
Removed modelviewer from punch
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellhaaland committed Mar 1, 2024
1 parent 04d66ba commit 110d843
Showing 1 changed file with 2 additions and 45 deletions.
47 changes: 2 additions & 45 deletions libs/punchsidesheet/src/lib/ui-sidesheet/PunchSidesheet.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Punch } from '@cc-components/punchshared';
import {
LinkCell,
ModelViewerTab,
PackageStatus,
colorMap,
hasProperty,
useContextId,
useHttpClient,
} from '@cc-components/shared';
import { LinkCell, useContextId, useHttpClient } from '@cc-components/shared';
import {
BannerItem,
SidesheetHeader,
Expand All @@ -19,8 +11,7 @@ import {
} from '@cc-components/sharedcomponents';
import { Tabs } from '@equinor/eds-core-react';
import { useQuery } from '@tanstack/react-query';
import { TagOverlay } from 'libs/modelviewer/dist/src';
import { useMemo, useRef, useState } from 'react';
import { useRef, useState } from 'react';
import { DetailsTab } from './DetailsTab';
import { StyledTabListWrapper, StyledTabsList } from './sidesheet.styles';

Expand Down Expand Up @@ -65,30 +56,6 @@ export const PunchSidesheet = (props: {
return <div>Failed to get Punch with id: {props.id}</div>;
}

const punchIcon = (category: string) => {
return <h3>{category}</h3>;
};

const tagsOverlay = useMemo(() => {
return [
{
tagNo: punch.tagNo,
description: punch.description,
status: punch.category,
icon: punchIcon(punch.category || ''),
},
] as TagOverlay[];
}, [punch]);

const viewerOptions = {
statusResolver: (status: string) => {
return hasProperty(colorMap, status)
? colorMap[status as PackageStatus]
: '#009922';
},
defaultCroppingDistance: 3,
};

return (
<StyledSideSheetContainer>
<SidesheetHeader
Expand Down Expand Up @@ -150,23 +117,13 @@ export const PunchSidesheet = (props: {
<StyledTabListWrapper>
<StyledTabsList ref={ref}>
<Tabs.Tab>Details </Tabs.Tab>
<Tabs.Tab>3D</Tabs.Tab>
</StyledTabsList>
</StyledTabListWrapper>

<StyledPanels>
<Tabs.Panel>
<DetailsTab punch={punch} />
</Tabs.Panel>
<Tabs.Panel>
<ModelViewerTab
TagOverlay={tagsOverlay}
options={viewerOptions}
isFetching={isLoadingSidesheet}
error={error as Error | null}
facility={[punch.facility!] || ['']}
/>
</Tabs.Panel>
</StyledPanels>
</StyledTabs>
</StyledSideSheetContainer>
Expand Down

0 comments on commit 110d843

Please sign in to comment.