From ad7cc257663eec44afc48f23519b776b2d0ab06c Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Fri, 13 Jun 2025 00:15:30 -0600 Subject: [PATCH] fixed terminal --- src/components/Terminal.tsx | 60 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/components/Terminal.tsx b/src/components/Terminal.tsx index 7c11c0d..0132cc8 100644 --- a/src/components/Terminal.tsx +++ b/src/components/Terminal.tsx @@ -31,10 +31,10 @@ const Terminal = () => { const terminalRef = useRef(null); useEffect(() => { - if (terminalRef.current) { + if (terminalRef.current && !isTrainRunning) { terminalRef.current.scrollTop = terminalRef.current.scrollHeight; } - }, [commandHistory]); + }, [commandHistory, isTrainRunning]); // Load command history from localStorage useEffect(() => { @@ -130,7 +130,7 @@ const Terminal = () => { }; return ( -
+
@@ -144,31 +144,11 @@ const Terminal = () => {
inputRef.current?.focus()} + className={`flex-1 p-4 overflow-y-auto scrollbar-thin scrollbar-thumb-base-300 scrollbar-track-base-100 relative ${ + isTrainRunning ? 'opacity-0' : 'opacity-100' + }`} + onClick={() => !isTrainRunning && inputRef.current?.focus()} > - {isTrainRunning && ( -
-
{`
-      ====        ________                ___________
-  _D _|  |_______/        \\__I_I_____===__|_________|
-   |(_)---  |   H\\________/ |   |        =|___ ___|      _________________
-   /     |  |   H  |  |     |   |         ||_| |_||     _|                \\_____A
-  |      |  |   H  |__--------------------| [___] |   =|                        |
-  | ________|___H__/__|_____/[][]~\\_______|       |   -|                        |
-  |/ |   |-----------I_____I [][] []  D   |=======|____|________________________|_
-__/ =| o |=-O=====O=====O=====O \\ ____Y___________|__|__________________________|_
- |/-=|___|=    ||    ||    ||    |_____/~\\___/          |_D__D__D_|  |_D__D__D_|
-  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/               \\_/   \\_/    \\_/   \\_/`}
-
- )} -
{commandHistory.map((command: Command, index: number) => (
@@ -218,7 +198,33 @@ __/ =| o |=-O=====O=====O=====O \\ ____Y___________|__|_________________________ )}
+
+ + {/* Train animation overlay - positioned over the content area but outside the opacity div */} + {isTrainRunning && ( +
+
+
{`
+      ====        ________                ___________
+  _D _|  |_______/        \\__I_I_____===__|_________|
+   |(_)---  |   H\\________/ |   |        =|___ ___|      _________________
+   /     |  |   H  |  |     |   |         ||_| |_||     _|                \\_____A
+  |      |  |   H  |__--------------------| [___] |   =|                        |
+  | ________|___H__/__|_____/[][]~\\_______|       |   -|                        |
+  |/ |   |-----------I_____I [][] []  D   |=======|____|________________________|_
+__/ =| o |=-O=====O=====O=====O \\ ____Y___________|__|__________________________|_
+ |/-=|___|=    ||    ||    ||    |_____/~\\___/          |_D__D__D_|  |_D__D__D_|
+  \\_/      \\__/  \\__/  \\__/  \\__/      \\_/               \\_/   \\_/    \\_/   \\_/`}
+
+
+ )}
); };