-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFACTOR: Reorganize types and interfaces, remove unused models (#78)
* refactor: reorganize types and interfaces, remove unused models * refactor: update import for DataPacket to IDataPacket in serialUtils * refactor: update interface names for consistency and clarity * refactor: update import paths for consistency and clarity
- Loading branch information
Showing
18 changed files
with
713 additions
and
492 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { | ||
faPaperPlane, | ||
faCircleXmark, | ||
faCode, | ||
} from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
||
interface IConsole { | ||
consoleMessageList: string; | ||
command: string; | ||
setCommand: (value: string) => void; | ||
setConsoleMessageList: (value: string) => void; | ||
sendCommand: () => Promise<void>; | ||
scriptStatus: string; | ||
scriptRunning: boolean; | ||
scriptFileInputRef: React.RefObject<HTMLInputElement>; | ||
} | ||
|
||
export const Console: React.FC<IConsole> = ({ | ||
consoleMessageList, | ||
command, | ||
setCommand, | ||
setConsoleMessageList, | ||
sendCommand, | ||
scriptStatus, | ||
scriptRunning, | ||
scriptFileInputRef, | ||
}) => { | ||
return ( | ||
<div className="flex h-full w-full flex-col items-center justify-center gap-1"> | ||
<textarea | ||
className="h-full w-full rounded bg-gray-600 p-2 font-mono text-white" | ||
readOnly | ||
value={consoleMessageList} | ||
id="serial_console" | ||
/> | ||
{scriptRunning && ( | ||
<div className="flex w-full flex-row items-center justify-center gap-1"> | ||
<p className="w-full rounded-md bg-blue-700 p-2 font-mono text-white"> | ||
{scriptStatus} | ||
</p> | ||
</div> | ||
)} | ||
<div className="flex w-full flex-row items-center justify-center gap-1"> | ||
<input | ||
type="text" | ||
value={command} | ||
onChange={(e) => setCommand(e.target.value)} | ||
onKeyDown={(e) => { | ||
if (e.key === "Enter") { | ||
e.preventDefault(); | ||
sendCommand(); | ||
} | ||
}} | ||
placeholder="Enter command" | ||
className="w-full rounded-md bg-gray-600 p-2 font-mono text-white" | ||
/> | ||
<button | ||
type="submit" | ||
className="btn btn-success btn-sm size-10 text-white" | ||
onClick={() => { | ||
sendCommand(); | ||
}} | ||
> | ||
<FontAwesomeIcon icon={faPaperPlane} /> | ||
</button> | ||
<button | ||
type="submit" | ||
className="btn btn-error btn-sm size-10 text-white" | ||
onClick={() => { | ||
setConsoleMessageList(""); | ||
}} | ||
> | ||
<FontAwesomeIcon icon={faCircleXmark} /> | ||
</button> | ||
<button | ||
type="button" | ||
className="btn btn-info btn-sm size-10 text-white" | ||
onClick={() => { | ||
scriptFileInputRef.current?.click(); | ||
}} | ||
> | ||
<FontAwesomeIcon icon={faCode} /> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.