Skip to content

Commit

Permalink
Update App.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
MysteryFlask committed Nov 19, 2024
1 parent 7569413 commit 7eb22b7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
31 changes: 28 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,31 @@ const NotepadWindow = ({ onClose }) => {
};

const CommandPromptWindow = ({ onClose }) => {
const [commandInput, setCommandInput] = useState('');
const [commandOutput, setCommandOutput] = useState('');

const handleCommandInput = (event) => {
setCommandInput(event.target.value)
}

const handleKeyPress = (event) => {
if (event.key === 'Enter') {
const formattedInput = commandInput.toUpperCase()
if (formattedInput.trim() === 'HELP') {
setCommandOutput(`For more information on a specific command, type HELP command-name\nVER Displays the Windows version.`)
} else if (formattedInput.startsWith('HELP ')) {
if (formattedInput.slice(5) === 'VER') {
setCommandOutput(`Displays the Windows version.\n\nVER`)
}
} else if (formattedInput === 'VER') {
setCommandOutput(`Microsoft Windows [Version 6.1.7601]`)
} else {
setCommandOutput(`'${commandInput}' is not recognized as an internal or external command, operable program or batch file.`)
}
setCommandInput('')
}
};

return (
<Rnd
default={{
Expand All @@ -633,9 +658,9 @@ const CommandPromptWindow = ({ onClose }) => {
</div>
</div>
<div className="window-body has-space commandprompt">
<div className="placeholder commandprompt">
<p>Command Prompt Window</p>
<p>Work in Progress...</p>
<div className="placeholder">
<div className="inputcontainer"><div>C:\Windows\System32&gt;&nbsp;</div><input type="text" id="commandinput" value={commandInput} onChange={handleCommandInput} onKeyDown={handleKeyPress}></input></div>
<textarea id="commandoutput" rows={4} disabled value={commandOutput}></textarea>
</div>
</div>
</div>
Expand Down
32 changes: 29 additions & 3 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,35 @@

.commandprompt {
background: black !important;
color: white
color: white;
display: flex;
flex-direction: column;
}

.inputcontainer {
display: flex;
align-items: center;
}

.commandprompt > p {
margin: 3px;
#commandinput {
width: 100%;
background: none;
border: none;
border-radius: 0;
box-sizing: border-box;
font: 9pt Segoe UI, SegoeUI, Noto Sans, sans-serif;
padding: 0;
color: white;
}

#commandoutput {
width: 100%;
background: none;
border: none;
border-radius: 0;
box-sizing: border-box;
font: 9pt Segoe UI, SegoeUI, Noto Sans, sans-serif;
padding: 0;
color: white;
resize: none;
}

0 comments on commit 7eb22b7

Please sign in to comment.