From 3a6928a0189bfe8d481c7eeac7a3d3df5dd9cdc0 Mon Sep 17 00:00:00 2001 From: Abdellah El Morabit Date: Sun, 24 Nov 2024 12:41:38 +0100 Subject: updates to the web gui --- templates/api.py | 27 +++++++++++ templates/index.html | 37 ++++++++++++++++ templates/live_preview.py | 14 ++++++ templates/page/notes.html | 24 ++++++++++ templates/page/overview.html | 29 ++++++++++++ templates/page/recourses.html | 29 ++++++++++++ templates/page/speech.html | 29 ++++++++++++ templates/static/main.mjs | 13 ++++++ templates/static/styles.css | 101 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 303 insertions(+) create mode 100644 templates/api.py create mode 100644 templates/index.html create mode 100644 templates/live_preview.py create mode 100644 templates/page/notes.html create mode 100644 templates/page/overview.html create mode 100644 templates/page/recourses.html create mode 100644 templates/page/speech.html create mode 100644 templates/static/main.mjs create mode 100644 templates/static/styles.css (limited to 'templates') diff --git a/templates/api.py b/templates/api.py new file mode 100644 index 0000000..b04ef77 --- /dev/null +++ b/templates/api.py @@ -0,0 +1,27 @@ +from flask import Flask, request, jsonify, render_template + +app = Flask(__name__) + + +@app.route("/") +def index(): + return render_template("index.html") + + +@app.route("/api/run-script", methods=["POST"]) +def run_script(): + data = request.json + if not data: + return jsonify({"error": "No data provided"}), 400 + + script_result = my_script_logic(data.get("input")) + + return jsonify({"result": script_result}) + + +def my_script_logic(input_value): + return f"Processed input: {input_value}" + + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5000, debug=True) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..5436dbd --- /dev/null +++ b/templates/index.html @@ -0,0 +1,37 @@ + + + + + + + CONSOLE + + + + + + + +
+ Resources + Speech Transcriber + Display a Message + General Tools +
+
+

This is the main control center for the I2C deivce. You can find + the main code and information about the project under my GITHUB

+ +
+ + + + + diff --git a/templates/live_preview.py b/templates/live_preview.py new file mode 100644 index 0000000..e753fc6 --- /dev/null +++ b/templates/live_preview.py @@ -0,0 +1,14 @@ +from livereload import Server + +server = Server() +# Watch HTML file +server.watch('index.html') +# Watch CSS files +server.watch('static/styles.css') +# Watch JavaScript files +server.watch('static/main.mjs') +# Watch other files if needed +server.watch('page/*') # Watch everything in the page folder + +# Serve the current directory +server.serve(root='.') diff --git a/templates/page/notes.html b/templates/page/notes.html new file mode 100644 index 0000000..3f24816 --- /dev/null +++ b/templates/page/notes.html @@ -0,0 +1,24 @@ + + + + + + + Display a Message + + + + + + + +
+

Display a Message

+
+ +