-
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
168b1e2
commit 4e3e5d3
Showing
6 changed files
with
179 additions
and
48 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
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
38 changes: 38 additions & 0 deletions
38
src/features/Compute/ComputeVariogram/CaseCard/CaseCardInputs/VariogramCaseCardInputs.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Autocomplete, AutocompleteChanges } from '@equinor/eds-core-react'; | ||
import { default as optionTypes } from '../CaseCard'; | ||
import * as Styled from './CaseCardInputs.styled'; | ||
|
||
export const VariogramCaseCardInputs = ({ | ||
modelAreas, | ||
computeMethods, | ||
setModelArea, | ||
setComputeMethod, | ||
}: { | ||
modelAreas: optionTypes[]; | ||
computeMethods: optionTypes[]; | ||
setModelArea: React.Dispatch<React.SetStateAction<optionTypes | undefined>>; | ||
setComputeMethod: React.Dispatch< | ||
React.SetStateAction<optionTypes | undefined> | ||
>; | ||
}) => { | ||
return ( | ||
<Styled.AutocompleteWrapper> | ||
<Autocomplete | ||
label="Model area" | ||
options={modelAreas} | ||
optionLabel={(modelArea) => modelArea.name} | ||
onOptionsChange={(changes: AutocompleteChanges<optionTypes>) => | ||
setModelArea(changes.selectedItems[0]) | ||
} | ||
></Autocomplete> | ||
<Autocomplete | ||
label="Compute method" | ||
options={computeMethods} | ||
optionLabel={(computeMethod) => computeMethod.name} | ||
onOptionsChange={(changes: AutocompleteChanges<optionTypes>) => | ||
setComputeMethod(changes.selectedItems[0]) | ||
} | ||
></Autocomplete> | ||
</Styled.AutocompleteWrapper> | ||
); | ||
}; |
13 changes: 7 additions & 6 deletions
13
src/features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions.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
53 changes: 50 additions & 3 deletions
53
src/pages/ModelPages/Compute/ComputeObject/ComputeObject.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,7 +1,54 @@ | ||
import { Typography } from '@equinor/eds-core-react'; | ||
import { useState } from 'react'; | ||
import { CaseCard } from '../../../../features/Compute/ComputeVariogram/CaseCard/CaseCard'; | ||
import { ComputeCaseInfoActions } from '../../../../features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions'; | ||
import { CaseInfoTyoe, Casetype } from '../ComputeVariogram/ComputeVariogram'; | ||
import * as Styled from '../ComputeVariogram/ComputeVariogram.styled'; | ||
|
||
export const ComputeObject = () => { | ||
const [cases, setCases] = useState<Casetype[]>([ | ||
{ id: '1', name: 'Variogram Case 1' }, | ||
]); | ||
const ObjectCaseInfo: CaseInfoTyoe = { | ||
title: 'Object cases', | ||
info: 'You can add multiple cases for the different areas in your model.', | ||
addText: 'Add object case', | ||
runText: 'Run all object cases', | ||
}; | ||
|
||
const addCase = () => { | ||
const newCase: Casetype = { | ||
id: `${Math.floor(Math.random() * 100)}`, | ||
name: `Object Case ${cases.length + 1}`, | ||
}; | ||
setCases([...cases, newCase]); | ||
}; | ||
|
||
const removeCase = (id: string) => { | ||
const newCaseList = cases.filter((c) => c.id !== id); | ||
setCases(newCaseList); | ||
}; | ||
|
||
return ( | ||
<> | ||
<p>Options to compute object will soon be possible here!</p> | ||
</> | ||
<Styled.Case> | ||
<ComputeCaseInfoActions addCase={addCase} caseInfo={ObjectCaseInfo} /> | ||
{cases.length !== 0 ? ( | ||
cases.map((c) => ( | ||
<Styled.CaseBorder key={c.id}> | ||
<CaseCard | ||
id={c.id} | ||
name={c.name} | ||
removeCase={removeCase} | ||
caseType={'object'} | ||
/> | ||
</Styled.CaseBorder> | ||
)) | ||
) : ( | ||
<Typography>Add a Case</Typography> | ||
)} | ||
<Styled.AddCaseButton variant="outlined" onClick={addCase}> | ||
Add variogram case | ||
</Styled.AddCaseButton> | ||
</Styled.Case> | ||
); | ||
}; |
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