Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 initialize gui #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions control-station/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions control-station/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write .",
"test": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand All @@ -15,8 +17,8 @@
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.11.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
Expand All @@ -25,5 +27,17 @@
"typescript": "^5.5.3",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
44 changes: 15 additions & 29 deletions control-station/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import "./App.css";
import React from 'react';
import Navbar from "@/components/Navbar/Navbar";
import StatusIndicator from "@/components/StatusIndicator/StatusIndicator";
import ControlPanel from "@/components/ControlPanel/ControlPanel";

function App() {
const [count, setCount] = useState(0);
import './App.css';

function App() {
return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
<div className="App">
<Navbar />
<StatusIndicator status="green" />
<main className="content">
HX10 GUI
</main>
<ControlPanel />
</div>
);
}

export default App;
export default App;
24 changes: 24 additions & 0 deletions control-station/src/components/ControlPanel/ControlPanel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.status-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-around;
padding: 10px;
background-color: gray;
}

.status-button {
margin: 10px 20px;
border: none;
border-radius: 5px;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
}

.run { background-color: #4CAF50; color: white; }
.stop { background-color: #F44336; color: white; }
.halt { background-color: #FFA500; color: white; }
.load { background-color: #FFD700; color: white; }
15 changes: 15 additions & 0 deletions control-station/src/components/ControlPanel/ControlPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import './ControlPanel.css';

function ControlPanel() {
return (
<footer className="status-bar">
<button className="status-button run">Run</button>
<button className="status-button stop">Stop</button>
<button className="status-button halt">Halt</button>
<button className="status-button load">Load</button>
</footer>
);
}

export default ControlPanel;
14 changes: 14 additions & 0 deletions control-station/src/components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;

font-size: 1.5rem;
background-color: grey;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: normal;
}
14 changes: 14 additions & 0 deletions control-station/src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import HX from "../../images/HX_Logo.svg";

import "./Navbar.css";

function Navbar() {
return (
<header className="navbar">
<img alt="HX logo" src={HX} style={{ height: "1.5rem" }} />
HyperXite
</header>
);
}

export default Navbar;
56 changes: 56 additions & 0 deletions control-station/src/components/StatusIndicator/StatusIndicator.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.status-indicator-container {
position: fixed;
left: 10px;
top: 50%;
transform: translateY(-50%);
width: 5rem;
height: 20rem;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
background-color: gray;
padding: 1rem 0;
border-radius: 1rem;
}

.status-label {
font-size: 1rem;
font-weight: bold;
color: white;
margin-bottom: 1rem;
}

.status-circles {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
height: 80%; /* 80% of the container height */
width: 100%;
}

.status-circle {
width: 50%;
height: 16%;
border-radius: 50%;
border: 2px solid #333;
opacity: 0.3;
transition: opacity 0.3s ease;
}

.status-circle.red {
background-color: #F44336;
}

.status-circle.yellow {
background-color: #FFA500;
}

.status-circle.green {
background-color: #4CAF50;
}

.status-circle.active {
opacity: 1;
}
23 changes: 23 additions & 0 deletions control-station/src/components/StatusIndicator/StatusIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import './StatusIndicator.css';

type StatusType = 'green' | 'yellow' | 'red';

interface StatusIndicatorProps {
status: StatusType;
}

function StatusIndicator({ status }: StatusIndicatorProps) {
return (
<div className="status-indicator-container">
<div className="status-label">Status</div>
<div className="status-circles">
<div className={`status-circle green ${status === 'green' ? 'active' : ''}`}></div>
<div className={`status-circle yellow ${status === 'yellow' ? 'active' : ''}`}></div>
<div className={`status-circle red ${status === 'red' ? 'active' : ''}`}></div>
</div>
</div>
);
}

export default StatusIndicator;
6 changes: 6 additions & 0 deletions control-station/src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module "*.svg" {
import React = require("react");
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}
7 changes: 7 additions & 0 deletions control-station/src/images/HX_Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 0 additions & 24 deletions control-station/tsconfig.app.json

This file was deleted.

32 changes: 28 additions & 4 deletions control-station/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
"compilerOptions": {
"target": "ES2020",
"baseUrl": "src",
"paths": {
"@/*": ["*"]
},
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [
{ "path": "./tsconfig.node.json" }
]
}
}
30 changes: 9 additions & 21 deletions control-station/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
Loading