diff --git a/backend/__pycache__/main.cpython-313.pyc b/backend/__pycache__/main.cpython-313.pyc index ac9fb77..72a1bb6 100644 Binary files a/backend/__pycache__/main.cpython-313.pyc and b/backend/__pycache__/main.cpython-313.pyc differ diff --git a/backend/apps.yaml b/backend/apps.yaml index d21a950..120f639 100644 --- a/backend/apps.yaml +++ b/backend/apps.yaml @@ -24,3 +24,4 @@ sections: url: https://woodpecker.dvirlabs.com name: Dev-tools + diff --git a/backend/main.py b/backend/main.py index d211f90..51ad3d0 100644 --- a/backend/main.py +++ b/backend/main.py @@ -29,13 +29,16 @@ def get_apps(): with open(APPS_FILE, "r") as f: return yaml.safe_load(f) -class AppEntry(BaseModel): - section: str +class AppData(BaseModel): name: str icon: str description: str url: str +class AppEntry(BaseModel): + section: str + app: AppData + @app.post("/add_app") def add_app(entry: AppEntry): if not APPS_FILE.exists(): @@ -47,22 +50,12 @@ def add_app(entry: AppEntry): # Find or create section for section in current["sections"]: if section["name"] == entry.section: - section["apps"].append({ - "name": entry.name, - "icon": entry.icon, - "description": entry.description, - "url": entry.url, - }) + section["apps"].append(entry.app.dict()) break else: current["sections"].append({ "name": entry.section, - "apps": [{ - "name": entry.name, - "icon": entry.icon, - "description": entry.description, - "url": entry.url, - }] + "apps": [entry.app.dict()] }) with open(APPS_FILE, "w") as f: @@ -70,6 +63,7 @@ def add_app(entry: AppEntry): return {"status": "added"} + if __name__ == "__main__": import uvicorn uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) \ No newline at end of file diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index ec486ef..adc33df 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,19 +1,26 @@ +// src/App.jsx import { useEffect, useState } from 'react'; import './App.css'; import SectionGrid from './components/SectionGrid'; +import ControlPanel from './components/ControlPanel'; function App() { const [sections, setSections] = useState([]); - useEffect(() => { + const fetchSections = () => { fetch('/apps') .then(res => res.json()) .then(data => setSections(data.sections || [])); + }; + + useEffect(() => { + fetchSections(); }, []); return (