From 807ffccd5e86ea787af71c0b4299ab6c67e639f9 Mon Sep 17 00:00:00 2001 From: mheggelund Date: Fri, 13 Oct 2023 09:45:22 +0200 Subject: [PATCH] result merge fix --- .../CaseResultCard/CaseResultCard.styled.tsx | 19 +++++++++++++ .../CaseResultCard/CaseResultCard.tsx | 17 ++++++++++++ .../CaseResultList/CaseResultList.styled.tsx | 12 +++++++++ .../CaseResultList/CaseResultList.tsx | 13 +++++++++ .../CaseResultView.styled.tsx} | 4 +-- .../CaseResultView.tsx} | 10 +++---- .../ModelPages/Results/Results.styled.tsx | 27 ------------------- src/pages/ModelPages/Results/Results.tsx | 27 +------------------ src/router.tsx | 4 +-- 9 files changed, 71 insertions(+), 62 deletions(-) create mode 100644 src/features/Results/CaseResult/CaseResultCard/CaseResultCard.styled.tsx create mode 100644 src/features/Results/CaseResult/CaseResultCard/CaseResultCard.tsx create mode 100644 src/features/Results/CaseResult/CaseResultList/CaseResultList.styled.tsx create mode 100644 src/features/Results/CaseResult/CaseResultList/CaseResultList.tsx rename src/features/Results/CaseResult/{CaseResults.styled.tsx => CaseResultView/CaseResultView.styled.tsx} (61%) rename src/features/Results/CaseResult/{CaseResults.tsx => CaseResultView/CaseResultView.tsx} (66%) diff --git a/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.styled.tsx b/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.styled.tsx new file mode 100644 index 00000000..73c729ac --- /dev/null +++ b/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.styled.tsx @@ -0,0 +1,19 @@ +import styled from 'styled-components'; +import { spacings } from '../../../../tokens/spacings'; +import { theme } from '../../../../tokens/theme'; + +export const CaseResultCard = styled.div` + display: flex; + flex-direction: row; + + width: 60%; + column-gap: ${spacings.LARGE}; + padding-left: ${spacings.LARGE}; + + background-color: ${theme.light.ui.background.light}; + + &:hover { + background-color: ${theme.light.ui.background.medium}; + cursor: pointer; + } +`; diff --git a/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.tsx b/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.tsx new file mode 100644 index 00000000..13816c2a --- /dev/null +++ b/src/features/Results/CaseResult/CaseResultCard/CaseResultCard.tsx @@ -0,0 +1,17 @@ +import { useNavigate } from 'react-router-dom'; +import { ResultType } from '../../../../pages/ModelPages/Results/Results'; +import * as Styled from './CaseResultCard.styled'; + +export const CaseResultCard = ({ result }: { result: ResultType }) => { + const navigate = useNavigate(); + const handleClick = () => { + navigate(`${result.id}`); + }; + + return ( + +

{result.case}

+ {result.finished ?

Finished

:

Not computed yet!

} +
+ ); +}; diff --git a/src/features/Results/CaseResult/CaseResultList/CaseResultList.styled.tsx b/src/features/Results/CaseResult/CaseResultList/CaseResultList.styled.tsx new file mode 100644 index 00000000..a702fc25 --- /dev/null +++ b/src/features/Results/CaseResult/CaseResultList/CaseResultList.styled.tsx @@ -0,0 +1,12 @@ +import styled from 'styled-components'; +import { spacings } from '../../../../tokens/spacings'; + +export const CaseResultList = styled.div` + display: flex; + flex-direction: column; + + column-gap: ${spacings.LARGE}; + row-gap: ${spacings.LARGE}; + + margin: ${spacings.XXX_LARGE}; +`; diff --git a/src/features/Results/CaseResult/CaseResultList/CaseResultList.tsx b/src/features/Results/CaseResult/CaseResultList/CaseResultList.tsx new file mode 100644 index 00000000..31e1ef03 --- /dev/null +++ b/src/features/Results/CaseResult/CaseResultList/CaseResultList.tsx @@ -0,0 +1,13 @@ +import { ResultType } from '../../../../pages/ModelPages/Results/Results'; +import { CaseResultCard } from '../../CaseResult/CaseResultCard/CaseResultCard'; +import * as Styled from './CaseResultList.styled'; + +export const CaseResultList = ({ results }: { results: ResultType[] }) => { + return ( + + {results.map((res: ResultType) => ( + + ))} + + ); +}; diff --git a/src/features/Results/CaseResult/CaseResults.styled.tsx b/src/features/Results/CaseResult/CaseResultView/CaseResultView.styled.tsx similarity index 61% rename from src/features/Results/CaseResult/CaseResults.styled.tsx rename to src/features/Results/CaseResult/CaseResultView/CaseResultView.styled.tsx index 3eb12218..1d15c442 100644 --- a/src/features/Results/CaseResult/CaseResults.styled.tsx +++ b/src/features/Results/CaseResult/CaseResultView/CaseResultView.styled.tsx @@ -1,6 +1,6 @@ import styled from 'styled-components'; -import { spacings } from '../../../tokens/spacings'; -export const CaseResults = styled.div` +import { spacings } from '../../../../tokens/spacings'; +export const CaseResultView = styled.div` display: flex; flex-direction: column; diff --git a/src/features/Results/CaseResult/CaseResults.tsx b/src/features/Results/CaseResult/CaseResultView/CaseResultView.tsx similarity index 66% rename from src/features/Results/CaseResult/CaseResults.tsx rename to src/features/Results/CaseResult/CaseResultView/CaseResultView.tsx index 51ea6294..0145897b 100644 --- a/src/features/Results/CaseResult/CaseResults.tsx +++ b/src/features/Results/CaseResult/CaseResultView/CaseResultView.tsx @@ -1,7 +1,7 @@ -import { ResultType } from '../../../pages/ModelPages/Results/Results'; -import * as Styled from './CaseResults.styled'; +import { ResultType } from '../../../../pages/ModelPages/Results/Results'; +import * as Styled from './CaseResultView.styled'; -export const CaseResults = () => { +export const CaseResultView = () => { const caseResult: ResultType = { id: '1', case: 'Variogramcase 1', @@ -14,11 +14,11 @@ export const CaseResults = () => { return ( <> - +

Case Result

{caseResult.case}

{caseResult.finished ?

Finished

:

Not computed yet!

} -
+ ); }; diff --git a/src/pages/ModelPages/Results/Results.styled.tsx b/src/pages/ModelPages/Results/Results.styled.tsx index 7c101521..6303e2e2 100644 --- a/src/pages/ModelPages/Results/Results.styled.tsx +++ b/src/pages/ModelPages/Results/Results.styled.tsx @@ -1,6 +1,5 @@ import styled from 'styled-components'; import { spacings } from '../../../tokens/spacings'; -import { theme } from '../../../tokens/theme'; export const TextDiv = styled.div` display: flex; @@ -9,29 +8,3 @@ export const TextDiv = styled.div` row-gap: ${spacings.MEDIUM}; `; - -export const ResultCaseList = styled.div` - display: flex; - flex-direction: column; - - column-gap: ${spacings.LARGE}; - row-gap: ${spacings.LARGE}; - - margin: ${spacings.XXX_LARGE}; -`; - -export const ResultCaseCard = styled.div` - display: flex; - flex-direction: row; - - width: 60%; - column-gap: ${spacings.LARGE}; - padding-left: ${spacings.LARGE}; - - background-color: ${theme.light.ui.background.light}; - - &:hover { - background-color: ${theme.light.ui.background.medium}; - cursor: pointer; - } -`; diff --git a/src/pages/ModelPages/Results/Results.tsx b/src/pages/ModelPages/Results/Results.tsx index a9ddecc4..6e47be16 100644 --- a/src/pages/ModelPages/Results/Results.tsx +++ b/src/pages/ModelPages/Results/Results.tsx @@ -1,6 +1,5 @@ -import { useNavigate } from 'react-router-dom'; +import { CaseResultList } from '../../../features/Results/CaseResult/CaseResultList/CaseResultList'; import { NoResults } from '../../../features/Results/NoResults/NoResults'; -import * as Styled from './Results.styled'; export type ResultType = { id: string; @@ -20,27 +19,3 @@ export const Results = () => { ); }; - -const CaseResultList = ({ results }: { results: ResultType[] }) => { - return ( - - {results.map((res: ResultType) => ( - - ))} - - ); -}; - -const ResultCaseCard = ({ result }: { result: ResultType }) => { - const navigate = useNavigate(); - const handleClick = () => { - navigate(`${result.id}`); - }; - - return ( - -

{result.case}

- {result.finished ?

Finished

:

Not computed yet!

} -
- ); -}; diff --git a/src/router.tsx b/src/router.tsx index 3f12bfab..4523c253 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -1,7 +1,7 @@ import { createBrowserRouter, NonIndexRouteObject } from 'react-router-dom'; import { App } from './App'; import { ModelView } from './features/ModelView/ModelView'; -import { CaseResults } from './features/Results/CaseResult/CaseResults'; +import { CaseResultView } from './features/Results/CaseResult/CaseResultView/CaseResultView'; import { About } from './pages/About/About'; import { Api } from './pages/Api/Api'; import { Browse } from './pages/Browse/Browse'; @@ -47,7 +47,7 @@ const appRoutes = (tabs as NonIndexRouteObject[]).concat([ path: 'results', element: , }, - { path: 'results/:id', element: }, + { path: 'results/:id', element: }, ], }, ]);