From 0879a66cb2ecef8e1bde9c26bf4fe1a1aa61cbd7 Mon Sep 17 00:00:00 2001 From: Till Tomczak Date: Thu, 29 May 2025 17:56:52 +0200 Subject: [PATCH] "feat: Integrate custom icons in admin templates" --- backend/app/static/icons/generate_icons.py | 75 ++++++++++ backend/app/static/manifest.json | 73 +++++++--- .../app/templates/admin_guest_requests.html | 134 +++++++++--------- 3 files changed, 194 insertions(+), 88 deletions(-) create mode 100644 backend/app/static/icons/generate_icons.py diff --git a/backend/app/static/icons/generate_icons.py b/backend/app/static/icons/generate_icons.py new file mode 100644 index 00000000..9994a47b --- /dev/null +++ b/backend/app/static/icons/generate_icons.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +""" +Icon-Generator für Mercedes-Benz MYP Platform +Generiert PWA-Icons in verschiedenen Größen +""" + +import os +from PIL import Image, ImageDraw, ImageFont + +def create_mercedes_icon(size, output_path): + """ + Erstellt ein einfaches Mercedes-Benz-Logo-Icon + + Args: + size: Größe des Icons (quadratisch) + output_path: Ausgabepfad für das Icon + """ + # Erstelle ein schwarzes quadratisches Bild + img = Image.new('RGB', (size, size), color='#000000') + draw = ImageDraw.Draw(img) + + # Berechne Kreis-Dimensionen + center = size // 2 + radius = int(size * 0.4) # 80% der Größe für den äußeren Kreis + + # Äußerer weißer Kreis + draw.ellipse([center - radius, center - radius, center + radius, center + radius], + outline='#FFFFFF', width=max(2, size // 50)) + + # Mercedes-Stern (vereinfacht) + star_radius = int(radius * 0.7) + + # Drei Linien für den Mercedes-Stern + # Linie nach oben + draw.line([center, center, center, center - star_radius], + fill='#FFFFFF', width=max(2, size // 40)) + + # Linie nach rechts unten (60°) + import math + angle1 = math.radians(60) + x1 = center + int(star_radius * math.sin(angle1)) + y1 = center + int(star_radius * math.cos(angle1)) + draw.line([center, center, x1, y1], + fill='#FFFFFF', width=max(2, size // 40)) + + # Linie nach links unten (120°) + angle2 = math.radians(120) + x2 = center + int(star_radius * math.sin(angle2)) + y2 = center + int(star_radius * math.cos(angle2)) + draw.line([center, center, x2, y2], + fill='#FFFFFF', width=max(2, size // 40)) + + # Speichere das Bild + img.save(output_path, 'PNG', optimize=True) + print(f"✅ Icon erstellt: {output_path} ({size}x{size})") + +def main(): + """Generiert alle benötigten Icon-Größen""" + sizes = [72, 96, 128, 144, 152, 192, 384, 512] + + # Stelle sicher, dass das Verzeichnis existiert + os.makedirs('static/icons', exist_ok=True) + + for size in sizes: + output_path = f'icon-{size}x{size}.png' + try: + create_mercedes_icon(size, output_path) + except Exception as e: + print(f"❌ Fehler beim Erstellen von {output_path}: {str(e)}") + + print("\n🎯 Alle Icons wurden erfolgreich generiert!") + print("📁 Verzeichnis: static/icons/") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/backend/app/static/manifest.json b/backend/app/static/manifest.json index a2ac5526..c86af0a5 100644 --- a/backend/app/static/manifest.json +++ b/backend/app/static/manifest.json @@ -1,48 +1,79 @@ { "name": "Mercedes-Benz MYP Platform", - "short_name": "MYP", - "description": "3D-Druck Management System", + "short_name": "MYP Platform", + "description": "Mercedes-Benz 3D-Druck Management System", "start_url": "/", "display": "standalone", - "background_color": "#0f172a", - "theme_color": "#0f172a", + "background_color": "#000000", + "theme_color": "#000000", "orientation": "portrait-primary", "scope": "/", "lang": "de", "categories": ["productivity", "business"], "icons": [ { - "src": "icons/mercedes-logo.svg", - "sizes": "192x192", - "type": "image/svg+xml" + "src": "/static/icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "any maskable" }, { - "src": "icons/mercedes-logo.svg", - "sizes": "512x512", - "type": "image/svg+xml" + "src": "/static/icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "any maskable" }, { - "src": "icons/icon-144x144.png", + "src": "/static/icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png", - "purpose": "maskable any" + "purpose": "any maskable" + }, + { + "src": "/static/icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any maskable" } ], "shortcuts": [ { "name": "Dashboard", + "short_name": "Dashboard", + "description": "Öffne das Haupt-Dashboard", "url": "/dashboard", - "description": "Übersicht anzeigen" + "icons": [{ "src": "/static/icons/icon-96x96.png", "sizes": "96x96" }] }, { - "name": "Drucker", - "url": "/printers", - "description": "Drucker verwalten" - }, - { - "name": "Druckaufträge", - "url": "/jobs", - "description": "Druckaufträge verwalten" + "name": "Neue Anfrage", + "short_name": "Neue Anfrage", + "description": "Erstelle eine neue Gastanfrage", + "url": "/guest/request", + "icons": [{ "src": "/static/icons/icon-96x96.png", "sizes": "96x96" }] } ], "screenshots": [], diff --git a/backend/app/templates/admin_guest_requests.html b/backend/app/templates/admin_guest_requests.html index f4112a0f..9b3b998e 100644 --- a/backend/app/templates/admin_guest_requests.html +++ b/backend/app/templates/admin_guest_requests.html @@ -9,11 +9,11 @@ -