Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

fix: fusion ts incompatibility #92

Merged
merged 9 commits into from
Jul 26, 2023
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"react/jsx-indent-props": [2, 4],
"react/require-default-props": 0,
"react/prop-types": 0,
"max-len": ["error", 120],
"max-len": ["warn", 150],
"linebreak-style": 0,
"no-console": 0,
"no-debugger": 0,
Expand Down
2 changes: 1 addition & 1 deletion src/AppComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCurrentUser, useFusionEnvironment } from "@equinor/fusion"
import { FC } from "react"
import React, { FC } from "react"
import { BrowserRouter } from "react-router-dom"
import { ModuleRegistry } from "@ag-grid-community/core"
import { ClientSideRowModelModule } from "@ag-grid-community/client-side-row-model"
Expand Down
2 changes: 1 addition & 1 deletion src/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from "react"
import React, { FC } from "react"
import { Route, Routes } from "react-router-dom"
import EquipmentListView from "./Views/EquipmentListView"
import TagComparisonView from "./Views/TagComparisonView"
Expand Down
1 change: 1 addition & 0 deletions src/Components/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react"
import { useNavigate } from "react-router-dom"
import { arrow_back } from "@equinor/eds-icons"
import { Button, Icon } from "@equinor/eds-core-react"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Charts/TotalReviewStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react"
import React, { useState } from "react"
import { AgChartsReact } from "ag-charts-react"
import { AgChartOptions } from "ag-charts-community"

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Charts/TotalTagRequirement.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react"
import React, { useState } from "react"
import { AgChartsReact } from "ag-charts-react"
import { AgChartOptions } from "ag-charts-community"

Expand Down
2 changes: 1 addition & 1 deletion src/Components/EquipmentListView/EquipmentListReview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "@equinor/eds-core-react"
import { Dispatch, SetStateAction, useContext } from "react"
import React, { Dispatch, SetStateAction, useContext } from "react"
import { TagData } from "../../Models/TagData"
import { TagDataReview } from "../../Models/TagDataReview"
import { GetTagDataReviewService } from "../../api/TagDataReviewService"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, SetStateAction } from "react"
import React, { Dispatch, SetStateAction } from "react"
import { ICellRendererParams } from "ag-grid-community"

export default (
Expand Down
2 changes: 1 addition & 1 deletion src/Components/EquipmentListView/EquipmentListTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, SetStateAction, useMemo } from "react"
import React, { Dispatch, SetStateAction, useMemo } from "react"
import { AgGridReact } from "@ag-grid-community/react"
import { tokens } from "@equinor/eds-tokens"
import { Icon } from "@equinor/eds-core-react"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from "react"
import React, { FC } from "react"
import styled from "styled-components"
import StackedBar from "./StackedBar"

Expand Down
2 changes: 1 addition & 1 deletion src/Components/JIP33Table/JIP33LegendModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from "react"
import React, { useMemo } from "react"
import { useAgGridStyles } from "@equinor/fusion-react-ag-grid-addons"
import { ColDef } from "@ag-grid-community/core"
import { AgGridReact } from "@ag-grid-community/react"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/JIP33Table/JIP33Table.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, SetStateAction, useMemo } from "react"
import React, { Dispatch, SetStateAction, useMemo } from "react"
import { useAgGridStyles } from "@equinor/fusion-react-ag-grid-addons"
import { ColDef } from "@ag-grid-community/core"
import { AgGridReact } from "@ag-grid-community/react"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/JIP33WithSideMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from "@equinor/eds-core-react"
import { tokens } from "@equinor/eds-tokens"
import { Dispatch, SetStateAction, useState } from "react"
import React, { Dispatch, SetStateAction, useState } from "react"
import styled from "styled-components"
import JIP33Table from "./JIP33Table/JIP33Table"
import { ReviewComment } from "../Models/ReviewComment"
Expand Down
39 changes: 27 additions & 12 deletions src/Components/SideSheet/Area/AreaSideSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { FC } from "react"
import { Typography, Table } from "@equinor/eds-core-react"
import {
Typography,
Table,
Button,
Icon,
} from "@equinor/eds-core-react"
import { external_link } from "@equinor/eds-icons"
import styled from "styled-components"
import { ViewContext } from "../../../Context/ViewContext"
import Card from "../Card"

const Container = styled.div`
display: flex;
Expand All @@ -10,13 +17,6 @@ const Container = styled.div`
padding: 15px;
`

const Card = styled.div`
padding: 15px;
background-color: white;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
border-radius: 5px;
margin-bottom: 15px;
`
const ModelImage = styled.img`
width: 100%;
height: 350px;
Expand All @@ -27,6 +27,15 @@ const InfoTable = styled(Table)`
width: 100%;
`

const ModelContainer = styled.div`
position: relative;

& > button {
position: absolute;
bottom: 15px;
right: 15px;
`

const AreaCard: FC = () => {
const { activeTagData } = React.useContext(ViewContext)
const dummyData: Record<string, string> = {
Expand All @@ -49,10 +58,16 @@ const AreaCard: FC = () => {
return (
<Container>
<Card>
<ModelImage
src="https://via.placeholder.com/650"
alt="placeholder"
/>
<ModelContainer>
<ModelImage
src="https://via.placeholder.com/650"
alt="placeholder"
/>
<Button>
Open in facility 3D model
<Icon data={external_link} size={18} />
</Button>
</ModelContainer>
</Card>
<Card>
<Typography variant="h6">AREA CONDITIONS</Typography>
Expand Down
14 changes: 14 additions & 0 deletions src/Components/SideSheet/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { FC } from "react"
import styled from "styled-components"

const CardContainer = styled.div`
padding: 15px;
background-color: white;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
border-radius: 5px;
margin-bottom: 15px;
`

const Card: FC = ({ children }) => <CardContainer>{children}</CardContainer>

export default Card
27 changes: 27 additions & 0 deletions src/Components/SideSheet/ChangeLog/ChangeLogSideSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { FC } from "react"
import styled from "styled-components"
import { ViewContext } from "../../../Context/ViewContext"

const Container = styled.div`
display: flex;
flex-direction: column;
align-items: stretch;
padding: 15px;
`

const ChangeLogSideSheet: FC = () => {
const { activeTagData } = React.useContext(ViewContext)

if (!activeTagData) {
return null
}

return (
<Container>
<h1>Change Log</h1>
<p>Change log is not implemented yet.</p>
</Container>
)
}

export default ChangeLogSideSheet
5 changes: 4 additions & 1 deletion src/Components/SideSheet/SheetContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ReviewComment } from "../../Models/ReviewComment"
import InfoStrip from "./InfoStrip"
import CommentsSideSheet from "./Comments/CommentsSideSheet"
import AreaSideSheet from "./Area/AreaSideSheet"
import ChangeLogSideSheet from "./ChangeLog/ChangeLogSideSheet"

const SheetContent = styled.div`
box-sizing: border-box;
Expand Down Expand Up @@ -199,7 +200,9 @@ const SheetContainer: React.FC<Props> = ({
/>
)}
</TabsPanel>
<TabsPanel>{activeTab === 5 && placeholder}</TabsPanel>
<TabsPanel>{activeTab === 5 && (
<ChangeLogSideSheet />
)}</TabsPanel>
</SheetBody>
</TabsContainer>
</SheetContent>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TagComparisonTable/TagComparisonTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ColDef } from "@ag-grid-community/core"
import { AgGridReact } from "@ag-grid-community/react"
import { useAgGridStyles } from "@equinor/fusion-react-ag-grid-addons"
import { useMemo } from "react"
import React, { useMemo } from "react"
import { InstrumentTagData } from "../../Models/InstrumentTagData"
import { comparisonGeneralColumnDefs } from "./GeneralColumnDefs"

Expand Down
20 changes: 15 additions & 5 deletions src/Views/EquipmentListView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Progress, Tabs } from "@equinor/eds-core-react"
import { useCurrentContext } from "@equinor/fusion-framework-react-app/context"
import { useEffect, useState } from "react"
import React, { useEffect, useState } from "react"
import styled from "styled-components"
import { useNavigate, useParams } from "react-router-dom"
import { GetTagDataService } from "../api/TagDataService"
Expand Down Expand Up @@ -52,6 +52,8 @@ function EquipmentListView() {
}, [currentProject])

useEffect(() => {
let isCancelled = false;

(async () => {
if (externalId !== undefined) {
setError(false)
Expand All @@ -62,15 +64,23 @@ function EquipmentListView() {
const allTagData = await (
await GetTagDataService()
).getAllTagData()
setTagData(allTagData)

setIsLoading(false)
if (!isCancelled) {
setTagData(allTagData)
setIsLoading(false)
}
} catch {
console.error("Error loading tags")
setError(true)
if (!isCancelled) {
console.error("Error loading tags")
setError(true)
}
}
}
})()

return () => {
isCancelled = true
}
}, [externalId])

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/Views/JIP33ElectricalTabView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from "@equinor/eds-core-react"
import styled from "styled-components"
import { useEffect, useState } from "react"
import React, { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import { BackButton } from "../Components/BackButton"
import { generateGeneralRowData } from "../Components/JIP33Table/RowData/Electrical/GeneralRowData"
Expand Down
2 changes: 1 addition & 1 deletion src/Views/JIP33InstrumentTabView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Icon, Tabs, Typography } from "@equinor/eds-core-react"
import styled from "styled-components"
import {
import React, {
useCallback, useContext, useEffect, useState,
} from "react"
import { useParams } from "react-router-dom"
Expand Down
2 changes: 1 addition & 1 deletion src/Views/JIP33MechanicalTabView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from "@equinor/eds-core-react"
import styled from "styled-components"
import { useEffect, useState } from "react"
import React, { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import { BackButton } from "../Components/BackButton"
import { generateGeneralRowData } from "../Components/JIP33Table/RowData/Mechanical/GeneralRowData"
Expand Down
2 changes: 1 addition & 1 deletion src/Views/TagComparisonView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tabs, Typography } from "@equinor/eds-core-react"
import { useEffect, useState } from "react"
import React, { useEffect, useState } from "react"
import styled from "styled-components"
import { BackButton } from "../Components/BackButton"
import TagComparisonTable from "../Components/TagComparisonTable/TagComparisonTable"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"target": "ES6",
"composite": false,
"skipLibCheck": true,
"jsx": "react-jsx",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noEmit": true,
Expand Down
Loading