Skip to content

Commit 19fc127

Browse files
committed
(v0.1.6.0-alpha) Terminal + Others
Visual changes to notepad and the system tray. TERMINAL (Command Prompt). Commands work, custom commands and outputs can be set in Cmd.js. Soo I had faced into this issue where the whole screen was doing sm kind of thing, it was due to a lone div containing a useRef AND the autoFocus in the input. I LEGIT spent 30mins debugging (even asked gemini) without any progress. Finally decided to manually go through EACH LINE commenting then checkng. Finally found the buggy lines anf fixed. I hate my life-
1 parent e1a5a1b commit 19fc127

File tree

11 files changed

+157
-49
lines changed

11 files changed

+157
-49
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ Your PC has been compromised by a group called the "HackClub". Can you regain co
4242
- [ ] Progress Panel and Hint page with proper functionalities
4343
- [X] Remove Border on Fullscreen (Fixed v0.1.5.8(2))
4444
- [ ] BUG: The windows menu opens but the indicator is not shown in the taskbar
45-
- [ ] Make Progress Panel actually show progress.
45+
- [ ] Make Progress Panel actually show progress.
46+
- [ ] Terminal (Proper) Selection, Proper fonts

devlog_template.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
## [(v0.1.5.8(1)-alpha)](https://github.com/rupnil-codes/Override.exe/commit/1834df0) Progressing with the Taskbars
2-
---
3-
### Changelog
4-
- [(v0.1.5.8(1)-alpha)](https://github.com/rupnil-codes/Override.exe/commit/1834df0) Strikethrough!: Ahhh soo the noteppad was looking kinda bbare so i decided to add thi feature cuz why not!! THis adds strikethrough to the text duhhh-
5-
- [(v0.1.5.8-alpha)](https://github.com/rupnil-codes/Override.exe/commit/8e3f2d6) Notepad Functions + Progress Panel: FINNALLYY got the notepad stuff to work, like bold, italics, and underline. I removed the H1 cuz it was awful. It is what it is. Also i added the progress sidebar container.
6-
- [(v0.1.5.7-alpha)](https://github.com/rupnil-codes/Override.exe/commit/6a0b690) Progress Button: Added the progress button that will open a panel that will show the user how many puzzles are left, how many they have competed, hints, and the elapsed time.
1+
72
---
83
### Next Steps:
9-
- A game sequence (designing)
10-
- Each App T-T (1.5/6)
4+
- ~~A game sequence~~ (DESIGNED!)
5+
- Each App T-T (2/6)
116
- Hints and Actual Gameplay
127
---
138
### Notes:

src/App.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function App() {
1616
<ProgressPanel/>
1717

1818
<Routes>
19-
<Route path="/" Component={LockScreen}/>
20-
<Route path="/desktop" Component={Desktop}/>
19+
<Route path="/desktop" Component={LockScreen}/>
20+
<Route path="/" Component={Desktop}/>
2121
</Routes>
2222
</div>
2323
</>

src/apps/terminal.jsx

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,81 @@
1-
import "../styles/apps/terminal.css"
1+
import React, { useState, useEffect, useRef } from "react";
2+
import "../styles/apps/terminal.css";
3+
import { COMMANDS } from "../data/Cmd.js";
24

35
function Terminal() {
6+
const [history, setHistory] = useState([
7+
{ type: 'info', content: 'Microsoft Windows [Version 10.0.26200.7840]' },
8+
{ type: 'info', content: '(c) Microsoft Corporation. All rights reserved.\n ' }
9+
]);
10+
const [input, setInput] = useState("");
11+
12+
const terminalRef = useRef(null);
13+
const inputRef = useRef(null);
14+
const [lastCmd, setLastCmd] = useState("");
15+
16+
useEffect(() => {
17+
if (terminalRef.current) {
18+
terminalRef.current.scrollTop = terminalRef.current.scrollHeight;
19+
}
20+
}, [history]);
21+
22+
const handleKeyDown = (e) => {
23+
24+
if (e.key === "ArrowUp") {
25+
setInput(lastCmd);
26+
}
27+
28+
if (e.key === "Enter") {
29+
setLastCmd(input);
30+
const cleanInput = input.trim();
31+
const cmd = cleanInput.toLowerCase();
32+
33+
setInput("");
34+
35+
if (cmd === "clear" || cmd === "cls") {
36+
setHistory([]);
37+
return;
38+
}
39+
40+
const newEntry = { type: 'cmd', content: `C:\\Users\\rupnil> ${cleanInput}` };
41+
let response = null;
42+
43+
if (cmd !== "") {
44+
if (COMMANDS[cmd]) {
45+
const output = typeof COMMANDS[cmd] === 'function' ? COMMANDS[cmd]() : COMMANDS[cmd]+"\n ";
46+
response = { type: 'output', content: output };
47+
} else {
48+
response = { type: 'error', content: `'${cmd}' is not recognized as an internal or external command, \noperable program or batch file.\n ` };
49+
}
50+
}
51+
setHistory(prev => response ? [...prev, newEntry, response] : [...prev, newEntry]);
52+
}
53+
};
454

555
return (
6-
<>
7-
<p>Terminal</p>
8-
</>
9-
)
56+
<div
57+
className="terminal-app terminal-content"
58+
ref={terminalRef}
59+
onClick={() => inputRef.current?.focus()}
60+
>
61+
{history.map((line, i) => (
62+
<p key={i} className={`line ${line.type}`}>{line.content}</p>
63+
))}
64+
65+
<div className="input-line">
66+
<span className="prompt">C:\Users\rupnil{'>'}</span>
67+
<input
68+
ref={inputRef}
69+
type="text"
70+
value={input}
71+
onChange={(e) => setInput(e.target.value)}
72+
onKeyDown={handleKeyDown}
73+
autoComplete="off"
74+
spellCheck="false"
75+
/>
76+
</div>
77+
</div>
78+
);
1079
}
1180

12-
export default Terminal
81+
export default Terminal;

src/data/Apps.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const APP_REGISTRY = {
3838
title: "Terminal",
3939
component: Terminal,
4040
imgSrc: "/assets/icons/Terminal.ico",
41+
tabs: true,
4142
},
4243

4344
readme_txt: {

src/data/Cmd.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export const COMMANDS = {
3+
help: "Available commands: help, clear/cls, about, shiden",
4+
about: "Go find out",
5+
shiden: "https://flavortown.hackclub.com/projects/10866",
6+
"rm -rf": "Are you f**king mad?? This is windows you idiot."
7+
};

src/styles/apps/readme_txt.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
flex-direction: column;
77
align-items: center;
88

9-
background-color: #181818;
9+
background-color: #0e0e0e;
1010
overflow: hidden;
1111

1212
border-radius: 0 0 8px 8px;
@@ -22,7 +22,8 @@
2222
justify-content: center;
2323

2424
background-color: #0e0e0e;
25-
border: #0e0e0e solid 1px;
25+
/*border: #0e0e0e solid 1px;*/
26+
border-bottom: var(--border) 1px solid;
2627
}
2728

2829
.readme-file-edit-view {

src/styles/apps/terminal.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.terminal-app {
2+
display: flex;
3+
flex-direction: column;
4+
5+
padding: 1rem;
6+
7+
font-family: "JetBrains Mono", monospace;
8+
font-weight: 250;
9+
font-size: 0.9rem;
10+
11+
height: 100%;
12+
overflow-y: auto;
13+
}
14+
15+
.terminal-app p {
16+
white-space: pre-wrap;
17+
}
18+
19+
.input-line {
20+
display: flex;
21+
gap: 5px;
22+
}
23+
24+
.input-line input {
25+
background: transparent;
26+
border: none;
27+
color: white;
28+
outline: none;
29+
flex: 1;
30+
font-family: "JetBrains Mono", monospace;
31+
font-size: inherit;
32+
font-weight: 250;
33+
}

src/styles/components/ProgressPanel.css

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,31 @@
9393
background-color: white;
9494
}
9595

96-
.progress-item-container{
97-
width: 80%;
98-
height: 68%;
99-
100-
display: flex;
101-
flex-direction: column;
102-
align-items: center;
103-
gap: 0.5rem;
104-
105-
overflow: auto;
106-
}
107-
.progress-item {
108-
height: 3rem;
109-
width: 95%;
110-
111-
margin-right: 0.5rem;
112-
113-
flex-shrink: 0;
114-
115-
border-radius: 0.625rem;
116-
/*backdrop-filter: brightness(0);*/
117-
background-color: var(--border);
118-
119-
display: flex;
120-
flex-direction: row;
121-
align-items: center;
122-
justify-content: center;
123-
}
96+
.progress-item-container{
97+
width: 80%;
98+
height: 68%;
99+
100+
display: flex;
101+
flex-direction: column;
102+
align-items: center;
103+
gap: 0.5rem;
104+
105+
overflow: auto;
106+
}
107+
.progress-item {
108+
height: 3rem;
109+
width: 95%;
110+
111+
margin-right: 0.5rem;
112+
113+
flex-shrink: 0;
114+
115+
border-radius: 0.625rem;
116+
/*backdrop-filter: brightness(0);*/
117+
background-color: var(--border);
118+
119+
display: flex;
120+
flex-direction: row;
121+
align-items: center;
122+
justify-content: center;
123+
}

src/styles/components/SystemTray.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
align-items: center;
1010
justify-content: center;
1111
padding-right: 0.75rem;
12-
/*margin-bottom: 0.2rem;*/
12+
margin-bottom: 0.2rem;
1313

1414
gap: 0;
1515
}

0 commit comments

Comments
 (0)