fix(repo): shoud be fixed now
This commit is contained in:
parent
ad42500422
commit
84ca283a00
26 changed files with 87 additions and 496 deletions
117
DEVELOPMENT.md
117
DEVELOPMENT.md
|
|
@ -1,117 +0,0 @@
|
||||||
# CodeRED-Astra Development Guide
|
|
||||||
|
|
||||||
## Project Structure
|
|
||||||
|
|
||||||
This is a hackathon-ready project with a clean separation between frontend and backend:
|
|
||||||
|
|
||||||
- **React Frontend** (`web-app/`): Modern React app with Vite and Tailwind CSS
|
|
||||||
- **Rust Engine** (`rust-engine/`): High-performance backend API server
|
|
||||||
- **Database**: MySQL 8.0 with phpMyAdmin for management
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
- Docker & Docker Compose
|
|
||||||
- Node.js 20+ (for local development)
|
|
||||||
- Rust 1.82+ (for local development)
|
|
||||||
|
|
||||||
### Development Setup
|
|
||||||
|
|
||||||
1. **Clone and setup environment**:
|
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
# Edit .env with your database passwords and API keys
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Start the entire stack**:
|
|
||||||
```bash
|
|
||||||
docker-compose up --build
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Access the application**:
|
|
||||||
- Frontend: http://localhost (port 80)
|
|
||||||
- Rust API: http://localhost:8000
|
|
||||||
- phpMyAdmin: http://127.0.0.1:8080
|
|
||||||
|
|
||||||
### Local Development (Recommended for Hackathon)
|
|
||||||
|
|
||||||
**Frontend Development**:
|
|
||||||
```bash
|
|
||||||
cd web-app
|
|
||||||
npm install
|
|
||||||
npm run dev # Starts on http://localhost:5173
|
|
||||||
```
|
|
||||||
|
|
||||||
**Backend Development**:
|
|
||||||
```bash
|
|
||||||
cd rust-engine
|
|
||||||
cargo run # Starts on http://localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
## Team Workflow
|
|
||||||
|
|
||||||
### Frontend Team (React)
|
|
||||||
- Work in `web-app/src/`
|
|
||||||
- Main entry: `src/App.jsx`
|
|
||||||
- Add new components in `src/components/`
|
|
||||||
- API calls go through `/api/*` (auto-proxied to Rust engine)
|
|
||||||
- Use Tailwind CSS for styling
|
|
||||||
- Hot reload enabled with Vite
|
|
||||||
|
|
||||||
### Backend Team (Rust)
|
|
||||||
- Work in `rust-engine/src/`
|
|
||||||
- Main server: `src/main.rs`
|
|
||||||
- Add new modules in `src/`
|
|
||||||
- API endpoints start with `/api/`
|
|
||||||
- Database connection via SQLx
|
|
||||||
- CORS enabled for frontend communication
|
|
||||||
|
|
||||||
## API Communication
|
|
||||||
|
|
||||||
The frontend communicates with the Rust engine via:
|
|
||||||
```javascript
|
|
||||||
// This automatically proxies to http://rust-engine:8000 in Docker
|
|
||||||
// or http://localhost:8000 in local development
|
|
||||||
fetch('/api/health')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => console.log(data));
|
|
||||||
```
|
|
||||||
|
|
||||||
## Database Schema
|
|
||||||
|
|
||||||
Edit `rust-engine/src/main.rs` to add database migrations and models as needed.
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
|
|
||||||
Required in `.env`:
|
|
||||||
```
|
|
||||||
MYSQL_DATABASE=astra
|
|
||||||
MYSQL_USER=astraadmin
|
|
||||||
MYSQL_PASSWORD=your_secure_password
|
|
||||||
MYSQL_ROOT_PASSWORD=your_root_password
|
|
||||||
GEMINI_API_KEY=your_gemini_key
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deployment
|
|
||||||
|
|
||||||
The project is containerized and ready for deployment:
|
|
||||||
- Frontend: Static files served via Vite preview
|
|
||||||
- Backend: Optimized Rust binary
|
|
||||||
- Database: Persistent MySQL data volume
|
|
||||||
|
|
||||||
## Hackathon Tips
|
|
||||||
|
|
||||||
1. **Frontend team**: Start with the existing App.jsx and build your UI components
|
|
||||||
2. **Backend team**: Add new API endpoints in the Rust main.rs file
|
|
||||||
3. **Database**: Use phpMyAdmin at http://127.0.0.1:8080 to manage data
|
|
||||||
4. **Testing**: The app shows connection status between frontend and backend
|
|
||||||
5. **Hot reload**: Both frontend and backend support hot reload during development
|
|
||||||
|
|
||||||
## Common Issues
|
|
||||||
|
|
||||||
- **CORS errors**: Already configured, but check Rust engine CORS settings if needed
|
|
||||||
- **Database connection**: Engine gracefully handles DB offline state for initial development
|
|
||||||
- **Port conflicts**: Web runs on 80, API on 8000, phpMyAdmin on 8080
|
|
||||||
- **Build failures**: Check Node.js and Rust versions match requirements
|
|
||||||
|
|
||||||
Happy hacking! 🚀
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
import js from "@eslint/js";
|
|
||||||
import globals from "globals";
|
|
||||||
import reactHooks from "eslint-plugin-react-hooks";
|
|
||||||
import reactRefresh from "eslint-plugin-react-refresh";
|
|
||||||
import { defineConfig, globalIgnores } from "eslint/config";
|
|
||||||
|
|
||||||
export default defineConfig([
|
|
||||||
globalIgnores(["dist"]),
|
|
||||||
{
|
|
||||||
files: ["**/*.{js,jsx}"],
|
|
||||||
extends: [
|
|
||||||
js.configs.recommended,
|
|
||||||
reactHooks.configs["recommended-latest"],
|
|
||||||
reactRefresh.configs.vite,
|
|
||||||
],
|
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: 2020,
|
|
||||||
globals: globals.browser,
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
ecmaFeatures: { jsx: true },
|
|
||||||
sourceType: "module",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
45
package.json
45
package.json
|
|
@ -1,45 +0,0 @@
|
||||||
{
|
|
||||||
"name": "codered-astra",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"build": "vite build",
|
|
||||||
"dev": "vite",
|
|
||||||
"host": "vite host",
|
|
||||||
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
|
||||||
"clean-dist": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r",
|
|
||||||
"clean-all": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r && find . -path ./node_modules -prune -o -name 'node_modules' | xargs rm -rf "
|
|
||||||
},
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"@google/genai": "^1.25.0",
|
|
||||||
"@tailwindcss/postcss": "^4.1.14",
|
|
||||||
"@tailwindcss/vite": "^4.1.14",
|
|
||||||
"@vitejs/plugin-react": "^5.0.4",
|
|
||||||
"bootstrap": "^5.3.8",
|
|
||||||
"bootstrap-icons": "^1.13.1",
|
|
||||||
"cors": "^2.8.5",
|
|
||||||
"dotenv": "^17.2.3",
|
|
||||||
"express": "^5.1.0",
|
|
||||||
"helmet": "^8.1.0",
|
|
||||||
"lucide-react": "^0.546.0",
|
|
||||||
"pg": "^8.16.3",
|
|
||||||
"react": "^19.2.0",
|
|
||||||
"react-bootstrap": "^2.10.10",
|
|
||||||
"react-dom": "^19.2.0",
|
|
||||||
"react-router": "^7.9.4",
|
|
||||||
"react-router-dom": "^7.9.4",
|
|
||||||
"vite-jsconfig-paths": "^2.0.1"
|
|
||||||
},
|
|
||||||
"packageManager": ">=npm@10.9.0",
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "^9.38.0",
|
|
||||||
"eslint-plugin-import": "^2.32.0",
|
|
||||||
"eslint-plugin-react": "^7.37.5",
|
|
||||||
"eslint-plugin-react-hooks": "^7.0.0",
|
|
||||||
"eslint-plugin-react-refresh": "^0.4.24",
|
|
||||||
"nodemon": "^3.1.10",
|
|
||||||
"prettier": "^3.6.2",
|
|
||||||
"tailwindcss": "^4.1.14",
|
|
||||||
"vite": "^7.1.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
@import "tailwindcss/preflight";
|
|
||||||
@import "tailwindcss/utilities";
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--color-primary: 15 40 98;
|
|
||||||
--color-secondary: 79 95 118;
|
|
||||||
--color-accent: 158 54 58;
|
|
||||||
--color-paragraph: 255 255 255;
|
|
||||||
--color-background: 9 31 54;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
background-color: rgb(var(--color-background));
|
|
||||||
color: rgb(var(--color-paragraph));
|
|
||||||
font-family:
|
|
||||||
ui-sans-serif,
|
|
||||||
system-ui,
|
|
||||||
-apple-system,
|
|
||||||
"Segoe UI",
|
|
||||||
Roboto,
|
|
||||||
"Helvetica Neue",
|
|
||||||
Arial;
|
|
||||||
}
|
|
||||||
10
src/main.jsx
10
src/main.jsx
|
|
@ -1,10 +0,0 @@
|
||||||
import { StrictMode } from "react";
|
|
||||||
import { createRoot } from "react-dom/client";
|
|
||||||
import "./index.css";
|
|
||||||
import App from "./app/index.jsx";
|
|
||||||
|
|
||||||
createRoot(document.getElementById("root")).render(
|
|
||||||
<StrictMode>
|
|
||||||
<App />
|
|
||||||
</StrictMode>
|
|
||||||
);
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import { defineConfig } from "vite";
|
|
||||||
import react from "@vitejs/plugin-react";
|
|
||||||
import jsconfigPaths from "vite-jsconfig-paths";
|
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
|
||||||
|
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [tailwindcss(), react(), jsconfigPaths()],
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
src: "/src",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -1,22 +1,15 @@
|
||||||
# web-app/Dockerfile
|
FROM node:23-alpine
|
||||||
FROM node:20-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
COPY . /codered-astra
|
||||||
|
|
||||||
# Copy package files first to leverage Docker's build cache
|
WORKDIR /codered-astra
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# Install dependencies
|
RUN npm i
|
||||||
RUN npm ci --only=production=false
|
|
||||||
|
|
||||||
# Copy the rest of your application code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build the React application
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Expose the port
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Use preview mode for production-like serving
|
RUN npm run format
|
||||||
CMD ["npm", "run", "preview"]
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
CMD ["npm", "run", "host"]
|
||||||
|
|
|
||||||
16
web-app/README.md
Normal file
16
web-app/README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# React + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## React Compiler
|
||||||
|
|
||||||
|
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import js from "@eslint/js";
|
import js from "@eslint/js";
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import reactHooks from "eslint-plugin-react-hooks";
|
|
||||||
import reactRefresh from "eslint-plugin-react-refresh";
|
|
||||||
import { defineConfig, globalIgnores } from "eslint/config";
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "web-app/src"
|
"baseUrl": "./"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"]
|
||||||
"web-app/src"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,45 @@
|
||||||
{
|
{
|
||||||
"name": "codered-astra",
|
"name": "codered-astra",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"dev": "vite",
|
||||||
"host": "vite --host 0.0.0.0 --port 3000",
|
"host": "vite host",
|
||||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||||
"format": "prettier --write \"**/*.{js,jsx,md}\""
|
"clean-dist": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r",
|
||||||
|
"clean-all": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r && find . -path ./node_modules -prune -o -name 'node_modules' | xargs rm -rf "
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/generative-ai": "^0.21.0",
|
"@google/genai": "^1.25.0",
|
||||||
"axios": "^1.7.7",
|
"@tailwindcss/postcss": "^4.1.14",
|
||||||
|
"@tailwindcss/vite": "^4.1.14",
|
||||||
|
"@vitejs/plugin-react": "^5.0.4",
|
||||||
|
"bootstrap": "^5.3.8",
|
||||||
|
"bootstrap-icons": "^1.13.1",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^17.2.3",
|
||||||
|
"express": "^5.1.0",
|
||||||
|
"helmet": "^8.1.0",
|
||||||
"lucide-react": "^0.546.0",
|
"lucide-react": "^0.546.0",
|
||||||
"react": "^18.3.1",
|
"pg": "^8.16.3",
|
||||||
"react-dom": "^18.3.1",
|
"react": "^19.2.0",
|
||||||
"react-router-dom": "^6.28.0"
|
"react-bootstrap": "^2.10.10",
|
||||||
},
|
"react-dom": "^19.2.0",
|
||||||
"devDependencies": {
|
"react-router": "^7.9.4",
|
||||||
"@types/react": "^18.3.12",
|
"react-router-dom": "^7.9.4",
|
||||||
"@types/react-dom": "^18.3.1",
|
|
||||||
"@vitejs/plugin-react": "^4.3.3",
|
|
||||||
"autoprefixer": "^10.4.20",
|
|
||||||
"eslint": "^9.14.0",
|
|
||||||
"eslint-plugin-react": "^7.37.2",
|
|
||||||
"eslint-plugin-react-hooks": "^5.0.0",
|
|
||||||
"eslint-plugin-react-refresh": "^0.4.14",
|
|
||||||
"postcss": "^8.4.47",
|
|
||||||
"prettier": "^3.3.3",
|
|
||||||
"tailwindcss": "^3.4.14",
|
|
||||||
"vite": "^5.4.10",
|
|
||||||
"vite-jsconfig-paths": "^2.0.1"
|
"vite-jsconfig-paths": "^2.0.1"
|
||||||
|
},
|
||||||
|
"packageManager": ">=npm@10.9.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^9.38.0",
|
||||||
|
"eslint-plugin-import": "^2.32.0",
|
||||||
|
"eslint-plugin-react": "^7.37.5",
|
||||||
|
"eslint-plugin-react-hooks": "^7.0.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.24",
|
||||||
|
"nodemon": "^3.1.10",
|
||||||
|
"prettier": "^3.6.2",
|
||||||
|
"tailwindcss": "^4.1.14",
|
||||||
|
"vite": "^7.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
export default {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,137 +0,0 @@
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
import { Cpu, Database, Zap, Activity } from "lucide-react";
|
|
||||||
|
|
||||||
function App() {
|
|
||||||
const [engineStatus, setEngineStatus] = useState(null);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
checkEngineHealth();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const checkEngineHealth = async () => {
|
|
||||||
try {
|
|
||||||
const response = await fetch('/api/health');
|
|
||||||
const data = await response.json();
|
|
||||||
setEngineStatus(data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Engine health check failed:', error);
|
|
||||||
setEngineStatus({ success: false, message: 'Engine offline' });
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900 to-violet-900">
|
|
||||||
<div className="container mx-auto px-4 py-8">
|
|
||||||
{/* Header */}
|
|
||||||
<header className="text-center mb-12">
|
|
||||||
<div className="flex items-center justify-center mb-4">
|
|
||||||
<Zap className="h-12 w-12 text-yellow-400 mr-3" />
|
|
||||||
<h1 className="text-4xl font-bold text-white">
|
|
||||||
CodeRED-Astra
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<p className="text-gray-300 text-lg">
|
|
||||||
Hackathon Project - React Frontend + Rust Engine
|
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{/* Status Cards */}
|
|
||||||
<div className="grid md:grid-cols-2 gap-6 mb-8">
|
|
||||||
{/* React App Status */}
|
|
||||||
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
|
||||||
<div className="flex items-center mb-4">
|
|
||||||
<Activity className="h-8 w-8 text-blue-400 mr-3" />
|
|
||||||
<h2 className="text-xl font-semibold text-white">React Frontend</h2>
|
|
||||||
</div>
|
|
||||||
<div className="text-green-400 font-medium">✓ Online</div>
|
|
||||||
<p className="text-gray-300 text-sm mt-2">
|
|
||||||
Vite + React development environment ready
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Rust Engine Status */}
|
|
||||||
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
|
||||||
<div className="flex items-center mb-4">
|
|
||||||
<Cpu className="h-8 w-8 text-orange-400 mr-3" />
|
|
||||||
<h2 className="text-xl font-semibold text-white">Rust Engine</h2>
|
|
||||||
</div>
|
|
||||||
<div className={`font-medium ${loading ? 'text-yellow-400' : engineStatus?.success ? 'text-green-400' : 'text-red-400'}`}>
|
|
||||||
{loading ? '⏳ Checking...' : engineStatus?.success ? '✓ Online' : '✗ Offline'}
|
|
||||||
</div>
|
|
||||||
<p className="text-gray-300 text-sm mt-2">
|
|
||||||
{loading ? 'Connecting to engine...' :
|
|
||||||
engineStatus?.success ? 'Engine responding normally' :
|
|
||||||
'Engine may still be starting up'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Engine Details */}
|
|
||||||
{engineStatus?.success && (
|
|
||||||
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20 mb-8">
|
|
||||||
<div className="flex items-center mb-4">
|
|
||||||
<Database className="h-6 w-6 text-purple-400 mr-3" />
|
|
||||||
<h3 className="text-lg font-semibold text-white">Engine Status</h3>
|
|
||||||
</div>
|
|
||||||
<div className="grid md:grid-cols-2 gap-4 text-sm">
|
|
||||||
<div>
|
|
||||||
<span className="text-gray-400">Status:</span>
|
|
||||||
<span className="text-white ml-2">{engineStatus.data?.status}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span className="text-gray-400">Last Check:</span>
|
|
||||||
<span className="text-white ml-2">
|
|
||||||
{engineStatus.data?.timestamp ? new Date(engineStatus.data.timestamp).toLocaleTimeString() : 'N/A'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{engineStatus.message && (
|
|
||||||
<div className="mt-3 p-3 bg-yellow-500/20 border border-yellow-500/30 rounded">
|
|
||||||
<span className="text-yellow-200 text-sm">{engineStatus.message}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Quick Actions */}
|
|
||||||
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
|
||||||
<h3 className="text-lg font-semibold text-white mb-4">Quick Actions</h3>
|
|
||||||
<div className="flex flex-wrap gap-3">
|
|
||||||
<button
|
|
||||||
onClick={checkEngineHealth}
|
|
||||||
className="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"
|
|
||||||
>
|
|
||||||
Refresh Status
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => window.open('/api/health', '_blank')}
|
|
||||||
className="px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors"
|
|
||||||
>
|
|
||||||
Test API Direct
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => alert('Add your hackathon features here!')}
|
|
||||||
className="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors"
|
|
||||||
>
|
|
||||||
Add Feature
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Development Notes */}
|
|
||||||
<div className="mt-8 text-center text-gray-400 text-sm">
|
|
||||||
<p>🚀 Ready for hackathon development!</p>
|
|
||||||
<p className="mt-1">
|
|
||||||
Frontend team: Work in <code className="bg-white/10 px-1 rounded">web-app/src/</code> |
|
|
||||||
Backend team: Work in <code className="bg-white/10 px-1 rounded">rust-engine/src/</code>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ChatLayout from "src/components/ui/ChatLayout";
|
import ChatLayout from "src/components/layouts/chat-layout";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import ChatHeader from "./ChatHeader";
|
import ChatHeader from "src/components/ui/chat/chat-header";
|
||||||
import ChatWindow from "./ChatWindow";
|
import ChatWindow from "src/components/ui/chat/chat-window";
|
||||||
import MessageInput from "./MessageInput";
|
import MessageInput from "src/components/ui/chat/message-input";
|
||||||
|
|
||||||
export default function ChatLayout() {
|
export default function ChatLayout() {
|
||||||
const [messages, setMessages] = useState([
|
const [messages, setMessages] = useState([
|
||||||
|
|
@ -1,33 +1,24 @@
|
||||||
@tailwind base;
|
@import "tailwindcss/preflight";
|
||||||
@tailwind components;
|
@import "tailwindcss/utilities";
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
--color-primary: 15 40 98;
|
||||||
line-height: 1.5;
|
--color-secondary: 79 95 118;
|
||||||
font-weight: 400;
|
--color-accent: 158 54 58;
|
||||||
color-scheme: dark;
|
--color-paragraph: 255 255 255;
|
||||||
color: rgba(255, 255, 255, 0.87);
|
--color-background: 9 31 54;
|
||||||
background-color: #242424;
|
|
||||||
font-synthesis: none;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: flex;
|
background-color: rgb(var(--color-background));
|
||||||
place-items: center;
|
color: rgb(var(--color-paragraph));
|
||||||
min-width: 320px;
|
font-family:
|
||||||
min-height: 100vh;
|
ui-sans-serif,
|
||||||
}
|
system-ui,
|
||||||
|
-apple-system,
|
||||||
#root {
|
"Segoe UI",
|
||||||
width: 100%;
|
Roboto,
|
||||||
margin: 0;
|
"Helvetica Neue",
|
||||||
}
|
Arial;
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
content: ["./src/**/*.{js,ts,jsx,tsx}"],
|
|
||||||
theme: {
|
|
||||||
extend: {
|
|
||||||
colors: {
|
|
||||||
background: "rgba(var(--background))",
|
|
||||||
paragraph: "rgba(var(--paragraph))",
|
|
||||||
primary: "rgba(var(--primary))",
|
|
||||||
secondary: "rgba(var(--secondary))",
|
|
||||||
accent: "rgba(var(--accent))",
|
|
||||||
},
|
|
||||||
flex: {
|
|
||||||
0: "0 0 100%",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
};
|
|
||||||
|
|
@ -1,26 +1,14 @@
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import jsconfigPaths from "vite-jsconfig-paths";
|
import jsconfigPaths from "vite-jsconfig-paths";
|
||||||
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), jsconfigPaths()],
|
plugins: [tailwindcss(), react(), jsconfigPaths()],
|
||||||
server: {
|
resolve: {
|
||||||
host: '0.0.0.0',
|
alias: {
|
||||||
port: 3000,
|
src: "/src",
|
||||||
proxy: {
|
},
|
||||||
'/api': {
|
|
||||||
target: process.env.RUST_ENGINE_URL || 'http://localhost:8000',
|
|
||||||
changeOrigin: true,
|
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
preview: {
|
|
||||||
host: '0.0.0.0',
|
|
||||||
port: 3000
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
outDir: 'dist'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue