From 4849f65efc465768b80b4634da07d07f8a51b4d5 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Mon, 25 Nov 2024 00:58:22 -0500 Subject: [PATCH 1/3] Initial --- pease-portfolio/src/app/page.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pease-portfolio/src/app/page.js b/pease-portfolio/src/app/page.js index c8b9f20..4fe4791 100644 --- a/pease-portfolio/src/app/page.js +++ b/pease-portfolio/src/app/page.js @@ -1,18 +1,21 @@ +"use client" + import Projects from "./projects.json" import moment from "moment" import LinkedInIcon from '@mui/icons-material/LinkedIn'; import GitHubIcon from '@mui/icons-material/GitHub'; import EmailIcon from '@mui/icons-material/Email'; import Link from "next/link" - -export async function generateMetadata() { - return { - title: 'Home | nicholaspease.com' - } -} - +import { useEffect, useState } from "react"; function AboutMe() { + var [typed, setTyped] = useState("") + useEffect(() => { + var onType = (e) => { + setTyped(typed => typed + e.key) + } + document.addEventListener("keyup", onType) + }, []) return (
@@ -39,7 +42,7 @@ function AboutMe() {
about@npease:~$ timedatectl --lastupdated
This website was last updated on {moment().format("dddd, MMMM Do YYYY")}.
- about@npease:~$ + about@npease:~$ {typed}
@@ -69,6 +72,7 @@ function NotableProject({name}) { function ProjectsHome() { return (
+ Home | nicholaspease.com
Notable Projects
-- 2.52.0 From 930daf4c509d03b1603897ce81b922e1657e1855 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Mon, 25 Nov 2024 01:00:15 -0500 Subject: [PATCH 2/3] Initial PT 2 --- pease-portfolio/src/app/page.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pease-portfolio/src/app/page.js b/pease-portfolio/src/app/page.js index 4fe4791..055d2ef 100644 --- a/pease-portfolio/src/app/page.js +++ b/pease-portfolio/src/app/page.js @@ -9,13 +9,7 @@ import Link from "next/link" import { useEffect, useState } from "react"; function AboutMe() { - var [typed, setTyped] = useState("") - useEffect(() => { - var onType = (e) => { - setTyped(typed => typed + e.key) - } - document.addEventListener("keyup", onType) - }, []) + return (
@@ -42,7 +36,7 @@ function AboutMe() {
about@npease:~$ timedatectl --lastupdated
This website was last updated on {moment().format("dddd, MMMM Do YYYY")}.
- about@npease:~$ {typed} + about@npease:~$
-- 2.52.0 From bc528956901e61287456679db25806cc42622322 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Wed, 27 Nov 2024 00:09:24 -0500 Subject: [PATCH 3/3] Add terminal --- pease-portfolio/src/app/page.js | 22 ++----- pease-portfolio/src/components/terminal.js | 67 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 pease-portfolio/src/components/terminal.js diff --git a/pease-portfolio/src/app/page.js b/pease-portfolio/src/app/page.js index 055d2ef..38c6744 100644 --- a/pease-portfolio/src/app/page.js +++ b/pease-portfolio/src/app/page.js @@ -1,15 +1,15 @@ "use client" import Projects from "./projects.json" -import moment from "moment" import LinkedInIcon from '@mui/icons-material/LinkedIn'; import GitHubIcon from '@mui/icons-material/GitHub'; import EmailIcon from '@mui/icons-material/Email'; import Link from "next/link" -import { useEffect, useState } from "react"; + +import { Terminal } from "../components/terminal.js" + function AboutMe() { - return (
@@ -24,20 +24,8 @@ function AboutMe() {
-
-
-            MOTD: This website is still under construction
- about@npease:~$ uname -a
-
- Hello! My name is Nicholas Pease and I am currently a junior at the University of Maine pursuing a bachelors degree in - Computer Science with a minor in Military Science. This website is a collection of both project / homework completed as - required by my studies and as a showcase of some of the personal projects I have worked on. I will work to keep this up - to date to the best of my ability.
-
- about@npease:~$ timedatectl --lastupdated
- This website was last updated on {moment().format("dddd, MMMM Do YYYY")}.
- about@npease:~$ -
+
+
diff --git a/pease-portfolio/src/components/terminal.js b/pease-portfolio/src/components/terminal.js new file mode 100644 index 0000000..e961424 --- /dev/null +++ b/pease-portfolio/src/components/terminal.js @@ -0,0 +1,67 @@ +import { useEffect, useState } from "react"; +import moment from "moment" + +var commands = { + "uname -a": "Hello! My name is Nicholas Pease and I am currently a junior at the University of Maine pursuing a bachelors degree in Computer Science with a minor in Military Science. This website is a collection of both project / homework completed as required by my studies and as a showcase of some of the personal projects I have worked on. I will work to keep this up to date to the best of my ability. ", + "timedatectl": `This website was last updated on ${moment().format("dddd, MMMM Do YYYY")}.` +} + +function Command({command, result}) { + return ( +
+ about@npease:~$ {command}
+
+ {result? result: commands[command]}
+
+
+ ) +} + +export function Terminal() { + const [text, setText] = useState("") + const [history, setHistory] = useState([,]) + const handleKeyDown = event => { + event.preventDefault() + if (event.code == "Backspace") {setText(text.slice(0, -1))} + else if (event.code == "Enter") { + if (text == "clear") { + setHistory([]) + } else { + commands[text] != null? setHistory([...history, ]): `Command '${text.split(" ")[0]}' not found.` + } + setText("") + } + else if (event.code == "ArrowUp") {history.length>0? setText(history[history.length-1].props.command): ""} + else if (event.code == "ArrowDown") {setText("")} + else if (event.code == "Minus") {setText(text + "-")} + else if (isValidKey(event)) {setText(text + event.key)} + }; + return ( +
+
+                {history}
+                
+ about@npease:~$ {text} +
+
+
+ ) +} + +function isValidKey(event) { + const charCodes = [ + 'KeyA', 'KeyB', 'KeyC', 'KeyD', 'KeyE', 'KeyF', 'KeyG', 'KeyH', 'KeyI', 'KeyJ', + 'KeyK', 'KeyL', 'KeyM', 'KeyN', 'KeyO', 'KeyP', 'KeyQ', 'KeyR', 'KeyS', 'KeyT', + 'KeyU', 'KeyV', 'KeyW', 'KeyX', 'KeyY', 'KeyZ', + 'KeyA', 'KeyB', 'KeyC', 'KeyD', 'KeyE', 'KeyF', 'KeyG', 'KeyH', 'KeyI', 'KeyJ', + 'KeyK', 'KeyL', 'KeyM', 'KeyN', 'KeyO', 'KeyP', 'KeyQ', 'KeyR', 'KeyS', 'KeyT', + 'KeyU', 'KeyV', 'KeyW', 'KeyX', 'KeyY', 'KeyZ', + 'Digit0', 'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9', + 'Space' + ]; + if (charCodes.includes(event.code)) { + return true; + } else { + return false; + } +} \ No newline at end of file -- 2.52.0