From ac68ba058e23cf7bcd38de4a541f6882856be5d3 Mon Sep 17 00:00:00 2001 From: shmck Date: Tue, 3 Mar 2020 20:56:23 -0800 Subject: [PATCH] closes #118. Scroll to bottom on save --- web-app/src/containers/Tutorial/LevelPage/Level.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web-app/src/containers/Tutorial/LevelPage/Level.tsx b/web-app/src/containers/Tutorial/LevelPage/Level.tsx index 3650b89d..df032780 100644 --- a/web-app/src/containers/Tutorial/LevelPage/Level.tsx +++ b/web-app/src/containers/Tutorial/LevelPage/Level.tsx @@ -82,8 +82,15 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro throw new Error('No Stage steps found') } + const pageBottomRef = React.useRef(null) + + const scrollToBottom = () => { + // @ts-ignore + pageBottomRef.current.scrollIntoView({ behavior: 'smooth' }) + } // @ts-ignore const currentStep = level.steps.findIndex(s => s.status === 'ACTIVE') + React.useEffect(scrollToBottom, [currentStep]) return (
@@ -113,6 +120,7 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro ) })}
+
{(testStatus || processes.length > 0) && (