From 77ceb9e4ac6b251cf4d11b5f2fb2fb22fd1f0eec Mon Sep 17 00:00:00 2001 From: wasif zaman <83107027+Wasif-ZA@users.noreply.github.com> Date: Sat, 24 Jan 2026 17:01:19 +1100 Subject: [PATCH] refactor: normalize arduino firmware naming --- .github/CODEOWNERS | 8 ++ .github/ISSUE_TEMPLATE/bug_report.md | 30 +++++ .github/ISSUE_TEMPLATE/feature_request.md | 26 +++++ .github/pull_request_template.md | 22 ++++ .github/workflows/ci.yml | 35 ++++++ .gitignore | 31 ++++++ .../udp_forward_only/esp32_gateway}/Esp32.ino | 0 .../esp32_gateway_udp_ack}/esp32_udp_ack.ino | 0 {Audrino => Arduino}/esp32_week10_code.ino | 2 +- {Audrino => Arduino}/esp32_week_7_code.ino | 4 +- .../uno/uno_forward_only/uno_forward_only.ino | 0 CONTRIBUTING.md | 43 ++++++++ Docs/ISSUE_TEMPLATE.md | 41 ------- Docs/PULL_REQUEST_TEMPLATE.md | 43 -------- LICENSE | 21 ++++ README.md | 103 +++++++++++++++++- docs/ARCHITECTURE.md | 62 +++++++++++ docs/DECISIONS.md | 21 ++++ docs/PROJECT_OVERVIEW.md | 16 +++ docs/assets/README.md | 10 ++ {Docs => docs}/skeleton_code.md | 0 .../systems-team-notes.md | 0 .../python3 udp_cli.py => scripts/udp_cli.py | 0 ui/.prettierignore | 5 + ui/.prettierrc.json | 6 + ui/eslint.config.mjs | 31 +++--- ui/package.json | 4 +- ui/src/app/globals.css | 5 +- ui/src/app/layout.tsx | 30 ++--- ui/src/app/page.tsx | 2 +- ui/src/components/.gitkeep | 0 ui/src/features/.gitkeep | 0 ui/src/hooks/.gitkeep | 0 ui/src/lib/.gitkeep | 0 ui/src/services/.gitkeep | 0 ui/src/styles/.gitkeep | 0 ui/src/types/.gitkeep | 0 ui/tests/smoke.test.mjs | 6 + 38 files changed, 476 insertions(+), 131 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore rename {Audrino/esp32/esp32_udp_forward_only/Esp32 => Arduino/esp32_gateway/udp_forward_only/esp32_gateway}/Esp32.ino (100%) rename {Audrino/esp32_udp_ack => Arduino/esp32_gateway_udp_ack}/esp32_udp_ack.ino (100%) rename {Audrino => Arduino}/esp32_week10_code.ino (98%) rename {Audrino => Arduino}/esp32_week_7_code.ino (99%) rename {Audrino => Arduino}/uno/uno_forward_only/uno_forward_only.ino (100%) create mode 100644 CONTRIBUTING.md delete mode 100644 Docs/ISSUE_TEMPLATE.md delete mode 100644 Docs/PULL_REQUEST_TEMPLATE.md create mode 100644 LICENSE create mode 100644 docs/ARCHITECTURE.md create mode 100644 docs/DECISIONS.md create mode 100644 docs/PROJECT_OVERVIEW.md create mode 100644 docs/assets/README.md rename {Docs => docs}/skeleton_code.md (100%) rename Docs/proposed docmenatoin.md => docs/systems-team-notes.md (100%) rename Python/python3 udp_cli.py => scripts/udp_cli.py (100%) create mode 100644 ui/.prettierignore create mode 100644 ui/.prettierrc.json create mode 100644 ui/src/components/.gitkeep create mode 100644 ui/src/features/.gitkeep create mode 100644 ui/src/hooks/.gitkeep create mode 100644 ui/src/lib/.gitkeep create mode 100644 ui/src/services/.gitkeep create mode 100644 ui/src/styles/.gitkeep create mode 100644 ui/src/types/.gitkeep create mode 100644 ui/tests/smoke.test.mjs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..38f4089 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,8 @@ +# Default owner for the repository +* @Wasif-ZA + +# UI and documentation ownership +/ui/ @Wasif-ZA +/docs/ @Wasif-ZA +/Arduino/ @Wasif-ZA +/scripts/ @Wasif-ZA diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a79057d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,30 @@ +--- +name: Bug report +about: Report a defect in the bridge UI, API proxy, or firmware integration +--- + +## Description +Provide a clear, concise explanation of the bug. + +## Steps to Reproduce +1. +2. +3. + +## Expected vs. Actual Behavior +- **Expected:** +- **Actual:** + +## Environment +| Component | Details | +| --- | --- | +| UI | Next.js app in `ui/` | +| Firmware | ESP32 / Arduino sketch version | +| Network | Device IP / SSID (no secrets) | +| Browser / OS | | + +## Logs / Screenshots +Include any relevant logs, console output, or images. + +## Proposed Fix (optional) +If you already know the likely root cause or fix direction, note it here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..17cfcfb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: Propose an improvement to the bridge control system +--- + +## Summary +Describe the capability you want to add and why it matters. + +## Problem / Motivation +What pain point does this solve? Who benefits (operators, maintainers, demo audience)? + +## Proposed Approach +- [ ] UI change +- [ ] Firmware change +- [ ] Networking / protocol change +- [ ] Documentation / tooling change + +Outline the key steps or behaviors. + +## Acceptance Criteria +- [ ] Criterion 1 +- [ ] Criterion 2 +- [ ] Criterion 3 + +## Testing Plan +How should this be validated locally (UI, CLI, hardware-in-the-loop)? diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..543010a --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +## Summary +Explain what changed and why. + +## Changes +- [ ] UI (`ui/`) +- [ ] API proxy (`ui/src/app/api/`) +- [ ] Firmware (`Arduino/`) +- [ ] Tooling / docs + +List the most important edits. + +## How to Test +Provide copy/paste commands and manual steps. + +## Screenshots / Demo (if UI) +Attach screenshots or link to demo artifacts. + +## Checklist +- [ ] `npm run lint` (from `ui/`) +- [ ] `npm run test` (from `ui/`) +- [ ] `npm run build` (from `ui/`) +- [ ] Docs updated (README / docs/) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f211aa0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: ["main", "work"] + pull_request: + +jobs: + ui: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ui + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: ui/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Test + run: npm run test + + - name: Build + run: npm run build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13893b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Node / Next.js +node_modules/ +.next/ +out/ +dist/ +build/ +coverage/ + +# caches +.turbo/ +.vercel/ + +# environment files +.env +.env.* +!.env.example + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# OS / editors +.DS_Store +*.pem +*.tsbuildinfo + +# Python +__pycache__/ +*.pyc diff --git a/Audrino/esp32/esp32_udp_forward_only/Esp32/Esp32.ino b/Arduino/esp32_gateway/udp_forward_only/esp32_gateway/Esp32.ino similarity index 100% rename from Audrino/esp32/esp32_udp_forward_only/Esp32/Esp32.ino rename to Arduino/esp32_gateway/udp_forward_only/esp32_gateway/Esp32.ino diff --git a/Audrino/esp32_udp_ack/esp32_udp_ack.ino b/Arduino/esp32_gateway_udp_ack/esp32_udp_ack.ino similarity index 100% rename from Audrino/esp32_udp_ack/esp32_udp_ack.ino rename to Arduino/esp32_gateway_udp_ack/esp32_udp_ack.ino diff --git a/Audrino/esp32_week10_code.ino b/Arduino/esp32_week10_code.ino similarity index 98% rename from Audrino/esp32_week10_code.ino rename to Arduino/esp32_week10_code.ino index bfaa42a..cc6a3df 100644 --- a/Audrino/esp32_week10_code.ino +++ b/Arduino/esp32_week10_code.ino @@ -1,4 +1,4 @@ -// File: esp32_udp_ack.ino +// File: esp32_week10_code.ino #include #include diff --git a/Audrino/esp32_week_7_code.ino b/Arduino/esp32_week_7_code.ino similarity index 99% rename from Audrino/esp32_week_7_code.ino rename to Arduino/esp32_week_7_code.ino index edad611..71246fe 100644 --- a/Audrino/esp32_week_7_code.ino +++ b/Arduino/esp32_week_7_code.ino @@ -1,4 +1,4 @@ -// File: esp32_udp_ack.ino +// File: esp32_week_7_code.ino #include #include @@ -109,4 +109,4 @@ void loop() { udp.endPacket(); Serial.print("Sent: "); Serial.println(response); -} \ No newline at end of file +} diff --git a/Audrino/uno/uno_forward_only/uno_forward_only.ino b/Arduino/uno/uno_forward_only/uno_forward_only.ino similarity index 100% rename from Audrino/uno/uno_forward_only/uno_forward_only.ino rename to Arduino/uno/uno_forward_only/uno_forward_only.ino diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d40c4bf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,43 @@ +# Contributing Guide + +Thanks for contributing to the Bridge Opening Project! + +## 1) Local setup +```bash +cd ui +npm install +cp .env.example .env.local +npm run dev +``` + +## 2) Branch naming +Use short, descriptive branch names: +- `feat/control-status-panel` +- `fix/api-timeout-error` +- `docs/readme-architecture` + +## 3) Commit message format +Keep commits focused and readable: +- `feat: add control panel heartbeat badge` +- `fix: handle missing ESP32_BASE_URL` +- `docs: document bring-up steps` + +## 4) Pull requests +Before opening a PR: +```bash +cd ui +npm run lint +npm run test +npm run build +``` + +Then open a PR with: +- what changed, +- why it changed, +- how it was tested, +- screenshots for UI changes. + +## 5) Expectations +- Keep changes scoped and intentional. +- Prefer deleting dead code over commenting it out. +- Update documentation when behavior or setup changes. diff --git a/Docs/ISSUE_TEMPLATE.md b/Docs/ISSUE_TEMPLATE.md deleted file mode 100644 index b3310d5..0000000 --- a/Docs/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,41 +0,0 @@ - - -### 🏷️ Issue Type -- [ ] πŸ› Bug -- [ ] ✨ Feature / Enhancement -- [ ] πŸ“š Documentation -- [ ] πŸ”§ Task / Chore - -### πŸ“œ Description - - -### βœ… Acceptance Criteria -- [ ] Criterion 1 -- [ ] Criterion 2 -- [ ] Criterion 3 - -### πŸ”„ Reproduction Steps *(bugs only)* -1. … -2. … -3. … - -### πŸ–₯️ Environment *(bugs only)* -| Component | Version / Details | -|-----------|-------------------| -| Hardware | ESP32, L298N, etc.| -| Firmware | v1.0.0 | -| Java | 21 | -| OS / Pi | Raspbian 12 | - -### πŸ’‘ Proposed Solution *(features/tasks)* - - -### πŸ“Έ Screenshots / Logs - - -### πŸ‘₯ Assignees & Reviewers -- **Assignee:** @ -- **Reviewer:** @ diff --git a/Docs/PULL_REQUEST_TEMPLATE.md b/Docs/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 82e1528..0000000 --- a/Docs/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,43 +0,0 @@ - - -### πŸ“œ Summary - - -### βœ… Checklist -- [ ] I ran `./gradlew test` (or `mvn test`) and **all tests pass** -- [ ] Code follows existing **style / naming conventions** -- [ ] I updated **documentation / comments** where necessary -- [ ] I added or modified **unit / integration tests** -- [ ] Linked issue number included in title or description (e.g., `Fix #12`) - -### πŸ”§ Changes -| Type | Description | -|------|-------------| -| ✨ Feature | | -| πŸ› Fix | | -| πŸ“ Docs | | -| ♻️ Refactor| | - -### πŸ”— Linked Issues - - -### πŸ§ͺ Testing & Verification -Steps to reproduce / test locally - -Expected outcome - -Screenshots or log snippets (if UI / hardware) - -php-template -Copy -Edit - -### πŸ“Έ Screenshots / Gifs (optional) - - -### πŸ‘₯ Reviewers - -@username1 @username2 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3b35559 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Wasif-ZA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 5c0380f..2b14222 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,102 @@ -This is a readme doc +# Bridge Opening Project +A portfolio-ready, full-stack IoT demonstration that controls a model opening bridge via a Next.js operator console and embedded firmware. -Rough UML diagram: +## Problem / Why +Opening bridges require coordination between traffic safety, operator intent, and mechanical actuation. This project demonstrates a clear, testable control chain that: +- provides a professional operator interface, +- enforces safety-minded interlocks at the UI layer, and +- integrates cleanly with ESP32 and Arduino firmware. -ENGG3000 drawio +It is designed for engineering reviewers, recruiters, and teammates who want to understand both the product and the system design quickly. + +## What it does (Features) +- Operator-friendly overview page that explains the system and bring-up steps. +- Dedicated control panel with manual vs. auto modes. +- Command logging with round-trip timing feedback. +- Connectivity heartbeat to surface online/offline state. +- API proxy that hides device URLs from the browser. +- Structured error responses for missing configuration and upstream failures. +- Embedded firmware folders for gateway and actuator roles. +- Lightweight UDP CLI for hardware diagnostics. + +## Tech Stack +- **Frontend:** Next.js 15 (App Router), React 19, TypeScript +- **Backend / API layer:** Next.js Route Handlers (`/api/cmd` proxy) +- **Device / firmware:** ESP32 gateway + Arduino actuator sketches +- **Tooling:** ESLint (flat config), Node test runner, GitHub Actions CI + +## Architecture Overview +![Architecture diagram placeholder](docs/assets/architecture-placeholder.png) + +At a high level, the operator UI sends commands to a Next.js route handler, which validates input, applies timeouts, and forwards commands to the ESP32 gateway. The ESP32 then communicates with the Arduino actuator layer. A CLI in `scripts/udp_cli.py` provides a backup diagnostic path during bring-up. See `/docs/ARCHITECTURE.md` for more detail. + +Key modules/services: +- `ui/src/app/` β€” operator UI routes +- `ui/src/app/api/cmd/route.ts` β€” device proxy and error handling +- `Arduino/` β€” ESP32 and Arduino sketches +- `scripts/udp_cli.py` β€” network diagnostics tool + +## How to Run Locally +### Prereqs +- Node.js 20+ +- npm 10+ +- (Optional) ESP32 device reachable on your network + +### Install +```bash +cd ui +npm install +``` + +### Run +```bash +cd ui +cp .env.example .env.local +npm run dev +``` +Then open `http://localhost:3000`. + +### Build / Test commands +```bash +cd ui +npm run lint +npm run test +npm run build +``` + +## Configuration +Copy the example environment file and update it for your device: + +```bash +cd ui +cp .env.example .env.local +``` + +Required variables: +- `ESP32_BASE_URL` β€” Base URL of the ESP32 gateway (for example, `http://192.168.4.1`). + +## Screenshots / Demo +Screenshots are documented but not committed as binaries in this environment. See `docs/assets/README.md` for capture steps and expected filenames. + +- `docs/assets/screenshot-home.png` +- `docs/assets/screenshot-feature.png` + +## Key Decisions (Engineering) +- Use a Next.js route handler as a proxy to keep device URLs out of the browser. +- Apply explicit request timeouts to avoid hanging the operator UI. +- Keep command codes numeric to align with embedded constraints. +- Gate bridge motion behind manual mode to communicate safety intent clearly. +- Provide a CLI fallback for hardware diagnostics when the UI is unavailable. + +## Roadmap / Next Improvements +- Add hardware-in-the-loop test notes and simulated device responses. +- Extract shared command definitions into a single typed module. +- Add status polling endpoints for richer, live telemetry. +- Record a short demo GIF that shows a full open/close cycle. + +## License +This project is available under the MIT License. See `LICENSE` for details. + +## Contact +- GitHub: [@Wasif-ZA](https://github.com/Wasif-ZA) +- LinkedIn: Add your profile link here diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..9bbb85e --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,62 @@ +# Architecture Overview + +This project demonstrates an end-to-end bridge opening control system that spans a web UI, an API proxy, and embedded firmware. + +```text +[Operator] + β”‚ + β–Ό +Next.js UI (`ui/src/app`) + β”‚ POST /api/cmd + β–Ό +API Proxy (`ui/src/app/api/cmd/route.ts`) + β”‚ POST { op } + β–Ό +ESP32 Gateway (`Arduino/esp32_gateway*`) + β”‚ serial / control frames + β–Ό +Arduino Actuator (`Arduino/uno`) +``` + +## Major Components + +### 1) Operator UI (Next.js) +- Location: `ui/src/app/` +- Purpose: Provide an HMI-style interface for bridge status and operator commands. +- Key routes: + - `/` – system overview and bring-up steps + - `/control` – control panel with command logging and safety interlocks + +### 2) API Proxy (Next.js Route Handler) +- Location: `ui/src/app/api/cmd/route.ts` +- Purpose: Keep device URLs out of the browser and centralize timeout + error handling. +- Behavior: + - Validates `op` + - Reads `ESP32_BASE_URL` from environment + - Forwards the command to `${ESP32_BASE_URL}/cmd` + - Returns structured JSON responses for UI consumption + +### 3) ESP32 Gateway Firmware +- Location: `Arduino/esp32_gateway`, `Arduino/esp32_gateway_udp_ack` +- Purpose: Accept network commands and translate them into actuator-friendly signals. + +### 4) Arduino Actuator Firmware +- Location: `Arduino/uno` +- Purpose: Own the lowest-level motor/servo control and safety logic. + +### 5) Local Tooling / Diagnostics +- Location: `scripts/udp_cli.py` +- Purpose: Provide a quick CLI to validate UDP connectivity and command responses during bring-up. + +## Data Flow Notes + +1. Operators interact with the Next.js UI. +2. The UI calls `/api/cmd` with a numeric command code. +3. The API proxy validates and forwards to the ESP32 gateway. +4. The ESP32 relays the command to the Arduino actuator layer. +5. Responses are surfaced back to the UI and recorded in the command log. + +## Integration Points +- **Environment variable:** `ESP32_BASE_URL` (required for API proxy). +- **Network:** UI runtime must be able to reach the ESP32 over the configured IP. +- **Firmware alignment:** Numeric command codes must stay aligned between UI and firmware. diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md new file mode 100644 index 0000000..34c10a1 --- /dev/null +++ b/docs/DECISIONS.md @@ -0,0 +1,21 @@ +# Engineering Decisions Log + +## 1) Use a Next.js route handler as the device proxy +- **Decision:** Device communication goes through `ui/src/app/api/cmd/route.ts`. +- **Why:** Keeps device IPs out of the browser, centralizes timeouts, and provides consistent error responses. +- **Trade-off:** Adds an extra hop, but the benefits in safety and observability outweigh the minor latency. + +## 2) Keep command codes numeric and shared across layers +- **Decision:** The UI uses numeric codes (`0-9`) that map directly to firmware behavior. +- **Why:** Numeric codes are easy to parse on microcontrollers and reduce payload size. +- **Trade-off:** Requires careful documentation and alignment across the UI and firmware repositories. + +## 3) Favor explicit safety interlocks in the UI +- **Decision:** Bridge movement actions are gated by manual mode in the UI. +- **Why:** It communicates intent clearly to operators and mirrors how physical interlocks work. +- **Trade-off:** Additional UI state management, but it reduces the chance of accidental commands. + +## 4) Provide a CLI for hardware bring-up +- **Decision:** Maintain a lightweight UDP CLI in `scripts/udp_cli.py`. +- **Why:** It provides a fast diagnostic path when the UI is unavailable or when debugging network issues. +- **Trade-off:** Another tool to maintain, but it is small and high leverage for hardware integration. diff --git a/docs/PROJECT_OVERVIEW.md b/docs/PROJECT_OVERVIEW.md new file mode 100644 index 0000000..8e40b14 --- /dev/null +++ b/docs/PROJECT_OVERVIEW.md @@ -0,0 +1,16 @@ +# Bridge Opening Project β€” Portfolio Overview + +## Elevator Pitch +A full-stack IoT demo that lets an operator control a model opening bridge through a polished web interface, with commands flowing through an API proxy to embedded firmware. + +## What makes this repo "employer-grade" +- Clear separation between UI, API proxy, firmware, and diagnostics tooling. +- Documented architecture and decisions to show engineering reasoning. +- CI that runs lint, tests, and build for the UI. +- Screenshots and bring-up steps that make the project easy to evaluate quickly. + +## Demo Story +1. Start the UI locally. +2. Point `ESP32_BASE_URL` at the gateway. +3. Use `/control` to send commands and verify acknowledgements. +4. Fall back to `scripts/udp_cli.py` for low-level diagnostics if needed. diff --git a/docs/assets/README.md b/docs/assets/README.md new file mode 100644 index 0000000..9adac0f --- /dev/null +++ b/docs/assets/README.md @@ -0,0 +1,10 @@ +# Documentation Assets + +Binary assets are intentionally not committed in this environment. + +To add screenshots locally: +1. Run the UI: `cd ui && npm install && cp .env.example .env.local && npm run dev` +2. Capture images for: + - `screenshot-home.png` + - `screenshot-feature.png` +3. Place them in this folder and keep the README links the same. diff --git a/Docs/skeleton_code.md b/docs/skeleton_code.md similarity index 100% rename from Docs/skeleton_code.md rename to docs/skeleton_code.md diff --git a/Docs/proposed docmenatoin.md b/docs/systems-team-notes.md similarity index 100% rename from Docs/proposed docmenatoin.md rename to docs/systems-team-notes.md diff --git a/Python/python3 udp_cli.py b/scripts/udp_cli.py similarity index 100% rename from Python/python3 udp_cli.py rename to scripts/udp_cli.py diff --git a/ui/.prettierignore b/ui/.prettierignore new file mode 100644 index 0000000..261d3f0 --- /dev/null +++ b/ui/.prettierignore @@ -0,0 +1,5 @@ +.next +node_modules +coverage +dist +build diff --git a/ui/.prettierrc.json b/ui/.prettierrc.json new file mode 100644 index 0000000..9014aaa --- /dev/null +++ b/ui/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "semi": true, + "trailingComma": "all", + "printWidth": 100 +} diff --git a/ui/eslint.config.mjs b/ui/eslint.config.mjs index 719cea2..691e38e 100644 --- a/ui/eslint.config.mjs +++ b/ui/eslint.config.mjs @@ -1,25 +1,22 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __dirname = path.dirname(__filename); -const compat = new FlatCompat({ - baseDirectory: __dirname, -}); +const compat = new FlatCompat({ baseDirectory: __dirname }); -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), +const config = [ { - ignores: [ - "node_modules/**", - ".next/**", - "out/**", - "build/**", - "next-env.d.ts", - ], + ignores: ['.next/**', 'node_modules/**', 'dist/**', 'build/**', 'coverage/**'], + }, + ...compat.extends('next/core-web-vitals'), + { + rules: { + 'no-console': ['warn', { allow: ['warn', 'error'] }], + }, }, ]; -export default eslintConfig; +export default config; diff --git a/ui/package.json b/ui/package.json index f13c999..2fc1dc6 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,7 +6,9 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "eslint" + "lint": "eslint .", + "format": "eslint --fix .", + "test": "node --test tests/*.test.mjs" }, "dependencies": { "react": "19.1.0", diff --git a/ui/src/app/globals.css b/ui/src/app/globals.css index e3aef59..e9d39b2 100644 --- a/ui/src/app/globals.css +++ b/ui/src/app/globals.css @@ -5,6 +5,9 @@ ======================================== */ :root { + --font-geist-sans: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --font-geist-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* Base Colors */ --bg-primary: #0a0e14; --bg-secondary: #0f1419; @@ -145,7 +148,7 @@ body { radial-gradient(ellipse at top, rgba(34, 211, 238, 0.03) 0%, transparent 50%), radial-gradient(ellipse at bottom right, rgba(255, 140, 66, 0.03) 0%, transparent 50%); color: var(--text-primary); - font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; + font-family: var(--font-geist-sans); line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/ui/src/app/layout.tsx b/ui/src/app/layout.tsx index ce7762a..9ad0bde 100644 --- a/ui/src/app/layout.tsx +++ b/ui/src/app/layout.tsx @@ -1,26 +1,16 @@ -import type { Metadata, Viewport } from "next"; -import { Geist, Geist_Mono } from "next/font/google"; -import "./globals.css"; - -const geistSans = Geist({ - variable: "--font-geist-sans", - subsets: ["latin"], -}); - -const geistMono = Geist_Mono({ - variable: "--font-geist-mono", - subsets: ["latin"], -}); +import type { Metadata, Viewport } from 'next'; +import './globals.css'; export const metadata: Metadata = { - title: "Bridge Control Panel | UNO Controller Interface", - description: "Industrial control interface for bridge opening system with ESP32 and Arduino UNO integration. Control bridge mechanisms, boom gates, and monitor sensor readings.", - keywords: ["bridge control", "Arduino", "ESP32", "industrial control", "automation"], - authors: [{ name: "Bridge Opening Project" }], + title: 'Bridge Control Panel | UNO Controller Interface', + description: + 'Industrial control interface for bridge opening system with ESP32 and Arduino UNO integration. Control bridge mechanisms, boom gates, and monitor sensor readings.', + keywords: ['bridge control', 'Arduino', 'ESP32', 'industrial control', 'automation'], + authors: [{ name: 'Bridge Opening Project' }], }; export const viewport: Viewport = { - width: "device-width", + width: 'device-width', initialScale: 1, maximumScale: 1, }; @@ -32,9 +22,7 @@ export default function RootLayout({ }>) { return ( - - {children} - + {children} ); } diff --git a/ui/src/app/page.tsx b/ui/src/app/page.tsx index b901853..41070d8 100644 --- a/ui/src/app/page.tsx +++ b/ui/src/app/page.tsx @@ -461,7 +461,7 @@ export default function DemoPage() { .env.local to the device static IP. - Upload sketch from /Arduino/esp32. Ensure Wi-Fi creds are correct. + Upload sketch from /Arduino/esp32_gateway. Ensure Wi-Fi creds are correct. Flash the logic controller. Connect Tx/Rx pins between boards. diff --git a/ui/src/components/.gitkeep b/ui/src/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/features/.gitkeep b/ui/src/features/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/hooks/.gitkeep b/ui/src/hooks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/lib/.gitkeep b/ui/src/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/services/.gitkeep b/ui/src/services/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/styles/.gitkeep b/ui/src/styles/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/types/.gitkeep b/ui/src/types/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ui/tests/smoke.test.mjs b/ui/tests/smoke.test.mjs new file mode 100644 index 0000000..505d68c --- /dev/null +++ b/ui/tests/smoke.test.mjs @@ -0,0 +1,6 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; + +test('project smoke test', () => { + assert.equal(1 + 1, 2); +});