Add save function

This commit is contained in:
Daniel Kluge
2022-06-21 18:44:20 +02:00
parent de0e758ebb
commit 9531ab7006
10 changed files with 99 additions and 30 deletions
+3 -1
View File
@@ -2,7 +2,8 @@ import { MutableRefObject, useEffect, useRef, useState } from "react";
import REPLInput from "./REPLInput";
import REPLHistory from "./REPLHistory";
import styles from "../../styles/REPL/REPLComplete.module.css";
import type { NextPage, GetStaticProps } from "next";
import type { NextPage } from "next";
import { useCommands } from "../../lib/commands/ContextProvider";
interface IREPLProps {
inputRef: MutableRefObject<HTMLInputElement|null>;
@@ -12,6 +13,7 @@ interface IREPLProps {
const REPL: NextPage<IREPLProps> = ({ inputRef, buildTime }) => {
const [history, manipulateHistory] = useState<string[]>([`cer0 0S - Build ${buildTime}`]);
const containerRef = useRef<HTMLDivElement>(null);
const onCommandExecuted = (result: string[]) => manipulateHistory(result.reverse().concat(history).slice(0, 1000));
const onClearHistory = () => manipulateHistory([]);