From 6a380dfad03ba06813b328813f185d7bff32cc86 Mon Sep 17 00:00:00 2001 From: mheggelund Date: Tue, 3 Oct 2023 14:48:41 +0200 Subject: [PATCH] chore: onClick to add case, conditional caseParameters for compute method --- .../ComputeVariogram/CaseCard/CaseCard.tsx | 37 +++++++++++-------- .../ComputeCaseInfoActions.tsx | 10 ++++- .../ComputeVariogram/ComputeVariogram.tsx | 35 +++++++++++++++--- 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx index a75a7753..3da0e3e4 100644 --- a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx +++ b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx @@ -12,7 +12,7 @@ export default interface optionTypes { size?: string } -export const CaseCard = () => { +export const CaseCard = ({ name }: { name: string }) => { const [selectedModelArea, setModelArea] = useState() const [selectedComputeMethod, setComputeMethod] = useState() const [selectedGrainSize, setGrainSize] = useState() @@ -58,7 +58,7 @@ export const CaseCard = () => { return ( - Variogram/object case N + {name} {
{selectedModelArea && selectedComputeMethod ? ( - + {selectedComputeMethod.name === 'Net-to-gross' && ( + + )} + {selectedComputeMethod.name === 'Continuous parameter' && ( + + )} + { selectedVariogramModels={selectedVariogramModels} setVariogramModels={setVariogramModels} /> - ) : ( diff --git a/src/features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions.tsx b/src/features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions.tsx index 45c8682f..da138fe4 100644 --- a/src/features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions.tsx +++ b/src/features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions.tsx @@ -1,7 +1,11 @@ import { Button, Typography } from '@equinor/eds-core-react' import * as Styled from './ComputeCaseInfoActions.styled' -export const ComputeCaseInfoActions = () => { +export const ComputeCaseInfoActions = ({ + addCase, +}: { + addCase: () => void +}) => { return ( @@ -11,7 +15,9 @@ export const ComputeCaseInfoActions = () => { - + diff --git a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx index 9f05d421..ba9faec9 100644 --- a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx +++ b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx @@ -1,15 +1,40 @@ +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 * as Styled from './ComputeVariogram.styled' +interface Casetype { + id: number + name: string +} export const ComputeVariogram = () => { + const [cases, setCases] = useState([ + { id: 1, name: 'Variogram Case 1' }, + ]) + + const AddCase = () => { + const newCase: Casetype = { + id: Math.floor(Math.random() * 100), + name: `Variogram Case ${cases.length + 1}`, + } + + setCases([...cases, newCase]) + } + return ( - - - - - + + {cases.length !== 0 ? ( + cases.map((c) => ( + + + + )) + ) : ( + Add a Case + )} + Add variogram case