-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d85839a
commit f30a7a5
Showing
5 changed files
with
178 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...s/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Dialog } from '@equinor/eds-core-react'; | ||
import styled from 'styled-components'; | ||
import { spacings } from '../../../../../../tokens/spacings'; | ||
|
||
export const StyledDialog = styled(Dialog)` | ||
width: fit-content; | ||
min-width: 500px; | ||
min-height: 500px; | ||
`; | ||
|
||
export const Content = styled(Dialog.CustomContent)` | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: ${spacings.SMALL}; | ||
`; | ||
|
||
export { StyledDialog as Dialog }; |
48 changes: 31 additions & 17 deletions
48
...eatures/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,47 @@ | ||
import { Button, Dialog } from '@equinor/eds-core-react'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getVariogramImage } from '../../../../../../api/custom/getImageById'; | ||
import { GetVariogramResultsVariogramResultFileDto } from '../../../../../../api/generated'; | ||
import { ImageView } from '../../../../../../components/ImageView/ImageView'; | ||
import * as Styled from './ImageResult.styled'; | ||
|
||
export const ImageResult = ({ | ||
resultFiels, | ||
imageId, | ||
open, | ||
setOpen, | ||
}: { | ||
resultFiels: GetVariogramResultsVariogramResultFileDto[]; | ||
imageId: string; | ||
open: boolean; | ||
setOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
}) => { | ||
const wantedResultFile = resultFiels.find((x) => | ||
x.fileName.includes('variogram_slices_'), | ||
); | ||
|
||
const imageId = wantedResultFile | ||
? wantedResultFile.variogramResultFileId | ||
: ''; | ||
|
||
const { data } = useQuery({ | ||
const { data, isLoading } = useQuery({ | ||
queryKey: ['case-image', imageId], | ||
queryFn: () => getVariogramImage(imageId), | ||
enabled: open, | ||
}); | ||
|
||
return ( | ||
<> | ||
<ImageView | ||
text="Case results" | ||
img={data ? data : ''} | ||
altText="Case results" | ||
></ImageView> | ||
<Styled.Dialog open={open} isDismissable={true}> | ||
<Dialog.Header> | ||
<Dialog.Title>Result image</Dialog.Title> | ||
</Dialog.Header> | ||
<Styled.Content> | ||
{isLoading && <>Loading ...</>} | ||
{data && ( | ||
<ImageView | ||
text="Case results" | ||
img={data ? data : ''} | ||
altText="Case results" | ||
></ImageView> | ||
)} | ||
</Styled.Content> | ||
|
||
<Dialog.Actions> | ||
<Button variant="ghost" onClick={() => setOpen(!open)}> | ||
Cancel | ||
</Button> | ||
</Dialog.Actions> | ||
</Styled.Dialog> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters