diff --git a/app.py b/app.py index 21567e5..51d7035 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ import os from dotenv import load_dotenv -from flask import Flask, render_template, redirect, url_for, request, flash +from flask import Flask, render_template, redirect, url_for, request, flash, send_from_directory from flask_sqlalchemy import SQLAlchemy from flask_login import ( LoginManager, @@ -58,7 +58,11 @@ class MealPlan(db.Model): def load_user(user_id): return User.query.get(int(user_id)) +# PWA service worker +@app.route('/sw.js') +def serve_sw(): + return send_from_directory('static', 'sw.js', mimetype='application/javascript') @app.route("/") def index(): diff --git a/static/icons/192.png b/static/icons/192.png new file mode 100644 index 0000000..b1bbd56 Binary files /dev/null and b/static/icons/192.png differ diff --git a/static/icons/512.png b/static/icons/512.png new file mode 100644 index 0000000..d4eb193 Binary files /dev/null and b/static/icons/512.png differ diff --git a/static/manifest.json b/static/manifest.json new file mode 100644 index 0000000..e961627 --- /dev/null +++ b/static/manifest.json @@ -0,0 +1,20 @@ +{ + "name": "Madplaner AI", + "short_name": "Madplaner", + "start_url": "/", + "display": "standalone", + "background_color": "#ffffff", + "theme_color": "#2c3e50", + "icons": [ + { + "src": "/static/icons/192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/static/icons/512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..35f985d --- /dev/null +++ b/static/sw.js @@ -0,0 +1,20 @@ +// static/sw.js +const CACHE_NAME = 'madplaner-install'; + +self.addEventListener('install', (event) => { + self.skipWaiting(); +}); + +self.addEventListener('activate', (event) => { + // Clear out any old caches from previous versions + event.waitUntil( + caches.keys().then((names) => { + return Promise.all(names.map(name => caches.delete(name))); + }) + ); +}); + +// Network-only fetch: No caching, just live data +self.addEventListener('fetch', (event) => { + event.respondWith(fetch(event.request)); +}); \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 68444ad..62706b9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,7 +6,19 @@ Madplaner - + + + + + + + + {% with messages = get_flashed_messages(with_categories=true) %} diff --git a/templates/index.html b/templates/index.html index fd8e385..c389ee3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,56 +2,50 @@ {% block content %}
- -

Dinner, simplified
by design.

- A minimalist approach to meal planning. Clear out your fridge, reduce waste, and regain your evenings with AI-tailored dinner plans. + A minimalist approach to meal planning. Clear out your fridge, reduce waste, and regain your evenings with + AI-tailored dinner plans.

{% if current_user.is_authenticated %} - - Open Dashboard - - - - + + Open Dashboard + + + + {% else %} - + {% endif %}
-
-
-
- - - +
+
+
+ + + +
+

Purely Personal

+

Custom filters for Keto, Vegan, or family-friendly gourmet needs.

-

Purely Personal

-

- Whether you're Keto, Vegan, want kid-friendly meals or gourmet meals, every recipe is filtered for your unique needs. -

-
+
@@ -59,9 +53,7 @@

Zero Waste

-

- Our "Fridge Clear-out" logic prioritizes what you already have, reducing food waste and grocery bills. -

+

Fridge clear-out logic that prioritizes what you already own.

@@ -71,9 +63,7 @@

Smart Matrix

-

- Instantly visualize how ingredients are reused across your week with our automated usage matrix. -

+

Instantly visualize ingredient reuse across your week.

@@ -83,29 +73,76 @@

Time-Conscious

-

- From 20-minute rapid meals to gourmet weekend dinners, we plan around your schedule. -

+

From 20-minute rapid meals to gourmet weekend dinners.

+
+ - {% endif %} - + {% endif %} +
+ + + {% endblock %} \ No newline at end of file