From 99280341784a3d579b9ab126b8ff2425febdd1bb Mon Sep 17 00:00:00 2001
From: Aron Demeter <66035744+dem4ron@users.noreply.github.com>
Date: Wed, 15 Jan 2025 13:21:49 +0100
Subject: [PATCH] Don't show obsolete PreviousTestResultsView (#7317)
* Don't render previous test result views
* Remove unused imports
* Don't show uhoh if errorHtml is missing
---
.../SolveExercisePage/ControlButtons/ControlButtons.tsx | 3 ---
.../bootcamp/SolveExercisePage/SolveExercisePage.tsx | 2 --
.../TestResultsView/StateTestResultView.tsx | 7 ++++++-
.../SolveExercisePage/TestResultsView/TestResultInfo.tsx | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/javascript/components/bootcamp/SolveExercisePage/ControlButtons/ControlButtons.tsx b/app/javascript/components/bootcamp/SolveExercisePage/ControlButtons/ControlButtons.tsx
index 556304ef94..383c392ed0 100644
--- a/app/javascript/components/bootcamp/SolveExercisePage/ControlButtons/ControlButtons.tsx
+++ b/app/javascript/components/bootcamp/SolveExercisePage/ControlButtons/ControlButtons.tsx
@@ -3,7 +3,6 @@ import { TestResultsButtons } from '../TestResultsView/TestResultsButtons'
import { wrapWithErrorBoundary } from '@/components/bootcamp/common/ErrorBoundary/wrapWithErrorBoundary'
import { CheckScenariosButton } from './CheckScenariosButton'
import useTestStore from '../store/testStore'
-import { PreviousTestResultsButtons } from '../PreviousTestResultsView/PreviousTestResultsButtons'
import { assembleClassNames } from '@/utils/assemble-classnames'
function _ControlButtons({ handleRunCode }: { handleRunCode: () => void }) {
@@ -16,8 +15,6 @@ function _ControlButtons({ handleRunCode }: { handleRunCode: () => void }) {
{/* Just ran the tests */}
- {/* Previous test result buttons - previous means we had a submission of this exercise saved in the db */}
-
)
}
diff --git a/app/javascript/components/bootcamp/SolveExercisePage/SolveExercisePage.tsx b/app/javascript/components/bootcamp/SolveExercisePage/SolveExercisePage.tsx
index faf4c64104..d9814577c8 100644
--- a/app/javascript/components/bootcamp/SolveExercisePage/SolveExercisePage.tsx
+++ b/app/javascript/components/bootcamp/SolveExercisePage/SolveExercisePage.tsx
@@ -10,7 +10,6 @@ import ErrorBoundary from '../common/ErrorBoundary/ErrorBoundary'
import { Resizer, useResizablePanels } from './hooks/useResize'
import { TaskPreview } from './TaskPreview/TaskPreview'
import SolveExercisePageContextWrapper from './SolveExercisePageContextWrapper'
-import { PreviousTestResultView } from './PreviousTestResultsView/PreviousTestResultsView'
import { Header } from './Header/Header'
import { useLocalStorage } from '@uidotdev/usehooks'
@@ -94,7 +93,6 @@ export default function SolveExercisePage({
-
diff --git a/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/StateTestResultView.tsx b/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/StateTestResultView.tsx
index 7d66b02fb0..dc451f4d36 100644
--- a/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/StateTestResultView.tsx
+++ b/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/StateTestResultView.tsx
@@ -1,6 +1,11 @@
import { GraphicalIcon } from '@/components/common'
import React from 'react'
-export function StateTestResultView({ errorHtml }: { errorHtml: string }) {
+export function StateTestResultView({
+ errorHtml,
+}: {
+ errorHtml: string | undefined
+}) {
+ if (!errorHtml) return null
return (
diff --git a/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/TestResultInfo.tsx b/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/TestResultInfo.tsx
index baf0db3d5c..399274530a 100644
--- a/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/TestResultInfo.tsx
+++ b/app/javascript/components/bootcamp/SolveExercisePage/TestResultsView/TestResultInfo.tsx
@@ -15,7 +15,7 @@ export function TestResultInfo({
return null
}
if (firstExpect.testsType === 'state') {
- return
+ return
} else {
return (
<>