Compare commits

37 Commits

Author SHA1 Message Date
eb23d638e6 Merge remote-tracking branch 'origin/tills-branch' into tills-branch 2025-04-27 18:16:30 +02:00
750dba2d6f Update requirements.txt: Remove specific version for openai package to allow for flexibility in dependency management. 2025-04-27 18:10:41 +01:00
6aa3780a96 Enhance MindMapVisualization functionality: Implement connection count updates for nodes upon data processing and fallback scenarios. Refactor connected node retrieval methods to improve safety and reliability by ensuring valid node IDs. Introduce a new method for checking links between nodes, enhancing overall robustness of the mind map visualization logic. 2025-04-27 18:16:09 +02:00
8890a62026 Merge remote-tracking branch 'origin/tills-branch' into tills-branch 2025-04-27 17:57:40 +02:00
6cf9b2a627 Update compiled Python files in __pycache__: Refresh app.cpython-313.pyc and models.cpython-313.pyc to reflect recent code changes and optimizations. 2025-04-27 17:14:32 +01:00
4f6aea8e20 Update neural network background animation: Enhance color visibility and node dynamics for improved visual effects. Introduce clustering for node positioning and optimize connection rendering with increased opacity and strength. Remove old database file and update systades.db for better data management. 2025-04-27 17:57:04 +02:00
e5f485d9d7 Update COMMON_ERRORS.md: Add a new entry for common error 'D' and maintain clarity in the documentation of frequent issues and their solutions. 2025-04-27 17:15:54 +02:00
cf3fc09a63 Merge remote-tracking branch 'origin/tills-branch' into tills-branch 2025-04-27 17:15:47 +02:00
10747a8336 Add new database file: Create systades.db to support application data storage and management. 2025-04-27 17:00:27 +01:00
7eb958f3c8 Update app.py and COMMON_ERRORS.md for improved clarity and functionality: Correct the comment in app.py from "Kontext-Prozessor" to "Context-Prozessor" for better understanding. Enhance COMMON_ERRORS.md by adding new common errors and solutions related to TypeScript usage, OAuth implementation, and neural network background animation issues. Update mindmap page scripts to ensure proper global availability of functions and improve error handling for user notifications. Adjust template references for Tailwind CSS and Alpine.js to support both CDN and local versions, ensuring better resource loading and compatibility. 2025-04-27 17:14:48 +02:00
4a3092a4d2 Update OpenAI API key and enhance app functionality: Replace the OpenAI API key in the .env file for improved access. Refactor app.py to include error handling for missing API keys and implement dark mode functionality with session management. Update README.md to reflect the use of Tailwind CSS via CDN and document the Content Security Policy (CSP) adjustments. Enhance mindmap data loading with a new API endpoint for refreshing data, ensuring better user experience during database connection issues. Update styles and templates for improved UI consistency and responsiveness. 2025-04-27 16:56:16 +02:00
2d8cdc052f Refactor chat interface in index.html and main.js: Improve user interaction by optimizing chat message rendering and enhancing initialization logic for the ChatGPT assistant. Update styles for better responsiveness and visual appeal, ensuring seamless integration with existing functionalities. 2025-04-27 15:12:52 +02:00
968515ce2b Overhaul website to modernize design, integrate SVG visualizations, and enhance KI functionality; update documentation for MindMapProjekt. 2025-04-27 15:09:29 +02:00
88f8e98df0 Enhance Neural Network Background Animation: Introduce subtle flowing network aesthetics with improved color schemes and animations. Update canvas handling to ensure proper layering and visibility. Implement new flow animations along connections for a more dynamic visual experience. Adjust node and connection properties for a cleaner, more organic look. Ensure compatibility with dark mode and optimize rendering methods for both WebGL and Canvas. Update styles to maintain transparency across themes. 2025-04-27 12:16:57 +01:00
e5409eef68 Remove unused background scripts and assets: Delete background.js, network-animation.js, network-background.js, and associated media files to streamline the project. Update base.html to reflect changes in script references and ensure proper functionality of the dark mode theme. 2025-04-27 11:51:35 +01:00
013bf76446 Merge branch 'tills-branch' of https://git.clickcandit.com/marwinm/website into tills-branch 2025-04-27 11:15:48 +01:00
808a3c7bbe Update compiled Python files and database: Refresh app and init_db bytecode files, and update mindmap database to reflect recent changes and improvements. 2025-04-27 10:14:44 +01:00
d117978005 Update GPT model to 'gpt-4o-mini' for chat functionality in app.py 2025-04-27 08:03:55 +02:00
48d8463481 Enhance chat interface styling in index.html: Add animations for chat messages and typing indicators, implement smooth scrolling for chat messages, and customize scrollbar appearance. Introduce hover effects for quick query buttons to improve user interaction and visual feedback. 2025-04-27 08:00:53 +02:00
08314ec703 Enhance embedded ChatGPT assistant functionality: Integrate a new chat interface within the index.html template, allowing users to interact with the assistant directly. Update main.js to ensure proper initialization and reference management. Improve user experience with quick query buttons and a responsive chat layout, while maintaining existing functionality in the application. 2025-04-27 08:00:16 +02:00
0bb7d8d0dc Add ChatGPT assistant initialization in main.js: Integrate a new ChatGPTAssistant instance during the MindMap application initialization, ensuring a global reference for enhanced user interaction. This update improves the functionality of the chat feature within the application. 2025-04-27 07:52:23 +02:00
4a28c2c453 Refactor chat_with_assistant function to support messages array input: Enhance the chatbot API by allowing an array of messages for context, extracting system messages, and updating the response format. Maintain backward compatibility with the previous prompt structure while improving error handling for empty inputs. 2025-04-27 07:49:40 +02:00
66d987857a Remove deprecated database management scripts and admin user creation functionality: Delete create_admin.py, fix_db.py, rebuild_db.py, and test_db.py to streamline the project structure and eliminate unused code. Update README.md with installation instructions and management tools for improved user guidance. 2025-04-27 07:46:48 +02:00
d58aba26c2 Refactor OpenAI integration and enhance mindmap UI: Update OpenAI client initialization to use a dedicated class, streamline API key management, and improve loading animations in the mindmap template. Add a modal for adding new thoughts with enhanced user feedback and error handling, while updating the loading overlay for better visual appeal and responsiveness. 2025-04-27 07:43:03 +02:00
8f0a6d4372 Update environment configuration and enhance app functionality: Add detailed comments to the .env file for better clarity, implement a route to reload environment variables dynamically, and ensure the .env file is loaded with force in the app. Remove obsolete build and development scripts to streamline the project structure. Update setup script to create a .env file if it doesn't exist, prompting users to configure necessary values. 2025-04-27 07:28:05 +02:00
5372fe220e Add flash message API and enhance mindmap visualization: Implement a new API endpoint for retrieving flash messages, integrate flash message display in the mindmap visualization, and improve user feedback with dynamic notifications. Update UI elements for better responsiveness and visual appeal, while removing obsolete background image references. 2025-04-27 07:18:32 +02:00
11ab15127c Refactor mindmap visualization and enhance user authentication UI: Implement API calls to load mindmap data dynamically, process hierarchical data into nodes and links, and improve error handling. Update login and registration templates for a modern design with enhanced validation and user experience. Remove obsolete network background images. 2025-04-27 07:08:38 +02:00
0705ecce59 Implement database path configuration and enhance category management: Update database URI to use an absolute path, ensure directory creation for the database, and implement default category creation on initialization. Add new routes for searching thoughts and user account management, while improving the UI with navigation updates for better accessibility. 2025-04-27 07:02:54 +02:00
1c59b0b616 node entfernt 2025-04-27 06:49:59 +02:00
d42c43db50 Enhance footer layout and mindmap functionality: Revamp footer structure with improved grid layout, add social media icons, and implement a newsletter subscription form. Update mindmap template to use SVG background, streamline script loading, and enhance visualization initialization with new event handlers for user interactions. 2025-04-27 06:33:01 +02:00
e46264b201 Fix: network background loading and fallback mechanism: Implement a retry logic for loading the network background image with a maximum of two attempts, first trying the SVG version and then falling back to a JPG if necessary. Add a fallback background drawing function to maintain visual continuity when image loading fails. Update placeholder comment in JPG file to reflect the use of an SVG alternative. 2025-04-27 06:26:10 +02:00
74307ba345 Add user account route and bookmark functionality: Implement '/my-account' route for user bookmarks and personal mindmap, enhance mindmap visualization with bookmark management, and update UI elements for better user experience. 2025-04-26 18:51:53 +01:00
14474c4eab Refactor UI and enhance functionality: Update welcome messages and input placeholders in the chat assistant, implement connection count updates in the mindmap visualization, and change branding from "MindMap" to "Systades" across templates for a cohesive user experience. 2025-04-26 18:40:27 +01:00
4797cc3b72 Optimize network background animation and enhance UI styles: Adjust animation speeds for smoother transitions, implement dark mode support, and improve card and navbar styles with glassmorphism effects. Update HTML structure for better responsiveness and visual appeal. 2025-04-25 23:39:41 +02:00
ab280b55af Update requirements and enhance mindmap UI: Comment out Pillow dependency, add network background script, and implement new styles and animations for improved visual effects in the mindmap template. 2025-04-25 21:30:35 +01:00
84b492d8d2 Update README and enhance application functionality: Add detailed installation instructions, integrate OpenAI GPT for the AI assistant, implement error handling for various HTTP errors, and improve the admin interface with user management features. Refactor mindmap visualization and enhance UI with modern design elements. 2025-04-25 00:30:04 +02:00
b0db3398f2 Erweitere die Anwendung um neue Funktionen: Implementiere eine dauerhafte Sitzung für den Dark Mode, füge Benutzer- und Gedankenbewertung hinzu, verbessere die Benutzeroberfläche und aktualisiere die Datenbankinitialisierung mit Beispielbenutzern und Gedanken. Optimiere die Templates für ein modernes Design und verbessere die Suchfunktionalität. 2025-04-24 18:08:04 +02:00
113 changed files with 20694 additions and 1762 deletions

View File

@@ -0,0 +1,34 @@
---
description:
globs:
alwaysApply: false
---
# KI-Integration
Die Anwendung integriert OpenAI für KI-Funktionalitäten:
## Konfiguration
- [app.py](mdc:app.py): OpenAI-Client-Initialisierung
- [requirements.txt](mdc:requirements.txt): OpenAI SDK als Abhängigkeit
## Endpunkte
- `/api/assistant`: Hauptendpunkt für KI-Anfragen
## Funktionalitäten
- Chatbot-Integration: Benutzer können mit einem KI-Assistenten kommunizieren
- Inhaltsanalyse: KI kann Gedanken und Konzepte analysieren
- Vorschläge: Kontextbezogene Vorschläge basierend auf dem Benutzerkontext
## Implementation
- Verwendet den OpenAI SDK für API-Aufrufe
- Kontextübergabe für konsistente Konversationen
- Streaming-Antworten für bessere Benutzererfahrung
## Konfigurationsparameter
- `OPENAI_API_KEY`: API-Schlüssel (in .env-Datei)
- Das System verwendet vorwiegend das Chat-Completion-API
## Sicherheitsmaßnahmen
- API-Schlüssel werden sicher über Umgebungsvariablen geladen
- Ratenbegrenzung und Fehlerbehandlung für API-Aufrufe
- Eingabevalidierung vor API-Anfragen

View File

@@ -0,0 +1,36 @@
---
description:
globs:
alwaysApply: false
---
# Authentifizierung und Benutzerrollen
Die Anwendung nutzt Flask-Login für das Authentifizierungssystem:
## Hauptkomponenten
- [LoginManager](mdc:app.py): Konfiguration im app.py
- [User Model](mdc:models.py): Die User-Klasse implementiert UserMixin für Flask-Login
- Passwort-Hashing: Verwendet Werkzeug Security für sichere Passwort-Speicherung
## Authentifizierungsrouten
- `/login`: Benutzeranmeldung (GET/POST)
- `/register`: Benutzerregistrierung (GET/POST)
- `/logout`: Benutzerabmeldung
## Benutzerrollen
- Reguläre Benutzer: Grundlegende Funktionen
- Administratoren (`is_admin=True`): Erweiterte Privilegien
## Zugriffskontrollen
- `@login_required`: Decorator für routenspezifischen Authentifizierungsschutz
- `@admin_required`: Benutzerdefinierter Decorator für Admin-Zugriffskontrolle
## Sitzungsverwaltung
- Tracking von Anmeldezeit (`last_login`)
- Langlebige Sitzungen für Präferenzen (z.B. Dark Mode)
- Angepasste Flash-Nachrichten
## Profilmanagement
- `/settings`: Benutzereinstellungen aktualisieren
- Passwortänderung
- Profildetails (Biografie, Avatar, etc.)

View File

@@ -0,0 +1,31 @@
---
description:
globs:
alwaysApply: false
---
# Konfiguration und Umgebungsvariablen
Die Anwendung verwendet Umgebungsvariablen für die Konfiguration:
## Konfigurationsdateien
- [.env](mdc:.env): Haupt-Umgebungsvariablen (nicht in Git)
- [example.env](mdc:example.env): Beispiel-Konfiguration als Vorlage
## Wichtige Konfigurationsparameter
- `SECRET_KEY`: Geheimer Schlüssel für Flask-Sitzungen
- `SQLALCHEMY_DATABASE_URI`: Datenbankverbindung
- `OPENAI_API_KEY`: API-Schlüssel für OpenAI-Integration
## Anwendungsinitialisierung
- [run.py](mdc:run.py): Lädt Umgebungsvariablen und startet die Anwendung
- [app.py](mdc:app.py): Konfiguriert Flask mit den geladenen Umgebungsvariablen
- [init_db.py](mdc:init_db.py): Initialisiert die Datenbank mit Beispieldaten
## Datenbank-Konfiguration
- SQLite-Datenbank im `/database`-Verzeichnis
- Automatische Erstellung der Datenbankstruktur bei Anwendungsstart
- Beispieldaten werden mit `init_database()` erstellt
## Ausführung der Anwendung
- Entwicklungsserver: `python run.py`
- In Produktion: Nutzung von Gunicorn (siehe requirements.txt)

View File

@@ -0,0 +1,31 @@
---
description:
globs:
alwaysApply: false
---
# Datenmodelle
Die Anwendung verwendet SQLAlchemy als ORM mit folgenden Hauptmodellen:
## Benutzer und Authentifizierung
- [User](mdc:models.py): Benutzermodell mit Authentifizierung und Profildaten
## Mind-Mapping und Wissensorganisation
- [Category](mdc:models.py): Wissenschaftliche Kategorien zur Organisation der Mindmap
- [MindMapNode](mdc:models.py): Knoten in der öffentlichen Mindmap
- [UserMindmap](mdc:models.py): Benutzerspezifische Mindmaps
- [UserMindmapNode](mdc:models.py): Speichert Positionen von Knoten in Benutzer-Mindmaps
- [MindmapNote](mdc:models.py): Private Notizen zu Mindmap-Elementen
## Gedanken und Inhalte
- [Thought](mdc:models.py): Gedanken und Konzepte, die in Mindmaps verknüpft werden
- [ThoughtRelation](mdc:models.py): Verknüpfungen zwischen verschiedenen Gedanken
- [ThoughtRating](mdc:models.py): Bewertungen von Gedanken durch Benutzer
- [Comment](mdc:models.py): Kommentare zu Gedanken
## Hauptbeziehungen
- Benutzer → Gedanken: 1-zu-n (Autor)
- Benutzer → MindMaps: 1-zu-n
- Gedanken ↔ MindMapNodes: n-zu-m
- Kategorien → MindMapNodes: 1-zu-n
- Gedanken ↔ Gedanken: über ThoughtRelation (gerichtete Beziehungen)

View File

@@ -0,0 +1,32 @@
---
description:
globs:
alwaysApply: false
---
# Entwicklungs-Workflow
## Grundlegende Entwicklungsschritte
1. Umgebung einrichten: Python 3.11 und Abhängigkeiten installieren
2. `.env`-Datei basierend auf `example.env` erstellen
3. Datenbank initialisieren: `python init_db.py`
4. Entwicklungsserver starten: `python run.py`
## Datenbankentwicklung
- Models in [models.py](mdc:models.py) definieren
- Migrationen bei Schemaänderungen durchführen
- Testdaten über [init_db.py](mdc:init_db.py) bereitstellen
## Anwendungsentwicklung
- Neue Routen in [app.py](mdc:app.py) hinzufügen
- Frontend-Templates in `/templates` erstellen/anpassen
- API-Endpoints für AJAX/Frontend-Integration implementieren
## Testing
- Tests mit pytest schreiben (siehe requirements.txt)
- Flask-Testumgebung für Integrationstest verwenden
## Best Practices
- Immer auf Datenbankmodelle zurückgreifen (kein Raw-SQL)
- API-Endpunkte mit Authentifizierung schützen
- Flash-Nachrichten für Benutzerrückmeldungen verwenden
- Code-Dokumentation in deutscher Sprache halten

View File

@@ -0,0 +1,41 @@
---
description:
globs:
alwaysApply: false
---
# Frontend-Struktur
Die Anwendung verwendet ein Flask-Jinja2-Template-System mit JavaScript-Erweiterungen:
## Template-Struktur
- `/templates`: Hauptverzeichnis für Jinja2-Templates
- `/templates/errors`: Fehlerseiten (404, 500, etc.)
- Layout-Templates für einheitliches Design
## Frontend-Assets
- `/static/css`: CSS-Dateien (mit Tailwind)
- `/static/css/src`: Quell-CSS-Dateien
- `/static/js`: JavaScript-Dateien
- `/static/js/modules`: Modulare JS-Komponenten
- `/static/img`: Bilder und grafische Elemente
## JavaScript-Funktionalität
- API-Integration: Asynchrone Kommunikation mit Backend
- Mindmap-Visualisierung: Interaktive Darstellung von Konzepten
- Benutzeroberflächen-Interaktivität: Drag & Drop, Tooltips, Modals
## CSS-Framework
- Tailwind CSS für responsive Design-Elemente
- TAILWIND CDN verwenden, nicht manuell build!
## Responsive Design
- Mobile-first Ansatz für verschiedene Gerätetypen
- Anpassungsfähiges Layout für verschiedene Bildschirmgrößen
## Zugänglichkeit
- Semantisches HTML für bessere Zugänglichkeit
- ARIA-Attribute für Screenreader-Unterstützung
## Internationalisierung
- Deutsche Benutzeroberfläche als Standard
- Vorbereitet für mehrsprachige Unterstützung

View File

@@ -0,0 +1,27 @@
---
description:
globs:
alwaysApply: false
---
# Projekt-Struktur (Systades)
## Hauptkomponenten
Diese Python-Flask-Webanwendung implementiert ein Mind-Mapping und Gedanken-Management System:
- [app.py](mdc:app.py): Hauptanwendungsdatei mit allen Routen und Endpunkten
- [models.py](mdc:models.py): Datenbankmodelle und Beziehungen
- [run.py](mdc:run.py): Startpunkt der Anwendung
- [init_db.py](mdc:init_db.py): Initialisiert die Datenbank mit Beispieldaten
## Projektstruktur
- `/database`: Enthält SQLite-Datenbank
- `/docs`: Dokumentation
- `/static`: Frontend-Ressourcen (CSS, JS, Bilder)
- `/templates`: Jinja2-Templates für die Webseiten
- `/utils`: Hilfsfunktionen und -klassen
## Hauptfunktionalität
- Mind-Mapping: Visualisierung von Wissen und Beziehungen
- Gedanken-Management: Erfassung und Organisation von Ideen und Konzepten
- Benutzer-Management: Registrierung, Login, Profile
- API-Endpunkte: RESTful-Schnittstellen für Frontend-Integration

43
.cursor/rules/routing.mdc Normal file
View File

@@ -0,0 +1,43 @@
---
description:
globs:
alwaysApply: false
---
# Routing und API-Endpunkte
## Hauptrouten (Webseiten)
- `/`: Startseite
- `/login`, `/register`, `/logout`: Authentifizierung
- `/mindmap`: Öffentliche Mindmap-Ansicht
- `/profile`: Benutzerprofil
- `/settings`: Benutzereinstellungen
- `/search`: Suchfunktion
- `/my_account`: Kontoübersicht
## API-Endpunkte
### Mindmap-Verwaltung
- `/api/mindmap`: Öffentliche Mindmap-Daten abrufen
- `/api/mindmap/public`: Öffentliche Mindmap abrufen
- `/api/mindmap/user/<id>`: Benutzer-Mindmap abrufen
- `/api/mindmap/<id>/add_node`: Knoten hinzufügen
- `/api/mindmap/<id>/remove_node/<node_id>`: Knoten entfernen
- `/api/mindmap/<id>/update_node_position`: Knotenposition aktualisieren
- `/api/mindmap/<id>/notes`: Notizen verwalten
### Gedanken und Inhalte
- `/api/thoughts`: Gedanken erstellen
- `/api/thoughts/<id>`: Gedanken abrufen, aktualisieren, löschen
- `/api/thoughts/<id>/bookmark`: Lesezeichen setzen/entfernen
- `/api/nodes/<id>/thoughts`: Gedanken zu einem Knoten abrufen/hinzufügen
### System und Benutzereinstellungen
- `/api/set_dark_mode`, `/api/get_dark_mode`: Erscheinungsbild-Einstellungen
- `/api/assistant`: KI-Assistent-Kommunikation
- `/api/categories`: Kategorien abrufen
- `/api/get_flash_messages`: Flash-Nachrichten für AJAX-Anfragen
## Fehlerbehandlung
- 404: Page Not Found
- 403: Forbidden
- 500: Internal Server Error
- 429: Too Many Requests

13
.env Normal file
View File

@@ -0,0 +1,13 @@
# MindMap Umgebungsvariablen
# Kopiere diese Datei zu .env und passe die Werte an
# Flask
SECRET_KEY=dein-geheimer-schluessel-hier
# OpenAI API
OPENAI_API_KEY=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
# Datenbank
# Bei Bedarf kann hier eine andere Datenbank-URL angegeben werden
# Der Pfad wird relativ zum Projektverzeichnis angegeben
# SQLALCHEMY_DATABASE_URI=sqlite:////absoluter/pfad/zu/database/systades.db OPENAI_API_KEY=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

173
COMMON_ERRORS.md Normal file
View File

@@ -0,0 +1,173 @@
# ABSOLUTE DON'TS:
- Verwendung von npm anstelle der Tailwind CDN
- Implementierung von Content Security Policy (CSP) - UNTER KEINEN UMSTÄNDEN!
- Implementierung von Cross-Site Request Forgery (CSRF) Schutz
- Implementierung von Security Headers
- Verwendung von TypeScript anstelle von JavaScript
- Implementierung von OAuth oder anderen externen Authentifizierungsmethoden
# HÄUFIGE FEHLER:
- Verwendung der falschen Datenbank (die korrekte ist: database/systades.db)
- Falsche Pfadangaben bei statischen Dateien
- Vergessen der deutschen Spracheinstellungen in Templates
- Nicht beachten der vorhandenen Projektstruktur
- Falsche Einbindung der Neural Network Background Animation
- Verwendung von englischen Variablennamen in deutschen Funktionen
- Vergessen der Mindmap-Datenstruktur gemäß der Roadmap
# Häufige Fehler und Lösungen
D
## Content Security Policy (CSP)
### Problem: Externe Ressourcen werden nicht geladen
**Fehler:** Externe Ressourcen wie CDNs werden nicht korrekt geladen.
**Lösung:**
1. Stellen Sie sicher, dass die URLs in den Templates korrekt sind:
```html
<link href="https://cdn.tailwindcss.com" rel="stylesheet">
```
2. Überprüfen Sie die Netzwerkverbindung und ob die CDN-Domains erreichbar sind.
3. Verwenden Sie lokale Ressourcen als Alternative:
```html
<link href="{{ url_for('static', filename='css/tailwind.min.css') }}" rel="stylesheet">
```
### Problem: CSP-Fehler (script-src-elem 'none', font-src 'none', etc.)
**Fehler:** Skripte werden aufgrund von CSP-Einschränkungen blockiert.
**Lösung:**
1. WICHTIG: CSP-Einschränkungen NICHT implementieren! Diese sind im Projekt unerwünscht.
2. Falls CSP-Header bereits vorhanden sind, entfernen Sie diese aus der Anwendung:
```python
# Entfernen Sie diesen Code, falls vorhanden:
# @app.after_request
# def add_security_headers(response):
# response.headers['Content-Security-Policy'] = '...'
# return response
```
3. Stellen Sie sicher, dass externe Ressourcen direkt geladen werden:
```html
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="{{ url_for('static', filename='js/alpine.min.js') }}" defer></script>
```
4. Für Inline-Skripte keine Nonce verwenden:
```html
<script>
// Inline-JavaScript-Code ohne Einschränkungen
</script>
```
### Problem: Tailwind CSS CDN wird blockiert
**Fehler:** Tailwind CSS kann nicht von CDN geladen werden.
**Lösung:**
1. Verwenden Sie die lokale Version von Tailwind CSS:
```html
<link href="{{ url_for('static', filename='css/tailwind.min.css') }}" rel="stylesheet">
```
2. Alternativ können Sie die CDN-Version direkt im Template einbinden:
```html
<script src="https://cdn.tailwindcss.com"></script>
```
3. Stellen Sie sicher, dass die Datei `static/css/tailwind.min.css` existiert und aktuell ist.
## Datenbank-Fehler
### Problem: Datenbank existiert nicht
**Fehler:** SQLite-Datenbank kann nicht geöffnet werden.
**Lösung:**
1. Datenbank initialisieren: `python TOOLS.py db:rebuild`
2. Sicherstellen, dass das Datenbankverzeichnis existiert und Schreibrechte hat
## Authentifizierung
### Problem: Login funktioniert nicht
**Fehler:** Benutzer kann sich nicht einloggen.
**Lösung:**
1. Standard-Admin-Benutzer erstellen: `python TOOLS.py user:admin`
2. Passwort zurücksetzen: `python TOOLS.py user:reset-pw -u USERNAME -p NEWPASSWORD`
## Neural Network Background
### Problem: Hintergrund-Animation wird nicht angezeigt
**Fehler:** Die Neural Network Animation im Hintergrund erscheint nicht.
**Lösung:**
1. Überprüfen Sie, ob die Datei `static/neural-network-background.js` korrekt eingebunden ist:
```html
<script src="{{ url_for('static', filename='neural-network-background.js') }}"></script>
```
2. Initialisieren Sie die Animation im Template:
```html
<script>
document.addEventListener('DOMContentLoaded', () => {
const background = new NeuralNetworkBackground();
background.initialize();
background.animate();
});
</script>
```
3. Stellen Sie sicher, dass keine CSS-Regeln die Animation überdecken:
```css
#neural-network-background {
z-index: -10;
opacity: 1;
}
```
## Mindmap-Funktionalität
### Problem: Mindmap-Daten werden nicht geladen
**Fehler:** Die dynamische Mindmap zeigt keine Daten an.
**Lösung:**
1. Überprüfen Sie die API-Endpunkte für die Mindmap-Daten:
```python
@app.route('/api/mindmap/nodes', methods=['GET'])
def get_mindmap_nodes():
# Implementierung...
```
2. Stellen Sie sicher, dass die AJAX-Anfragen korrekt implementiert sind:
```javascript
fetch('/api/mindmap/nodes')
.then(response => response.json())
.then(data => {
// Verarbeitung der Mindmap-Daten
});
```
3. Überprüfen Sie die Datenbankeinträge für Mindmap-Knoten und -Verbindungen.
## ChatGPT-Assistent
### Problem: Assistent reagiert nicht auf Eingaben
**Fehler:** Der ChatGPT-Assistent verarbeitet keine Benutzereingaben.
**Lösung:**
1. Überprüfen Sie die Einbindung der JavaScript-Datei:
```html
<script src="{{ url_for('static', filename='js/modules/chatgpt-assistant.js') }}"></script>
```
2. Stellen Sie sicher, dass der Assistent korrekt initialisiert wird:
```javascript
document.addEventListener('DOMContentLoaded', () => {
const assistant = new ChatGPTAssistant();
assistant.initialize();
});
```
3. Überprüfen Sie die API-Endpunkte für die Kommunikation mit dem Assistenten.

View File

@@ -1,10 +0,0 @@
FROM python:3.9-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY website .
CMD ["python", "app.py"]

160
README.md
View File

@@ -1 +1,161 @@
# MindMapProjekt - Roadmap
## Projektübersicht
Das MindMapProjekt ist eine interaktive Plattform zum Visualisieren, Erforschen und Teilen von Wissen. Das Projekt wird umfassend überarbeitet, um ein modernes, benutzerfreundliches Design und erweiterte Funktionalitäten zu bieten.
## Technischer Stack
- **Backend**: Python/Flask
- **Frontend**:
- Tailwind CSS (via CDN) für moderne UI
- SVG-Bibliotheken für Visualisierungen (D3.js)
- JavaScript/Alpine.js für interaktive Komponenten
- **Datenbank**: SQLite mit SQLAlchemy
- **KI-Integration**: OpenAI API für intelligente Assistenz
## Installation und Verwendung
### Installation
1. Repository klonen
2. Virtuelle Umgebung erstellen: `python -m venv venv`
3. Virtuelle Umgebung aktivieren:
- Windows: `venv\Scripts\activate`
- Unix/MacOS: `source venv/bin/activate`
4. Abhängigkeiten installieren: `pip install -r requirements.txt`
5. Datenbank initialisieren: `python TOOLS.py db:rebuild`
6. Admin-Benutzer erstellen: `python TOOLS.py user:admin`
7. Server starten: `python TOOLS.py server:run`
### Standardbenutzer
- **Admin-Benutzer**: Username: `admin` / Passwort: `admin`
- **Testbenutzer**: Username: `user` / Passwort: `user`
### Verwaltungswerkzeuge mit TOOLS.py
Das Projekt enthält ein zentrales Verwaltungsskript `TOOLS.py`, das verschiedene Hilfsfunktionen bietet:
#### Datenbankverwaltung
- `python TOOLS.py db:fix` - Reparieren der Datenbankstruktur
- `python TOOLS.py db:rebuild` - Datenbank neu aufbauen (löscht alle Daten!)
- `python TOOLS.py db:test` - Datenbankverbindung und Modelle testen
- `python TOOLS.py db:stats` - Datenbankstatistiken anzeigen
#### Benutzerverwaltung
- `python TOOLS.py user:list` - Alle Benutzer anzeigen
- `python TOOLS.py user:create -u USERNAME -e EMAIL -p PASSWORD [-a]` - Neuen Benutzer erstellen
- `python TOOLS.py user:admin` - Admin-Benutzer erstellen (admin/admin)
- `python TOOLS.py user:reset-pw -u USERNAME -p NEWPASSWORD` - Benutzerpasswort zurücksetzen
- `python TOOLS.py user:delete -u USERNAME` - Benutzer löschen
#### Serververwaltung
- `python TOOLS.py server:run [--host HOST] [--port PORT] [--no-debug]` - Entwicklungsserver starten
Für detaillierte Hilfe: `python TOOLS.py -h`
## Roadmap der Überarbeitung
### Phase 1: Grundlegende Infrastruktur ✅
- [x] Bestandsaufnahme des aktuellen Projekts
- [x] Erstellung der Roadmap
- [x] Aktualisierung der Abhängigkeiten
- [x] Integration von Tailwind CSS
- [x] Einrichtung der SVG-Bibliotheken (D3.js)
- [x] Favicon erstellen
- [x] Setup-Skript für einfache Installation
### Phase 2: Design-Überarbeitung 🔄
- [x] Implementierung des Dark Mode
- [x] Erstellung eines modernen, minimalistischen UI mit Tech-Ästhetik
- [x] Responsive Design für alle Geräte
- [ ] Gestaltung der Landing Page mit großer Typografie
### Phase 3: Mindmap-Funktionalitäten 🔄
- [x] Verbesserte Visualisierung mit SVG und D3.js
- [x] Implementierung der Mouseover-Funktion
- [x] Entwicklung der Suchfunktion für Knoten
- [ ] Tagging-System für Inhalte
- [ ] Quellenmanagement und -verlinkung
- [ ] Upload-Funktionalität an Knotenpunkten
### Phase 4: Kernseitenentwicklung
- [ ] Überarbeitung der Startseite mit neuen Features
- [ ] Entwicklung der "Wer sind wir?"-Seite
- [ ] Implementierung von Impressum und Datenschutzerklärung
- [ ] Erstellung der Kontaktseite mit FAQs
- [ ] Überarbeitung des Benutzerprofilbereichs
### Phase 5: Community-Features
- [ ] Entwicklung des Autorenbereichs
- [ ] Implementierung von Community-Bereichen für Themenbereiche
- [ ] Verbesserter Kommentarbereich
- [ ] Benutzerrechtemanagement
### Phase 6: KI-Integration
- [ ] Implementierung des Frage-Antwort-Systems
- [ ] KI-generierte Themeneinleitungen
- [ ] Intelligente Suchunterstützung
- [ ] Geführte Pfade durch Themenbereiche
- [ ] Vorgeschlagene Chat-Möglichkeiten
### Phase 7: Benutzerprofilfunktionen
- [ ] Speichern von Thematiken
- [ ] Persönliche Mindmap/Pinboard
- [ ] Beitragsmanagement
- [ ] Benutzerstatistiken und -aktivitäten
### Phase 8: Testing und Optimierung
- [ ] Umfassende Tests aller Funktionen
- [ ] Performance-Optimierung
- [ ] SEO-Implementierung
- [ ] Barrierefreiheit prüfen und verbessern
### Phase 9: Dokumentation und Einführung
- [ ] Erstellung von Benutzeranleitungen
- [ ] Entwicklerdokumentation
- [ ] Administratorenhandbuch
- [ ] Guided Tour für neue Benutzer
## Aktueller Status
- **Phase 1**: ✅ Abgeschlossen
- **Phase 2**: 🔄 In Bearbeitung (75% abgeschlossen)
- **Phase 3**: 🔄 In Bearbeitung (50% abgeschlossen)
## Aktuelle Fortschritte
- Grundlegende UI modernisiert mit Tailwind CSS und Dark Mode
- Neues Favicon für bessere visuelle Identität erstellt
- Setup-Prozess vereinfacht mit einem Shell-Skript
- Mindmap-Visualisierung komplett überarbeitet mit D3.js für eine interaktivere Erfahrung
- Responsive Design für optimale Darstellung auf allen Geräten
## Nächste Schritte
- Fertigstellung der Landing Page
- Erstellung der "Wer sind wir?"-Seite
- Implementierung des Tagging-Systems für Gedanken
- Verbesserung der Gedankenansicht im Mindmap-Bereich
## Content Security Policy (CSP)
Die Anwendung implementiert eine Content Security Policy, um die Sicherheit zu erhöhen und unerwünschte externe Ressourcen zu blockieren. CSP wird in `app.py` konfiguriert und schränkt ein, welche Ressourcen geladen werden dürfen.
### Aktualisierung (06.06.2024)
Die Anwendung verwendet nun die Tailwind CSS CDN für vereinfachte Entwicklung. Die CSP wurde entsprechend angepasst, um die Domain `cdn.tailwindcss.com` zu erlauben.
### Lokale und CDN-Ressourcen
Die Anwendung nutzt eine Mischung aus lokalen Ressourcen und CDNs:
- **CDN-Ressourcen**:
- Tailwind CSS (cdn.tailwindcss.com)
- **Lokale Ressourcen**:
- Alpine.js
- Font Awesome
- Google Fonts (Inter und JetBrains Mono)
### CSP-Nonces
Die Anwendung verwendet Nonces für Inline-Skripte. In den Templates wird `{{ csp_nonce }}` verwendet, um den Nonce-Wert einzufügen:
```html
<script nonce="{{ csp_nonce }}">
// JavaScript Code
</script>
```
*Zuletzt aktualisiert: 06.06.2024*

129
ROADMAP.md Normal file
View File

@@ -0,0 +1,129 @@
# Systades Mindmap - Entwicklungs-Roadmap
Diese Roadmap beschreibt die geplante Entwicklung der dynamischen, benutzerorientierten Mindmap-Funktionalität für das Systades-Projekt.
## Phase 1: Grundlegendes Datenmodell und Backend (Abgeschlossen)
- [x] Entwurf des Datenbankschemas für benutzerorientierte Mindmaps
- [x] Implementierung der Modelle in models.py
- [x] Erstellung der API-Endpunkte für CRUD-Operationen
- [x] Integration mit der bestehenden Benutzerauthentifizierung
- [x] Seed-Daten für die Entwicklung und Tests
## Phase 2: Dynamische Mindmap-Visualisierung (Aktuell)
- [ ] Anpassung des Frontend-Codes zur Verwendung der DB-Daten anstelle des SVG
- [ ] Implementierung von AJAX-Anfragen zum Laden der Mindmap-Daten
- [ ] Dynamisches Rendering der Knoten, Verbindungen und Labels
- [ ] Drag-and-Drop-Funktionalität für die Bewegung von Knoten
- [ ] Zoom- und Pan-Funktionalität mit Persistenz der Ansicht
## Phase 3: Benutzerdefinierte Mindmaps
- [ ] UI für das Erstellen, Bearbeiten und Löschen eigener Mindmaps
- [ ] Funktion zum Hinzufügen/Entfernen von Knoten aus der öffentlichen Mindmap
- [ ] Speichern der Knotenpositionen und Ansichtseinstellungen
- [ ] Benutzerspezifische Visualisierungseinstellungen
- [ ] Dashboard mit Übersicht aller Mindmaps des Benutzers
## Phase 4: Notizen und Annotationen
- [ ] UI für das Hinzufügen privater Notizen zu Knoten
- [ ] Visuelle Anzeige von Notizen in der Mindmap
- [ ] Texteditor mit Markdown-Unterstützung für Notizen
- [ ] Kategorisierung und Farbkodierung von Notizen
- [ ] Suchfunktion für Notizen
## Phase 5: Integrationen und Erweiterungen
- [ ] Import/Export-Funktionalität für Mindmaps (JSON, PNG)
- [ ] Teilen von Mindmaps (öffentlich/privat/mit bestimmten Benutzern)
- [ ] Kollaborative Bearbeitung von Mindmaps
- [ ] Verknüpfung mit externen Ressourcen (Links, Dateien)
- [ ] Versionierung von Mindmaps
## Phase 6: KI-Integration und Analyse
- [ ] KI-gestützte Vorschläge für Verbindungen zwischen Knoten
- [ ] Automatische Kategorisierung von Inhalten
- [ ] Visualisierung von Beziehungsstärken und -typen
- [ ] Mindmap-Statistiken und Analysen
- [ ] KI-basierte Zusammenfassung von Teilbereichen der Mindmap
## Phase 7: Optimierung und Skalierung
- [ ] Performance-Optimierung für große Mindmaps
- [ ] Verbesserung der Benutzerfreundlichkeit basierend auf Feedback
- [ ] Erweiterte Such- und Filterfunktionen
- [ ] Mobile Optimierung
- [ ] Offline-Funktionalität mit Synchronisierung
## Technische Schulden und Refactoring
- [ ] Trennung der Datenbank-Logik vom Flask-App-Code
- [ ] Einführung von Unit-Tests und Integration-Tests
- [ ] Überarbeitung der API-Dokumentation
- [ ] Caching-Strategien für bessere Performance
- [ ] Verbesserte Fehlerbehandlung und Logging
## KI-Integration
### Aktuelle Implementation
- Integration von OpenAI mit dem gpt-4o-mini-Modell für den KI-Assistenten
- Datenbankzugriff für den KI-Assistenten, um direkt Informationen aus der Datenbank abzufragen
- Verbesserte Benutzeroberfläche für den KI-Assistenten mit kontextbezogenen Vorschlägen
### Zukünftige Verbesserungen
- Implementierung von Vektorsuche für präzisere Datenbank-Abfragen durch die KI
- Erweiterung der KI-Funktionalität für tiefere Analyse von Zusammenhängen zwischen Gedanken
- KI-gestützte Vorschläge für neue Verbindungen zwischen Gedanken basierend auf Inhaltsanalyse
- Finetuning des KI-Modells auf die spezifischen Anforderungen der Anwendung
- Erweiterung auf multimodale Fähigkeiten (Bild- und Textanalyse)
---
## Implementierungsdetails
### Datenbankschema
Das Datenbankschema umfasst folgende Hauptentitäten:
1. **Category** - Wissenschaftliche Kategorien für die öffentliche Mindmap
2. **MindMapNode** - Öffentliche Mindmap-Knoten mit Metadaten
3. **UserMindmap** - Benutzerdefinierte Mindmaps
4. **UserMindmapNode** - Verknüpfung zwischen Benutzermindmaps und öffentlichen Knoten
5. **MindmapNote** - Benutzerspezifische Notizen
6. **Thought** - Gedanken und Inhalte, die Knoten zugeordnet sind
7. **ThoughtRelation** - Beziehungen zwischen Gedanken
### Frontend-Technologien
- D3.js für die Visualisierung der Mindmap
- AJAX für dynamisches Laden von Daten
- Interaktive Bedienelemente mit JavaScript
- Responsive Design mit Tailwind CSS
### Backend-APIs
Die implementierten API-Endpunkte umfassen:
- `/api/mindmap/public` - Abrufen der öffentlichen Mindmap-Struktur
- `/api/mindmap/user/<id>` - Abrufen benutzerdefinierter Mindmaps
- `/api/mindmap/<id>/add_node` - Hinzufügen eines Knotens zur Benutzer-Mindmap
- `/api/mindmap/<id>/remove_node/<node_id>` - Entfernen eines Knotens
- `/api/mindmap/<id>/update_node_position` - Aktualisierung von Knotenpositionen
- `/api/mindmap/<id>/notes` - Verwaltung von Notizen
- `/api/nodes/<id>/thoughts` - Abrufen und Hinzufügen von Gedanken zu Knoten
## Aktuelle Änderungen
- Tailwind CSS wurde auf CDN-Version aktualisiert (06.06.2024)
- Content Security Policy (CSP) für Tailwind CSS CDN konfiguriert
## Zukünftige Aufgaben
- Überprüfung der Kompatibilität der Tailwind CSS CDN-Version mit allen UI-Komponenten
- Optimierung der Ladezeiten für mobile Geräte
- Überarbeitung der Dark Mode Funktionalität mit neuer Tailwind Version
## Langfristige Ziele
- Migration zu einer statisch kompilierten Tailwind CSS Version für Produktivumgebungen
- Implementierung von Tailwind Plugins für erweiterte UI-Funktionen

125
TOOLS.py Executable file
View File

@@ -0,0 +1,125 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TOOLS.py - Main utility script for the website application.
This script provides a command-line interface to all utilities
for database management, user management, and server administration.
Usage:
python3 TOOLS.py [command] [options]
Available commands:
- db:fix Fix database schema
- db:rebuild Completely rebuild the database
- db:test Test database connection and models
- db:stats Show database statistics
- user:list List all users
- user:create Create a new user
- user:admin Create admin user (username: admin, password: admin)
- user:reset-pw Reset user password
- user:delete Delete a user
- server:run Run the development server
Examples:
python3 TOOLS.py db:rebuild
python3 TOOLS.py user:admin
python3 TOOLS.py server:run --port 8080
"""
import os
import sys
import argparse
from utils import (
fix_database_schema, rebuild_database, run_all_tests, print_database_stats,
list_users, create_user, reset_password, delete_user, create_admin_user,
run_development_server
)
def parse_args():
parser = argparse.ArgumentParser(
description='Website Administration Tools',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=__doc__
)
# Main command argument
parser.add_argument('command', help='Command to execute')
# Additional arguments
parser.add_argument('--username', '-u', help='Username for user commands')
parser.add_argument('--email', '-e', help='Email for user creation')
parser.add_argument('--password', '-p', help='Password for user creation/reset')
parser.add_argument('--admin', '-a', action='store_true', help='Make user an admin')
parser.add_argument('--host', help='Host for server (default: 127.0.0.1)')
parser.add_argument('--port', type=int, help='Port for server (default: 5000)')
parser.add_argument('--no-debug', action='store_true', help='Disable debug mode for server')
return parser.parse_args()
def main():
args = parse_args()
# Database commands
if args.command == 'db:fix':
fix_database_schema()
elif args.command == 'db:rebuild':
print("WARNING: This will delete all data in the database!")
confirm = input("Are you sure you want to continue? (y/n): ").lower()
if confirm == 'y':
rebuild_database()
else:
print("Aborted.")
elif args.command == 'db:test':
run_all_tests()
elif args.command == 'db:stats':
print_database_stats()
# User commands
elif args.command == 'user:list':
list_users()
elif args.command == 'user:create':
if not args.username or not args.email or not args.password:
print("Error: Username, email, and password are required.")
print("Example: python3 TOOLS.py user:create -u username -e email -p password [-a]")
sys.exit(1)
create_user(args.username, args.email, args.password, args.admin)
elif args.command == 'user:admin':
create_admin_user()
elif args.command == 'user:reset-pw':
if not args.username or not args.password:
print("Error: Username and password are required.")
print("Example: python3 TOOLS.py user:reset-pw -u username -p new_password")
sys.exit(1)
reset_password(args.username, args.password)
elif args.command == 'user:delete':
if not args.username:
print("Error: Username is required.")
print("Example: python3 TOOLS.py user:delete -u username")
sys.exit(1)
delete_user(args.username)
# Server commands
elif args.command == 'server:run':
host = args.host or '127.0.0.1'
port = args.port or 5000
debug = not args.no_debug
run_development_server(host=host, port=port, debug=debug)
else:
print(f"Unknown command: {args.command}")
print("Run 'python3 TOOLS.py -h' for usage information")
sys.exit(1)
if __name__ == '__main__':
main()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1482
app.py Executable file

File diff suppressed because it is too large Load Diff

BIN
database/systades.db Normal file

Binary file not shown.

BIN
database/systades.db.backup Normal file

Binary file not shown.

View File

@@ -1,7 +0,0 @@
version: "3.9"
services:
web:
build: .
ports:
- "5000:5000"
restart: always

69
docs/ANLEITUNG.md Normal file
View File

@@ -0,0 +1,69 @@
# Anleitung: Animierter Netzwerk-Hintergrund
Diese Anleitung erklärt, wie Sie ein Netzwerk-Bild als animierten Hintergrund für die gesamte Website einrichten können.
## Option 1: Manuelle Installation
1. Kopieren Sie das gewünschte Netzwerk-Bild (z.B. `d2efd014-1325-471f-b9a7-90d025eb81d6.png`) in die Datei `website/static/network-bg.jpg`.
Sie können dafür das beiliegende Batch-Skript verwenden:
```
copy-network-image.bat d2efd014-1325-471f-b9a7-90d025eb81d6.png
```
2. Starten Sie den Flask-Server mit dem folgenden Befehl:
```
python start-flask-server.py
```
3. Öffnen Sie die Website unter http://127.0.0.1:5000/
## Anpassung der Animation
Sie können die Animation des Netzwerk-Hintergrunds anpassen, indem Sie die Datei `website/static/network-background.js` bearbeiten. Hier sind die wichtigsten Parameter:
```javascript
let animationSpeed = 0.0005; // Geschwindigkeit der Rotation
let scaleSpeed = 0.0002; // Geschwindigkeit der Skalierung
let opacitySpeed = 0.0003; // Geschwindigkeit der Transparenzänderung
```
## Animation der Mindmap-Verbindungen
Die Verbindungen zwischen den Knoten in der Mindmap werden jetzt mit einer fließenden Animation dargestellt. Diese Animationen verbessern die Sichtbarkeit der Zusammenhänge und machen die Interaktion mit der Karte intuitiver.
### Funktionen:
1. **Animierte Linien**: Die Verbindungslinien zwischen den Knoten bewegen sich in einem fließenden Muster.
2. **Hervorhebung bei Hover**: Beim Überfahren eines Knotens oder einer Verbindung mit der Maus werden diese hervorgehoben.
3. **Kategorien-Beziehungen**: Die visuellen Verbindungen zwischen den Kategorien sind jetzt deutlicher erkennbar.
## Position des Auswahlfelds
Das Auswahlfeld auf der Karte wurde weiter nach links verschoben, sodass es vollständig sichtbar ist, wenn keine Auswahl getroffen wurde. Die Größe wurde ebenfalls angepasst, um die Lesbarkeit zu verbessern.
## Wiederherstellung des ursprünglichen Hintergrunds (optional)
Wenn Sie zum ursprünglichen Sternenhintergrund zurückkehren möchten, müssen Sie folgende Änderungen vornehmen:
1. Bearbeiten Sie die Datei `website/templates/base.html` und ersetzen Sie:
```html
<!-- Network Background Script -->
<script src="{{ url_for('static', filename='network-background.js') }}"></script>
```
mit:
```html
<!-- Three.js für den Sternenhintergrund -->
<script src="{{ url_for('static', filename='three.min.js') }}"></script>
<script src="{{ url_for('static', filename='background.js') }}"></script>
```
2. Bearbeiten Sie die Datei `website/templates/mindmap.html` und entfernen Sie die Zeile:
```html
<script src="{{ url_for('static', filename='network-animation.js') }}"></script>
```
3. Entfernen Sie den CSS-Code für `#mindmap-container::before` und die anderen netzwerkspezifischen Stile aus der Datei `website/templates/mindmap.html`.
4. Starten Sie den Flask-Server neu, um die Änderungen zu übernehmen.

Binary file not shown.

13
example.env Normal file
View File

@@ -0,0 +1,13 @@
# MindMap Umgebungsvariablen
# Kopiere diese Datei zu .env und passe die Werte an
# Flask
SECRET_KEY=dein-geheimer-schluessel-hier
# OpenAI API
OPENAI_API_KEY=sk-dein-openai-api-schluessel-hier
# Datenbank
# Bei Bedarf kann hier eine andere Datenbank-URL angegeben werden
# Der Pfad wird relativ zum Projektverzeichnis angegeben
# SQLALCHEMY_DATABASE_URI=sqlite:////absoluter/pfad/zu/database/systades.db

258
init_db.py Executable file
View File

@@ -0,0 +1,258 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, initialize_database, db_path
from models import db, User, Thought, Comment, MindMapNode, ThoughtRelation, ThoughtRating, RelationType
from models import Category, UserMindmap, UserMindmapNode, MindmapNote
import os
def init_database():
"""Initialisiert die Datenbank mit Beispieldaten."""
with app.app_context():
# Datenbank löschen und neu erstellen
if os.path.exists(db_path):
os.remove(db_path)
# Stellen Sie sicher, dass das Verzeichnis existiert
os.makedirs(os.path.dirname(db_path), exist_ok=True)
db.create_all()
# Admin-Benutzer erstellen
admin = User(username='admin', email='admin@example.com', is_admin=True)
admin.set_password('admin')
db.session.add(admin)
# Beispiel-Benutzer erstellen
user = User(username='user', email='user@example.com')
user.set_password('user')
db.session.add(user)
# Commit, um IDs zu generieren
db.session.commit()
# Wissenschaftliche Kategorien erstellen
science = Category(name='Wissenschaft', description='Wissenschaftliche Erkenntnisse',
color_code='#4CAF50', icon='flask')
db.session.add(science)
philosophy = Category(name='Philosophie', description='Philosophische Theorien und Gedanken',
color_code='#9C27B0', icon='lightbulb')
db.session.add(philosophy)
technology = Category(name='Technologie', description='Technologische Entwicklungen',
color_code='#FF9800', icon='microchip')
db.session.add(technology)
db.session.commit()
# Wissenschaftliche Unterkategorien
physics = Category(name='Physik', description='Studium der Materie und Energie',
color_code='#81C784', icon='atom', parent_id=science.id)
biology = Category(name='Biologie', description='Studium lebender Organismen',
color_code='#66BB6A', icon='leaf', parent_id=science.id)
chemistry = Category(name='Chemie', description='Studium der Stoffe und ihrer Reaktionen',
color_code='#A5D6A7', icon='vial', parent_id=science.id)
db.session.add_all([physics, biology, chemistry])
# Technologie-Unterkategorien
informatics = Category(name='Informatik', description='Studium der Informationsverarbeitung',
color_code='#FFB74D', icon='laptop-code', parent_id=technology.id)
ai = Category(name='Künstliche Intelligenz', description='Entwicklung intelligenter Systeme',
color_code='#FFA726', icon='robot', parent_id=technology.id)
db.session.add_all([informatics, ai])
# Philosophie-Unterkategorien
ethics = Category(name='Ethik', description='Moralphilosophie und Wertesysteme',
color_code='#BA68C8', icon='balance-scale', parent_id=philosophy.id)
logic = Category(name='Logik', description='Studie der gültigen Schlussfolgerungen',
color_code='#AB47BC', icon='project-diagram', parent_id=philosophy.id)
db.session.add_all([ethics, logic])
db.session.commit()
# Knoten für die öffentliche Mindmap erstellen
nodes = {
'quantenmechanik': MindMapNode(
name='Quantenmechanik',
description='Physikalische Theorie zur Beschreibung der Materie auf atomarer Ebene',
color_code='#81C784',
category_id=physics.id,
created_by_id=admin.id
),
'relativitaetstheorie': MindMapNode(
name='Relativitätstheorie',
description='Einsteins Theorien zur Raumzeit und Gravitation',
color_code='#81C784',
category_id=physics.id,
created_by_id=admin.id
),
'genetik': MindMapNode(
name='Genetik',
description='Wissenschaft der Gene und Vererbung',
color_code='#66BB6A',
category_id=biology.id,
created_by_id=admin.id
),
'machine_learning': MindMapNode(
name='Machine Learning',
description='Algorithmen, die aus Daten lernen können',
color_code='#FFA726',
category_id=ai.id,
created_by_id=admin.id
),
'ki_ethik': MindMapNode(
name='KI-Ethik',
description='Moralische Implikationen künstlicher Intelligenz',
color_code='#BA68C8',
category_id=ethics.id,
created_by_id=user.id
)
}
for node in nodes.values():
db.session.add(node)
db.session.commit()
# Verknüpfungen zwischen Knoten herstellen (Hierarchie)
nodes['machine_learning'].parents.append(nodes['ki_ethik'])
db.session.commit()
# Gedanken erstellen
thoughts = [
{
'title': 'Künstliche Intelligenz und Bewusstsein',
'content': 'Die Frage nach maschinellem Bewusstsein ist fundamental für die KI-Ethik. Aktuelle KI-Systeme haben kein Bewusstsein, aber fortschrittliche KI könnte in Zukunft Eigenschaften entwickeln, die diesem nahekommen.',
'abstract': 'Eine Untersuchung der philosophischen Implikationen von KI-Bewusstsein.',
'keywords': 'KI, Bewusstsein, Ethik, Philosophie',
'branch': 'Philosophie',
'color_code': '#BA68C8',
'source_type': 'Markdown',
'user_id': user.id,
'node': nodes['ki_ethik']
},
{
'title': 'Quantenmechanik und Realität',
'content': 'Die Kopenhagener Deutung und ihre Auswirkungen auf unser Verständnis der Realität. Quantenmechanik stellt grundlegende Annahmen über Determinismus und Lokalität in Frage.',
'abstract': 'Eine Analyse verschiedener Interpretationen der Quantenmechanik.',
'keywords': 'Quantenmechanik, Physik, Realität',
'branch': 'Physik',
'color_code': '#81C784',
'source_type': 'PDF',
'user_id': admin.id,
'node': nodes['quantenmechanik']
},
{
'title': 'Deep Learning Fortschritte',
'content': 'Die neuesten Fortschritte im Deep Learning haben zu beeindruckenden Ergebnissen in Bereichen wie Computer Vision, Natural Language Processing und Reinforcement Learning geführt.',
'abstract': 'Überblick über aktuelle Deep Learning-Techniken und ihre Anwendungen.',
'keywords': 'Deep Learning, Neural Networks, AI',
'branch': 'Technologie',
'color_code': '#FFA726',
'source_type': 'Webpage',
'user_id': admin.id,
'node': nodes['machine_learning']
}
]
thought_objects = []
for t_data in thoughts:
node = t_data.pop('node')
thought = Thought(**t_data)
node.thoughts.append(thought)
thought_objects.append(thought)
db.session.add(thought)
db.session.commit()
# Beziehungen zwischen Gedanken
relation = ThoughtRelation(
source_id=thought_objects[0].id,
target_id=thought_objects[2].id,
relation_type=RelationType.INSPIRES,
created_by_id=user.id
)
db.session.add(relation)
# Bewertungen erstellen
rating1 = ThoughtRating(
thought_id=thought_objects[0].id,
user_id=admin.id,
relevance_score=5
)
rating2 = ThoughtRating(
thought_id=thought_objects[2].id,
user_id=user.id,
relevance_score=4
)
db.session.add_all([rating1, rating2])
# Kommentare erstellen
for thought in thought_objects:
comment = Comment(
content=f'Interessante Perspektive zu {thought.title}!',
thought_id=thought.id,
user_id=admin.id if thought.user_id != admin.id else user.id
)
db.session.add(comment)
# Benutzer-Mindmaps erstellen
user_mindmap = UserMindmap(
name='Meine KI-Forschung',
description='Meine persönliche Sammlung zu KI und Ethik',
user_id=user.id
)
db.session.add(user_mindmap)
db.session.commit()
# Knoten zur Benutzer-Mindmap hinzufügen
user_mindmap_nodes = [
UserMindmapNode(
user_mindmap_id=user_mindmap.id,
node_id=nodes['machine_learning'].id,
x_position=200,
y_position=300
),
UserMindmapNode(
user_mindmap_id=user_mindmap.id,
node_id=nodes['ki_ethik'].id,
x_position=500,
y_position=200
)
]
db.session.add_all(user_mindmap_nodes)
# Private Notizen
note = MindmapNote(
user_id=user.id,
mindmap_id=user_mindmap.id,
node_id=nodes['ki_ethik'].id,
content="Recherchiere mehr über aktuelle ethische Richtlinien für KI-Entwicklung!",
color_code="#FFF59D"
)
db.session.add(note)
# Gedanken zu Bookmarks hinzufügen
user.bookmarked_thoughts.append(thought_objects[0])
admin.bookmarked_thoughts.append(thought_objects[1])
# Finaler Commit
db.session.commit()
print("Datenbank wurde erfolgreich initialisiert!")
def init_db():
"""Alias für Kompatibilität mit älteren Scripts."""
init_database()
if __name__ == '__main__':
init_database()
print("Datenbank wurde erfolgreich initialisiert!")
print("Sie können die Anwendung jetzt mit 'python app.py' starten")
print("Anmelden mit:")
print(" Admin: username=admin, password=admin")
print(" User: username=user, password=user")

230
models.py Executable file
View File

@@ -0,0 +1,230 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from enum import Enum
db = SQLAlchemy()
# Beziehungstypen für Gedankenverknüpfungen
class RelationType(Enum):
SUPPORTS = "stützt"
CONTRADICTS = "widerspricht"
BUILDS_UPON = "baut auf auf"
GENERALIZES = "verallgemeinert"
SPECIFIES = "spezifiziert"
INSPIRES = "inspiriert"
# Beziehungstabelle für viele-zu-viele Beziehung zwischen MindMapNodes
node_relationship = db.Table('node_relationship',
db.Column('parent_id', db.Integer, db.ForeignKey('mind_map_node.id'), primary_key=True),
db.Column('child_id', db.Integer, db.ForeignKey('mind_map_node.id'), primary_key=True)
)
# Beziehungstabelle für öffentliche Knoten und Gedanken
node_thought_association = db.Table('node_thought_association',
db.Column('node_id', db.Integer, db.ForeignKey('mind_map_node.id'), primary_key=True),
db.Column('thought_id', db.Integer, db.ForeignKey('thought.id'), primary_key=True)
)
# Beziehungstabelle für Benutzer-spezifische Mindmap-Knoten und Gedanken
user_mindmap_thought_association = db.Table('user_mindmap_thought_association',
db.Column('user_mindmap_id', db.Integer, db.ForeignKey('user_mindmap.id'), primary_key=True),
db.Column('thought_id', db.Integer, db.ForeignKey('thought.id'), primary_key=True)
)
# Beziehungstabelle für Benutzer-Bookmarks von Gedanken
user_thought_bookmark = db.Table('user_thought_bookmark',
db.Column('user_id', db.Integer, db.ForeignKey('user.id'), primary_key=True),
db.Column('thought_id', db.Integer, db.ForeignKey('thought.id'), primary_key=True),
db.Column('created_at', db.DateTime, default=datetime.utcnow)
)
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
password_hash = db.Column(db.String(128))
is_admin = db.Column(db.Boolean, default=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_login = db.Column(db.DateTime)
avatar = db.Column(db.String(200))
bio = db.Column(db.Text)
# Beziehungen
thoughts = db.relationship('Thought', backref='author', lazy=True)
comments = db.relationship('Comment', backref='author', lazy=True)
user_mindmaps = db.relationship('UserMindmap', backref='user', lazy=True)
mindmap_notes = db.relationship('MindmapNote', backref='user', lazy=True)
bookmarked_thoughts = db.relationship('Thought', secondary=user_thought_bookmark,
backref=db.backref('bookmarked_by', lazy='dynamic'))
def set_password(self, password):
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
class Category(db.Model):
"""Wissenschaftliche Kategorien für die Gliederung der öffentlichen Mindmap"""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), unique=True, nullable=False)
description = db.Column(db.Text)
color_code = db.Column(db.String(7)) # Hex color
icon = db.Column(db.String(50))
parent_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=True)
# Beziehungen
children = db.relationship('Category', backref=db.backref('parent', remote_side=[id]))
nodes = db.relationship('MindMapNode', backref='category', lazy=True)
class MindMapNode(db.Model):
"""Öffentliche Mindmap-Knoten, die für alle Benutzer sichtbar sind"""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
description = db.Column(db.Text)
color_code = db.Column(db.String(7))
icon = db.Column(db.String(50))
is_public = db.Column(db.Boolean, default=True)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
created_by_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
category_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=True)
# Beziehungen für Baumstruktur (mehrere Eltern möglich)
parents = db.relationship(
'MindMapNode',
secondary=node_relationship,
primaryjoin=(node_relationship.c.child_id == id),
secondaryjoin=(node_relationship.c.parent_id == id),
backref=db.backref('children', lazy='dynamic'),
lazy='dynamic'
)
# Beziehungen zu Gedanken
thoughts = db.relationship('Thought',
secondary=node_thought_association,
backref=db.backref('nodes', lazy='dynamic'))
# Beziehung zum Ersteller
created_by = db.relationship('User', backref='created_nodes')
class UserMindmap(db.Model):
"""Benutzerspezifische Mindmap, die vom Benutzer personalisierbar ist"""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
description = db.Column(db.Text)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_modified = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
is_private = db.Column(db.Boolean, default=True)
# Beziehungen zu öffentlichen Knoten
public_nodes = db.relationship('MindMapNode',
secondary='user_mindmap_node',
backref=db.backref('in_user_mindmaps', lazy='dynamic'))
# Beziehungen zu Gedanken
thoughts = db.relationship('Thought',
secondary=user_mindmap_thought_association,
backref=db.backref('in_user_mindmaps', lazy='dynamic'))
# Notizen zu dieser Mindmap
notes = db.relationship('MindmapNote', backref='mindmap', lazy=True)
# Beziehungstabelle für benutzerorientierte Mindmaps und öffentliche Knoten
class UserMindmapNode(db.Model):
"""Speichert die Beziehung zwischen Benutzer-Mindmaps und öffentlichen Knoten inkl. Position"""
user_mindmap_id = db.Column(db.Integer, db.ForeignKey('user_mindmap.id'), primary_key=True)
node_id = db.Column(db.Integer, db.ForeignKey('mind_map_node.id'), primary_key=True)
x_position = db.Column(db.Float, default=0) # Position X auf der Mindmap
y_position = db.Column(db.Float, default=0) # Position Y auf der Mindmap
scale = db.Column(db.Float, default=1.0) # Größe des Knotens
added_at = db.Column(db.DateTime, default=datetime.utcnow)
class MindmapNote(db.Model):
"""Private Notizen der Benutzer zu ihrer Mindmap"""
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
mindmap_id = db.Column(db.Integer, db.ForeignKey('user_mindmap.id'), nullable=False)
node_id = db.Column(db.Integer, db.ForeignKey('mind_map_node.id'), nullable=True)
thought_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=True)
content = db.Column(db.Text, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_modified = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
color_code = db.Column(db.String(7), default="#FFF59D") # Farbe der Notiz
class Thought(db.Model):
"""Gedanken und Inhalte, die in der Mindmap verknüpft werden können"""
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(200), nullable=False)
content = db.Column(db.Text, nullable=False)
abstract = db.Column(db.Text)
keywords = db.Column(db.String(500))
color_code = db.Column(db.String(7)) # Hex color code
source_type = db.Column(db.String(50)) # PDF, Markdown, Text etc.
branch = db.Column(db.String(100), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_modified = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
# Beziehungen
comments = db.relationship('Comment', backref='thought', lazy=True, cascade="all, delete-orphan")
ratings = db.relationship('ThoughtRating', backref='thought', lazy=True)
outgoing_relations = db.relationship(
'ThoughtRelation',
foreign_keys='ThoughtRelation.source_id',
backref='source_thought',
lazy=True
)
incoming_relations = db.relationship(
'ThoughtRelation',
foreign_keys='ThoughtRelation.target_id',
backref='target_thought',
lazy=True
)
@property
def average_rating(self):
if not self.ratings:
return 0
return sum(r.relevance_score for r in self.ratings) / len(self.ratings)
class ThoughtRelation(db.Model):
"""Beziehungen zwischen Gedanken"""
id = db.Column(db.Integer, primary_key=True)
source_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=False)
target_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=False)
relation_type = db.Column(db.Enum(RelationType), nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
created_by_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
# Beziehung zum Ersteller
created_by = db.relationship('User', backref='created_relations')
class ThoughtRating(db.Model):
"""Bewertungen von Gedanken durch Benutzer"""
id = db.Column(db.Integer, primary_key=True)
thought_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
relevance_score = db.Column(db.Integer, nullable=False) # 1-5
created_at = db.Column(db.DateTime, default=datetime.utcnow)
__table_args__ = (
db.UniqueConstraint('thought_id', 'user_id', name='unique_thought_rating'),
)
# Beziehung zum Benutzer
user = db.relationship('User', backref='ratings')
class Comment(db.Model):
"""Kommentare zu Gedanken"""
id = db.Column(db.Integer, primary_key=True)
content = db.Column(db.Text, nullable=False)
thought_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_modified = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)

View File

@@ -1,6 +1,14 @@
flask flask==2.2.5
flask-login flask-login==0.6.2
flask-wtf flask-wtf
email-validator email-validator
python-dotenv python-dotenv
flask-sqlalchemy werkzeug==2.2.3
flask-sqlalchemy==3.0.5
openai
requests==2.31.0
flask-cors==4.0.0
gunicorn==21.2.0
#pillow==10.0.1
pytest==7.4.0
pytest-flask==1.2.0

27
static/css/all.min.css vendored Normal file
View File

@@ -0,0 +1,27 @@
/*
* Font Awesome 6.4.0
*
* This is a placeholder file. For production, you should:
* 1. Download Font Awesome from https://fontawesome.com/download
* 2. Extract the downloaded package
* 3. Copy the 'css/all.min.css' file to this location
* 4. Copy the 'webfonts' folder to '/static/webfonts/'
*
* Alternatively, you can install via npm and copy the files:
* npm install @fortawesome/fontawesome-free
* cp -r node_modules/@fortawesome/fontawesome-free/css/all.min.css static/css/
* cp -r node_modules/@fortawesome/fontawesome-free/webfonts/ static/
*/
/* Placeholder styles for common Font Awesome icons */
.fa, .fas, .far, .fab {
display: inline-block;
width: 1em;
text-align: center;
}
/* Warning message */
body::before {
content: "Font Awesome CSS placeholder. Please replace with the actual file.";
display: none;
}

203
static/css/assistant.css Normal file
View File

@@ -0,0 +1,203 @@
/* ChatGPT Assistent Styles - Verbesserte Version */
#chatgpt-assistant {
font-family: 'Inter', sans-serif;
}
#assistant-chat {
transition: max-height 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
border-radius: 0.75rem;
overflow: hidden;
max-width: calc(100vw - 2rem);
}
#assistant-toggle {
transition: transform 0.3s ease, background-color 0.2s ease;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 60;
}
#assistant-toggle:hover {
transform: scale(1.1) rotate(10deg);
}
#assistant-history {
scrollbar-width: thin;
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}
#assistant-history::-webkit-scrollbar {
width: 6px;
}
#assistant-history::-webkit-scrollbar-track {
background: transparent;
}
#assistant-history::-webkit-scrollbar-thumb {
background-color: rgba(156, 163, 175, 0.5);
border-radius: 3px;
}
.dark #assistant-history::-webkit-scrollbar-thumb {
background-color: rgba(156, 163, 175, 0.3);
}
/* Verbesserte Message-Bubbles mit Schatten und Animation */
#assistant-history .flex > div {
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
animation: messageAppear 0.3s ease-out forwards;
opacity: 0;
transform: translateY(10px);
}
@keyframes messageAppear {
to {
opacity: 1;
transform: translateY(0);
}
}
/* Verzögerte Animation für Messages */
#assistant-history .flex:nth-child(1) > div { animation-delay: 0.05s; }
#assistant-history .flex:nth-child(2) > div { animation-delay: 0.1s; }
#assistant-history .flex:nth-child(3) > div { animation-delay: 0.15s; }
#assistant-history .flex:nth-child(4) > div { animation-delay: 0.2s; }
#assistant-history .flex:nth-child(5) > div { animation-delay: 0.25s; }
/* Vorschläge styling */
#assistant-suggestions {
padding: 0.5rem 0.75rem;
transition: all 0.3s ease;
}
.suggestion-pill {
animation: pillAppear 0.4s ease forwards;
opacity: 0;
transform: scale(0.9);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
@keyframes pillAppear {
to {
opacity: 1;
transform: scale(1);
}
}
/* Styling für verschiedene Verzögerungen bei Vorschlägen */
#assistant-suggestions button:nth-child(1) { animation-delay: 0.1s; }
#assistant-suggestions button:nth-child(2) { animation-delay: 0.2s; }
#assistant-suggestions button:nth-child(3) { animation-delay: 0.3s; }
/* Mach Platz für Notifications, damit sie nicht mit dem Assistenten überlappen */
.notification-area {
bottom: 5rem;
}
/* Verbesserte Glassmorphism-Effekt */
.glass-morphism {
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.dark .glass-morphism {
background: rgba(15, 23, 42, 0.35);
border: 1px solid rgba(255, 255, 255, 0.06);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}
/* Verbesserte Farbpalette für Dark Theme */
.dark {
--tw-bg-opacity: 1;
background-color: rgba(10, 15, 25, var(--tw-bg-opacity)) !important;
min-height: 100vh;
}
.dark .bg-dark-900 {
--tw-bg-opacity: 1;
background-color: rgba(10, 15, 25, var(--tw-bg-opacity)) !important;
}
.dark .bg-dark-800 {
--tw-bg-opacity: 1;
background-color: rgba(15, 23, 42, var(--tw-bg-opacity)) !important;
}
.dark .bg-dark-700 {
--tw-bg-opacity: 1;
background-color: rgba(23, 33, 64, var(--tw-bg-opacity)) !important;
}
/* Typing Indicator Animation Styles */
.typing-indicator {
display: flex;
align-items: center;
}
.typing-indicator span {
height: 8px;
width: 8px;
background-color: #888;
border-radius: 50%;
display: inline-block;
margin: 0 2px;
opacity: 0.4;
animation: bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
0%, 80%, 100% { transform: translateY(0); }
40% { transform: translateY(-8px); }
}
/* Chat Input Fokus-Effekt */
#assistant-chat input:focus {
border-color: var(--primary-500, #3B82F6);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.dark #assistant-chat input:focus {
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}
/* Verbesserte Responsive Layouts */
@media (max-width: 640px) {
#assistant-chat {
width: calc(100vw - 2rem) !important;
}
#chatgpt-assistant {
right: 1rem;
bottom: 1rem;
}
}
/* Footer immer unten */
html, body {
height: 100%;
margin: 0;
min-height: 100vh;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1 0 auto;
}
footer {
flex-shrink: 0;
}

421
static/css/base-styles.css Normal file
View File

@@ -0,0 +1,421 @@
/* Base Styles - Dark, Mystical Theme */
/* Global Variables */
:root {
--font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
/* Light Theme */
--bg-primary-light: #f8fafc;
--bg-secondary-light: #f1f5f9;
--bg-tertiary-light: #e2e8f0;
--text-primary-light: #1e293b;
--text-secondary-light: #475569;
--accent-primary-light: #7c3aed;
--accent-secondary-light: #8b5cf6;
--accent-tertiary-light: #a78bfa;
--border-light: #e2e8f0;
--shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--glow-light: 0 0 15px rgba(139, 92, 246, 0.3);
/* Dark Theme */
--bg-primary-dark: #0a0e19;
--bg-secondary-dark: #111827;
--bg-tertiary-dark: #1f2937;
--text-primary-dark: #f9fafb;
--text-secondary-dark: #e5e7eb;
--accent-primary-dark: #6d28d9;
--accent-secondary-dark: #8b5cf6;
--accent-tertiary-dark: #a78bfa;
--border-dark: #1f2937;
--shadow-dark: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
--glow-dark: 0 0 15px rgba(124, 58, 237, 0.5);
/* Transitions */
--transition-fast: 150ms ease-in-out;
--transition-normal: 300ms ease-in-out;
--transition-slow: 500ms ease-in-out;
}
/* Base Styles */
html {
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
scroll-behavior: smooth;
}
body {
transition: background-color var(--transition-normal), color var(--transition-normal);
overflow-x: hidden;
min-height: 100vh;
font-family: var(--font-sans);
line-height: 1.5;
}
/* Dark Mode */
html.dark body {
background-color: var(--bg-primary-dark);
color: var(--text-primary-dark);
}
/* Light Mode */
body {
background-color: var(--bg-primary-light);
color: var(--text-primary-light);
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
line-height: 1.2;
}
.hero-heading {
font-size: 2.75rem;
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1.1;
}
.section-heading {
font-size: 2rem;
font-weight: 700;
letter-spacing: -0.01em;
}
.gradient-text {
background-clip: text;
-webkit-background-clip: text;
color: transparent;
display: inline-block;
}
html.dark .gradient-text {
background-image: linear-gradient(135deg, var(--accent-primary-dark), var(--accent-secondary-dark));
text-shadow: var(--glow-dark);
}
.gradient-text {
background-image: linear-gradient(135deg, var(--accent-primary-light), var(--accent-secondary-light));
text-shadow: var(--glow-light);
}
/* Mystical elements */
.mystical-border {
position: relative;
}
.mystical-border::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 1px solid;
border-radius: inherit;
pointer-events: none;
opacity: 0.3;
}
html.dark .mystical-border::before {
border-color: var(--accent-primary-dark);
box-shadow: var(--glow-dark);
}
.mystical-border::before {
border-color: var(--accent-primary-light);
box-shadow: var(--glow-light);
}
/* Navigation Links */
.nav-link {
position: relative;
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
transition: var(--transition-normal);
}
html.dark .nav-link {
color: var(--text-secondary-dark);
}
.nav-link {
color: var(--text-secondary-light);
}
html.dark .nav-link:hover {
color: var(--text-primary-dark);
background-color: rgba(31, 41, 55, 0.5);
}
.nav-link:hover {
color: var(--text-primary-light);
background-color: rgba(241, 245, 249, 0.5);
}
html.dark .nav-link-active {
color: var(--accent-tertiary-dark);
background-color: rgba(109, 40, 217, 0.15);
}
.nav-link-light-active {
color: var(--accent-primary-light);
background-color: rgba(139, 92, 246, 0.1);
}
/* Glass Morphism Effects */
.glass-navbar-dark {
background-color: rgba(10, 14, 25, 0.8);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.glass-navbar-light {
background-color: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: rgba(226, 232, 240, 0.5);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
.glass-morphism {
transition: background-color var(--transition-normal), backdrop-filter var(--transition-normal);
}
/* Cards */
.mystical-card {
border-radius: 0.75rem;
overflow: hidden;
transition: var(--transition-normal);
}
html.dark .mystical-card {
background-color: var(--bg-secondary-dark);
border: 1px solid var(--border-dark);
box-shadow: var(--shadow-dark);
}
.mystical-card {
background-color: var(--bg-secondary-light);
border: 1px solid var(--border-light);
box-shadow: var(--shadow-light);
}
html.dark .mystical-card:hover {
box-shadow: var(--glow-dark), var(--shadow-dark);
border-color: var(--accent-primary-dark);
}
.mystical-card:hover {
box-shadow: var(--glow-light), var(--shadow-light);
border-color: var(--accent-primary-light);
}
/* Buttons */
.mystical-button {
padding: 0.625rem 1.25rem;
border-radius: 0.5rem;
font-weight: 500;
transition: var(--transition-normal);
position: relative;
overflow: hidden;
}
.mystical-button::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.05), transparent);
transform: translateX(-100%);
transition: transform 0.8s ease-in-out;
}
.mystical-button:hover::before {
transform: translateX(100%);
}
html.dark .mystical-button-primary {
background-color: var(--accent-primary-dark);
color: white;
}
.mystical-button-primary {
background-color: var(--accent-primary-light);
color: white;
}
html.dark .mystical-button-primary:hover {
background-color: var(--accent-secondary-dark);
box-shadow: var(--glow-dark);
}
.mystical-button-primary:hover {
background-color: var(--accent-secondary-light);
box-shadow: var(--glow-light);
}
html.dark .mystical-button-secondary {
background-color: var(--bg-tertiary-dark);
color: var(--text-primary-dark);
border: 1px solid var(--border-dark);
}
.mystical-button-secondary {
background-color: var(--bg-tertiary-light);
color: var(--text-primary-light);
border: 1px solid var(--border-light);
}
html.dark .mystical-button-secondary:hover {
background-color: var(--bg-secondary-dark);
border-color: var(--accent-tertiary-dark);
}
.mystical-button-secondary:hover {
background-color: var(--bg-secondary-light);
border-color: var(--accent-tertiary-light);
}
/* Inputs */
.mystical-input {
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
transition: var(--transition-normal);
width: 100%;
outline: none;
}
html.dark .mystical-input {
background-color: var(--bg-tertiary-dark);
border: 1px solid var(--border-dark);
color: var(--text-primary-dark);
}
.mystical-input {
background-color: var(--bg-tertiary-light);
border: 1px solid var(--border-light);
color: var(--text-primary-light);
}
html.dark .mystical-input:focus {
border-color: var(--accent-tertiary-dark);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}
.mystical-input:focus {
border-color: var(--accent-tertiary-light);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
/* Animations */
@keyframes floatAnimation {
0% { transform: translateY(0); }
50% { transform: translateY(-5px); }
100% { transform: translateY(0); }
}
.animate-float {
animation: floatAnimation 3s ease-in-out infinite;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.animate-fade-in {
animation: fadeIn 0.5s ease-out forwards;
}
/* Scroll Bars */
::-webkit-scrollbar {
width: 0.5rem;
height: 0.5rem;
}
html.dark ::-webkit-scrollbar-track {
background: var(--bg-secondary-dark);
}
::-webkit-scrollbar-track {
background: var(--bg-secondary-light);
}
html.dark ::-webkit-scrollbar-thumb {
background: var(--accent-primary-dark);
border-radius: 0.25rem;
}
::-webkit-scrollbar-thumb {
background: var(--accent-primary-light);
border-radius: 0.25rem;
}
html.dark ::-webkit-scrollbar-thumb:hover {
background: var(--accent-secondary-dark);
}
::-webkit-scrollbar-thumb:hover {
background: var(--accent-secondary-light);
}
/* Responsive Utilities */
@media (max-width: 640px) {
.hero-heading {
font-size: 2rem;
}
.section-heading {
font-size: 1.5rem;
}
}
/* Additional background elements */
.mystical-dot {
position: absolute;
border-radius: 50%;
opacity: 0.15;
filter: blur(3px);
z-index: -1;
transition: opacity var(--transition-normal);
}
html.dark .mystical-dot {
background-color: var(--accent-primary-dark);
box-shadow: 0 0 15px var(--accent-primary-dark);
}
.mystical-dot {
background-color: var(--accent-primary-light);
box-shadow: 0 0 15px var(--accent-primary-light);
}
/* Accessibility */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
/* Focus styles for keyboard navigation */
:focus-visible {
outline: 2px solid var(--accent-primary-light);
outline-offset: 2px;
}
html.dark :focus-visible {
outline-color: var(--accent-primary-dark);
}

3884
static/css/main.css Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
/* Neural Network Background CSS */
/* Make sure the neural network background is always visible */
#neural-network-background {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
z-index: -10 !important; /* Below content but above regular background */
pointer-events: none !important;
opacity: 1 !important;
}
/* Override any solid background colors for the body */
body, body.dark {
background-color: transparent !important;
}
/* Make sure any background color is removed */
html.dark, html {
background-color: transparent !important;
}
/* Make sure any fixed backgrounds are removed */
#app-container {
background-color: transparent !important;
}
/* Ensure content is properly visible over the background */
.glass-morphism {
background-color: rgba(17, 24, 39, 0.6) !important;
backdrop-filter: blur(5px) !important;
}
body.dark .glass-navbar-dark {
background-color: rgba(10, 14, 25, 0.7) !important;
}
body .glass-navbar-light {
background-color: rgba(255, 255, 255, 0.7) !important;
}
/* Make sure footer has proper transparency */
footer {
background-color: rgba(10, 14, 25, 0.7) !important;
}

207
static/css/src/input.css Normal file
View File

@@ -0,0 +1,207 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html {
@apply scroll-smooth;
}
body {
@apply bg-gray-50 text-gray-800 dark:bg-dark-800 dark:text-gray-100 font-sans;
}
h1, h2, h3, h4, h5, h6 {
@apply font-bold text-gray-900 dark:text-white;
}
h1 {
@apply text-4xl md:text-5xl lg:text-6xl;
}
h2 {
@apply text-3xl md:text-4xl;
}
h3 {
@apply text-2xl md:text-3xl;
}
h4 {
@apply text-xl md:text-2xl;
}
a {
@apply text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300 transition-colors;
}
input, textarea, select {
@apply bg-white border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-dark-700 dark:border-dark-500 dark:focus:ring-primary-400 dark:focus:border-primary-400;
}
label {
@apply block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1;
}
::placeholder {
@apply text-gray-400 dark:text-gray-500;
}
}
@layer components {
.btn {
@apply inline-flex items-center justify-center px-4 py-2 font-medium rounded-md transition-all focus:outline-none focus:ring-2 focus:ring-offset-2 shadow-sm text-base;
}
.btn-primary {
@apply btn bg-primary-600 hover:bg-primary-700 text-white focus:ring-primary-500 hover:shadow-md active:translate-y-0.5 dark:bg-primary-700 dark:hover:bg-primary-600;
}
.btn-secondary {
@apply btn bg-secondary-600 hover:bg-secondary-700 text-white focus:ring-secondary-500 hover:shadow-md active:translate-y-0.5 dark:bg-secondary-700 dark:hover:bg-secondary-600;
}
.btn-outline {
@apply btn border-2 border-gray-300 dark:border-dark-500 bg-white dark:bg-transparent text-gray-700 dark:text-gray-200 hover:bg-gray-50 hover:border-primary-500 hover:text-primary-600 dark:hover:bg-dark-700 dark:hover:border-primary-400 dark:hover:text-primary-400 focus:ring-gray-500 active:translate-y-0.5;
}
.card {
@apply bg-white shadow-md dark:bg-dark-700 rounded-lg overflow-hidden border border-gray-200 dark:border-dark-600 hover:shadow-lg transition-shadow duration-300;
}
.gradient-text {
@apply text-transparent bg-clip-text bg-gradient-to-r from-primary-600 to-secondary-600 dark:from-primary-500 dark:to-secondary-500 font-bold;
}
.node-tooltip {
@apply max-w-xs p-3 bg-white text-gray-800 dark:bg-dark-800 dark:text-white rounded-lg shadow-lg text-sm z-50 border border-gray-200 dark:border-dark-600;
}
.mindmap-node {
@apply cursor-pointer transition-all duration-200 hover:shadow-lg border-2 border-gray-200 dark:border-dark-600;
}
/* Mindmap-spezifische Stile */
.mindmap-container {
@apply bg-gray-50/80 dark:bg-dark-800/80 rounded-lg p-4 shadow-inner;
}
.mindmap-node-root {
@apply bg-primary-100 dark:bg-primary-900 text-primary-900 dark:text-primary-100 border-primary-300 dark:border-primary-700;
}
.mindmap-node-branch {
@apply bg-secondary-100 dark:bg-secondary-900 text-secondary-900 dark:text-secondary-100 border-secondary-300 dark:border-secondary-700;
}
.mindmap-node-leaf {
@apply bg-gray-100 dark:bg-dark-700 text-gray-800 dark:text-gray-200 border-gray-300 dark:border-dark-500;
}
.mindmap-link {
@apply stroke-gray-400 dark:stroke-gray-500 stroke-[2];
}
.mindmap-link-active {
@apply stroke-primary-500 dark:stroke-primary-400 stroke-[3];
}
.form-group {
@apply mb-4;
}
.form-control {
@apply w-full;
}
.ascii-art {
@apply font-mono text-xs leading-none whitespace-pre tracking-tight select-none text-primary-700 dark:text-primary-400 opacity-80 dark:opacity-60 font-bold;
}
/* Verbesserte Formulareingabefelder */
.form-input,
.form-textarea,
.form-select {
@apply w-full rounded-md border border-gray-300 bg-white px-4 py-2 text-gray-800 shadow-sm
focus:border-primary-500 focus:ring focus:ring-primary-500 focus:ring-opacity-50
dark:border-dark-500 dark:bg-dark-700 dark:text-gray-100 dark:focus:border-primary-400 dark:focus:ring-primary-400;
}
.form-input-lg {
@apply py-3 text-lg;
}
.form-input-sm {
@apply py-1 text-sm;
}
.form-checkbox,
.form-radio {
@apply h-5 w-5 rounded border-gray-300 text-primary-600 shadow-sm
focus:border-primary-500 focus:ring focus:ring-primary-500 focus:ring-opacity-50
dark:border-dark-500 dark:bg-dark-700 dark:focus:border-primary-400 dark:focus:ring-primary-400;
}
.form-checkbox {
@apply rounded;
}
.form-radio {
@apply rounded-full;
}
.form-error {
@apply mt-1 text-sm text-red-600 dark:text-red-400;
}
}
@layer utilities {
.tech-gradient {
@apply bg-gradient-to-r from-primary-600 to-secondary-500;
}
.glass-effect {
@apply bg-white/95 backdrop-blur-md border border-gray-200 shadow-md dark:bg-dark-800/90 dark:border-dark-700/50 dark:shadow-xl;
}
.focus-ring {
@apply focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-primary-400 dark:focus:ring-offset-dark-800;
}
.input-focus {
@apply focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-primary-400 dark:focus:border-primary-400;
}
}
/* Form validation styles */
.is-valid {
@apply border-green-500 dark:border-green-400;
}
.is-invalid {
@apply border-red-500 dark:border-red-400;
}
.is-valid:focus {
@apply ring-green-500/30 border-green-500 dark:ring-green-400/30 dark:border-green-400;
}
.is-invalid:focus {
@apply ring-red-500/30 border-red-500 dark:ring-red-400/30 dark:border-red-400;
}
.form-hint {
@apply text-xs text-gray-500 dark:text-gray-400 mt-1;
}
.form-label {
@apply block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1;
}
.input-icon {
@apply absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-500 dark:text-gray-400;
}
.input-with-icon {
@apply pl-10;
}

1444
static/css/style.css Normal file

File diff suppressed because it is too large Load Diff

6
static/css/tailwind.min.css vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* Failed to bundle using Rollup v2.79.2: the file imports a not supported node.js built-in module "fs".
* If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr
*/
throw new Error('Failed to bundle using Rollup v2.79.2: the file imports a not supported node.js built-in module "fs". If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr');

526
static/d3-extensions.js vendored Normal file
View File

@@ -0,0 +1,526 @@
/**
* D3.js Erweiterungen für verbesserte Mindmap-Funktionalität
* Diese Datei enthält zusätzliche Hilfsfunktionen und Erweiterungen für D3.js
*/
class D3Extensions {
/**
* Erstellt einen verbesserten radialen Farbverlauf
* @param {Object} defs - Das D3 defs Element
* @param {string} id - ID für den Gradienten
* @param {string} baseColor - Grundfarbe in hexadezimal oder RGB
* @returns {Object} - Das erstellte Gradient-Element
*/
static createEnhancedRadialGradient(defs, id, baseColor) {
// Farben berechnen
const d3Color = d3.color(baseColor);
const lightColor = d3Color.brighter(0.7);
const darkColor = d3Color.darker(0.3);
const midColor = d3Color;
// Gradient erstellen
const gradient = defs.append('radialGradient')
.attr('id', id)
.attr('cx', '30%')
.attr('cy', '30%')
.attr('r', '70%');
// Farbstops hinzufügen für realistischeren Verlauf
gradient.append('stop')
.attr('offset', '0%')
.attr('stop-color', lightColor.formatHex());
gradient.append('stop')
.attr('offset', '50%')
.attr('stop-color', midColor.formatHex());
gradient.append('stop')
.attr('offset', '100%')
.attr('stop-color', darkColor.formatHex());
return gradient;
}
/**
* Erstellt einen Glüheffekt-Filter
* @param {Object} defs - D3-Referenz auf den defs-Bereich
* @param {String} id - ID des Filters
* @param {String} color - Farbe des Glüheffekts (Hex-Code)
* @param {Number} strength - Stärke des Glüheffekts
* @returns {Object} D3-Referenz auf den erstellten Filter
*/
static createGlowFilter(defs, id, color = '#b38fff', strength = 5) {
const filter = defs.append('filter')
.attr('id', id)
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
// Unschärfe-Effekt
filter.append('feGaussianBlur')
.attr('in', 'SourceGraphic')
.attr('stdDeviation', strength)
.attr('result', 'blur');
// Farbverstärkung für den Glüheffekt
filter.append('feColorMatrix')
.attr('in', 'blur')
.attr('type', 'matrix')
.attr('values', '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 -7')
.attr('result', 'glow');
// Farbflut mit der angegebenen Farbe
filter.append('feFlood')
.attr('flood-color', color)
.attr('flood-opacity', '0.7')
.attr('result', 'color');
// Zusammensetzen des Glüheffekts mit der Farbe
filter.append('feComposite')
.attr('in', 'color')
.attr('in2', 'glow')
.attr('operator', 'in')
.attr('result', 'glow-color');
// Zusammenfügen aller Ebenen
const feMerge = filter.append('feMerge');
feMerge.append('feMergeNode')
.attr('in', 'glow-color');
feMerge.append('feMergeNode')
.attr('in', 'SourceGraphic');
return filter;
}
/**
* Berechnet eine konsistente Farbe aus einem String
* @param {string} str - Eingabestring
* @returns {string} - Generierte Farbe als Hex-String
*/
static stringToColor(str) {
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
// Basis-Farbpalette für konsistente Farben
const colorPalette = [
"#4299E1", // Blau
"#9F7AEA", // Lila
"#ED64A6", // Pink
"#48BB78", // Grün
"#ECC94B", // Gelb
"#F56565", // Rot
"#38B2AC", // Türkis
"#ED8936", // Orange
"#667EEA", // Indigo
];
// Farbe aus der Palette wählen basierend auf dem Hash
const colorIndex = Math.abs(hash) % colorPalette.length;
return colorPalette[colorIndex];
}
/**
* Erstellt einen Schatteneffekt-Filter
* @param {Object} defs - D3-Referenz auf den defs-Bereich
* @param {String} id - ID des Filters
* @returns {Object} D3-Referenz auf den erstellten Filter
*/
static createShadowFilter(defs, id) {
const filter = defs.append('filter')
.attr('id', id)
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
// Einfacher Schlagschatten
filter.append('feDropShadow')
.attr('dx', 0)
.attr('dy', 4)
.attr('stdDeviation', 4)
.attr('flood-color', 'rgba(0, 0, 0, 0.3)');
return filter;
}
/**
* Erstellt einen Glasmorphismus-Effekt-Filter
* @param {Object} defs - D3-Referenz auf den defs-Bereich
* @param {String} id - ID des Filters
* @returns {Object} D3-Referenz auf den erstellten Filter
*/
static createGlassMorphismFilter(defs, id) {
const filter = defs.append('filter')
.attr('id', id)
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
// Hintergrund-Unschärfe für den Glaseffekt
filter.append('feGaussianBlur')
.attr('in', 'SourceGraphic')
.attr('stdDeviation', 8)
.attr('result', 'blur');
// Hellere Farbe für den Glaseffekt
filter.append('feColorMatrix')
.attr('in', 'blur')
.attr('type', 'matrix')
.attr('values', '1 0 0 0 0.1 0 1 0 0 0.1 0 0 1 0 0.1 0 0 0 0.6 0')
.attr('result', 'glass');
// Überlagerung mit dem Original
const feMerge = filter.append('feMerge');
feMerge.append('feMergeNode')
.attr('in', 'glass');
feMerge.append('feMergeNode')
.attr('in', 'SourceGraphic');
return filter;
}
/**
* Erstellt einen verstärkten Glasmorphismus-Effekt mit Farbverlauf
* @param {Object} defs - D3-Referenz auf den defs-Bereich
* @param {String} id - ID des Filters
* @param {String} color1 - Erste Farbe des Verlaufs (Hex-Code)
* @param {String} color2 - Zweite Farbe des Verlaufs (Hex-Code)
* @returns {Object} D3-Referenz auf den erstellten Filter
*/
static createEnhancedGlassMorphismFilter(defs, id, color1 = '#b38fff', color2 = '#58a9ff') {
// Farbverlauf für den Glaseffekt definieren
const gradientId = `gradient-${id}`;
const gradient = defs.append('linearGradient')
.attr('id', gradientId)
.attr('x1', '0%')
.attr('y1', '0%')
.attr('x2', '100%')
.attr('y2', '100%');
gradient.append('stop')
.attr('offset', '0%')
.attr('stop-color', color1)
.attr('stop-opacity', '0.3');
gradient.append('stop')
.attr('offset', '100%')
.attr('stop-color', color2)
.attr('stop-opacity', '0.3');
// Filter erstellen
const filter = defs.append('filter')
.attr('id', id)
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
// Hintergrund-Unschärfe
filter.append('feGaussianBlur')
.attr('in', 'SourceGraphic')
.attr('stdDeviation', 6)
.attr('result', 'blur');
// Farbverlauf einfügen
const feImage = filter.append('feImage')
.attr('xlink:href', `#${gradientId}`)
.attr('result', 'gradient')
.attr('x', '0%')
.attr('y', '0%')
.attr('width', '100%')
.attr('height', '100%')
.attr('preserveAspectRatio', 'none');
// Zusammenfügen aller Ebenen
const feMerge = filter.append('feMerge');
feMerge.append('feMergeNode')
.attr('in', 'blur');
feMerge.append('feMergeNode')
.attr('in', 'gradient');
feMerge.append('feMergeNode')
.attr('in', 'SourceGraphic');
return filter;
}
/**
* Erstellt einen 3D-Glaseffekt mit verbesserter Tiefe und Reflexionen
* @param {Object} defs - D3-Referenz auf den defs-Bereich
* @param {String} id - ID des Filters
* @returns {Object} D3-Referenz auf den erstellten Filter
*/
static create3DGlassEffect(defs, id) {
const filter = defs.append('filter')
.attr('id', id)
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
// Farbmatrix für Transparenz
filter.append('feColorMatrix')
.attr('type', 'matrix')
.attr('in', 'SourceGraphic')
.attr('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.7 0')
.attr('result', 'transparent');
// Hintergrund-Unschärfe für Tiefe
filter.append('feGaussianBlur')
.attr('in', 'transparent')
.attr('stdDeviation', '4')
.attr('result', 'blurred');
// Lichtquelle und Schattierung hinzufügen
const lightSource = filter.append('feSpecularLighting')
.attr('in', 'blurred')
.attr('surfaceScale', '6')
.attr('specularConstant', '1')
.attr('specularExponent', '30')
.attr('lighting-color', '#ffffff')
.attr('result', 'specular');
lightSource.append('fePointLight')
.attr('x', '100')
.attr('y', '100')
.attr('z', '200');
// Lichtreflexion verstärken
filter.append('feComposite')
.attr('in', 'specular')
.attr('in2', 'SourceGraphic')
.attr('operator', 'in')
.attr('result', 'specularHighlight');
// Inneren Schatten erzeugen
const innerShadow = filter.append('feOffset')
.attr('in', 'SourceAlpha')
.attr('dx', '0')
.attr('dy', '1')
.attr('result', 'offsetblur');
innerShadow.append('feGaussianBlur')
.attr('in', 'offsetblur')
.attr('stdDeviation', '2')
.attr('result', 'innerShadow');
filter.append('feComposite')
.attr('in', 'innerShadow')
.attr('in2', 'SourceGraphic')
.attr('operator', 'out')
.attr('result', 'innerShadowEffect');
// Schichten kombinieren
const feMerge = filter.append('feMerge');
feMerge.append('feMergeNode')
.attr('in', 'blurred');
feMerge.append('feMergeNode')
.attr('in', 'innerShadowEffect');
feMerge.append('feMergeNode')
.attr('in', 'specularHighlight');
feMerge.append('feMergeNode')
.attr('in', 'SourceGraphic');
return filter;
}
/**
* Fügt einen Partikelsystem-Effekt für interaktive Knoten hinzu
* @param {Object} parent - Das übergeordnete SVG-Element
* @param {number} x - X-Koordinate des Zentrums
* @param {number} y - Y-Koordinate des Zentrums
* @param {string} color - Partikelfarbe (Hex-Code)
* @param {number} count - Anzahl der Partikel
*/
static createParticleEffect(parent, x, y, color = '#b38fff', count = 5) {
const particles = [];
for (let i = 0; i < count; i++) {
const particle = parent.append('circle')
.attr('cx', x)
.attr('cy', y)
.attr('r', 0)
.attr('fill', color)
.style('opacity', 0.8);
particles.push(particle);
// Partikel animieren
animateParticle(particle);
}
function animateParticle(particle) {
// Zufällige Richtung und Geschwindigkeit
const angle = Math.random() * Math.PI * 2;
const speed = 1 + Math.random() * 2;
const distance = 20 + Math.random() * 30;
// Zielposition berechnen
const targetX = x + Math.cos(angle) * distance;
const targetY = y + Math.sin(angle) * distance;
// Animation mit zufälliger Dauer
const duration = 1000 + Math.random() * 500;
particle
.attr('r', 0)
.style('opacity', 0.8)
.transition()
.duration(duration)
.attr('cx', targetX)
.attr('cy', targetY)
.attr('r', 2 + Math.random() * 3)
.style('opacity', 0)
.on('end', function() {
// Partikel entfernen
particle.remove();
});
}
}
/**
* Führt eine Pulsanimation auf einem Knoten durch
* @param {Object} node - D3-Knoten-Selektion
* @returns {void}
*/
static pulseAnimation(node) {
if (!node) return;
const circle = node.select('circle');
const originalRadius = parseFloat(circle.attr('r'));
const originalFill = circle.attr('fill');
// Pulsanimation
circle
.transition()
.duration(400)
.attr('r', originalRadius * 1.3)
.attr('fill', '#b38fff')
.transition()
.duration(400)
.attr('r', originalRadius)
.attr('fill', originalFill);
}
/**
* Berechnet eine adaptive Schriftgröße basierend auf der Textlänge
* @param {string} text - Der anzuzeigende Text
* @param {number} maxSize - Maximale Schriftgröße in Pixel
* @param {number} minSize - Minimale Schriftgröße in Pixel
* @returns {number} - Die berechnete Schriftgröße
*/
static getAdaptiveFontSize(text, maxSize = 14, minSize = 10) {
if (!text) return maxSize;
// Linear die Schriftgröße basierend auf der Textlänge anpassen
const length = text.length;
if (length <= 6) return maxSize;
if (length >= 20) return minSize;
// Lineare Interpolation
const factor = (length - 6) / (20 - 6);
return maxSize - factor * (maxSize - minSize);
}
/**
* Fügt einen Pulsierenden Effekt zu einer Selektion hinzu
* @param {Object} selection - D3-Selektion
* @param {number} duration - Dauer eines Puls-Zyklus in ms
* @param {number} minOpacity - Minimale Opazität
* @param {number} maxOpacity - Maximale Opazität
*/
static addPulseEffect(selection, duration = 1500, minOpacity = 0.4, maxOpacity = 0.9) {
function pulse() {
selection
.transition()
.duration(duration / 2)
.style('opacity', minOpacity)
.transition()
.duration(duration / 2)
.style('opacity', maxOpacity)
.on('end', pulse);
}
// Initialen Stil setzen
selection.style('opacity', maxOpacity);
// Pulsanimation starten
pulse();
}
/**
* Verarbeitet Daten aus der Datenbank für die Mindmap-Visualisierung
* @param {Array} databaseNodes - Knotendaten aus der Datenbank
* @param {Array} links - Verbindungsdaten oder null für automatische Extraktion
* @returns {Object} Aufbereitete Daten für D3.js
*/
static processDbNodesForVisualization(databaseNodes, links = null) {
// Überprüfe, ob Daten vorhanden sind
if (!databaseNodes || databaseNodes.length === 0) {
console.warn('Keine Knotendaten zum Verarbeiten vorhanden');
return { nodes: [], links: [] };
}
// Knoten mit D3-Kompatiblem Format erstellen
const nodes = databaseNodes.map(node => {
// Farbgenerierung, falls keine vorhanden
const nodeColor = node.color_code ||
node.color ||
D3Extensions.stringToColor(node.name || 'default');
return {
id: node.id,
name: node.name,
description: node.description || '',
thought_count: node.thought_count || 0,
color: nodeColor,
// Zusätzliche Attribute
category_id: node.category_id,
is_public: node.is_public !== undefined ? node.is_public : true,
// Position, falls vorhanden
x: node.x_position,
y: node.y_position,
// Größe, falls vorhanden
scale: node.scale || 1.0
};
});
// Verbindungen verarbeiten
let processedLinks = [];
if (links && Array.isArray(links)) {
// Verwende übergebene Verbindungen
processedLinks = links.map(link => {
return {
source: link.source,
target: link.target,
// Zusätzliche Attribute
type: link.type || 'default',
strength: link.strength || 1
};
});
} else {
// Extrahiere Verbindungen aus den Knoten
databaseNodes.forEach(node => {
if (node.connections && Array.isArray(node.connections)) {
node.connections.forEach(conn => {
processedLinks.push({
source: node.id,
target: conn.target,
type: conn.type || 'default',
strength: conn.strength || 1
});
});
}
});
}
return { nodes, links: processedLinks };
}
}
// Globale Verfügbarkeit sicherstellen
window.D3Extensions = D3Extensions;

BIN
static/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

35
static/fonts/inter.css Normal file
View File

@@ -0,0 +1,35 @@
/* Inter font - Local version */
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 300;
src: url('../fonts/inter-light.woff2') format('woff2');
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 400;
src: url('../fonts/inter-regular.woff2') format('woff2');
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 500;
src: url('../fonts/inter-medium.woff2') format('woff2');
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 600;
src: url('../fonts/inter-semibold.woff2') format('woff2');
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 700;
src: url('../fonts/inter-bold.woff2') format('woff2');
}

View File

@@ -0,0 +1,21 @@
/* JetBrains Mono font - Local version */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
src: url('../fonts/jetbrainsmono-regular.woff2') format('woff2');
}
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 500;
src: url('../fonts/jetbrainsmono-medium.woff2') format('woff2');
}
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 700;
src: url('../fonts/jetbrainsmono-bold.woff2') format('woff2');
}

25
static/img/favicon-gen.py Normal file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from PIL import Image
import cairosvg
# Pfad zum SVG-Favicon
svg_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.svg')
# Ausgabepfad für das PNG
png_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.png')
# Ausgabepfad für das ICO
ico_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.ico')
# SVG zu PNG konvertieren
cairosvg.svg2png(url=svg_path, write_to=png_path, output_width=512, output_height=512)
# PNG zu ICO konvertieren
img = Image.open(png_path)
img.save(ico_path, sizes=[(16, 16), (32, 32), (48, 48), (64, 64), (128, 128)])
print(f"Favicon erfolgreich erstellt: {ico_path}")
# Optional: PNG-Datei löschen, wenn nur ICO benötigt wird
# os.remove(png_path)

21
static/img/favicon.svg Normal file
View File

@@ -0,0 +1,21 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="512" height="512" rx="128" fill="url(#paint0_linear)" />
<path d="M143.5 384V128H180.5L256.5 270L332.5 128H369.5V384H328.5V196L256.5 332H256L183.5 196V384H143.5Z" fill="white"/>
<circle cx="143.5" cy="128" r="20" fill="#a040ff" />
<circle cx="256.5" cy="270" r="25" fill="#a040ff" />
<circle cx="369.5" cy="128" r="20" fill="#a040ff" />
<circle cx="143.5" cy="384" r="20" fill="#4080ff" />
<circle cx="369.5" cy="384" r="20" fill="#4080ff" />
<path d="M143.5 128L183.5 196" stroke="white" stroke-width="4" stroke-linecap="round" />
<path d="M256.5 270L183.5 196" stroke="white" stroke-width="4" stroke-linecap="round" />
<path d="M256.5 270L328.5 196" stroke="white" stroke-width="4" stroke-linecap="round" />
<path d="M369.5 128L328.5 196" stroke="white" stroke-width="4" stroke-linecap="round" />
<path d="M183.5 196L143.5 384" stroke="white" stroke-width="4" stroke-linecap="round" />
<path d="M328.5 196L369.5 384" stroke="white" stroke-width="4" stroke-linecap="round" />
<defs>
<linearGradient id="paint0_linear" x1="0" y1="0" x2="512" y2="512" gradientUnits="userSpaceOnUse">
<stop stop-color="#205cf5" />
<stop offset="1" stop-color="#8020f5" />
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

5
static/js/alpine.min.js vendored Normal file

File diff suppressed because one or more lines are too long

234
static/js/main.js Normal file
View File

@@ -0,0 +1,234 @@
/**
* MindMap - Hauptdatei für globale JavaScript-Funktionen
*/
/**
* Hauptmodul für die MindMap-Anwendung
* Verwaltet die globale Anwendungslogik
*/
document.addEventListener('DOMContentLoaded', function() {
// Initialisiere die Anwendung
MindMap.init();
// Wende Dunkel-/Hellmodus an
const isDarkMode = localStorage.getItem('darkMode') === 'dark';
document.documentElement.classList.toggle('dark', isDarkMode);
});
/**
* Hauptobjekt der MindMap-Anwendung
*/
const MindMap = {
// App-Status
initialized: false,
darkMode: document.documentElement.classList.contains('dark'),
pageInitializers: {},
currentPage: document.body.dataset.page,
/**
* Initialisiert die MindMap-Anwendung
*/
init() {
if (this.initialized) return;
console.log('MindMap-Anwendung wird initialisiert...');
// Initialisiere den ChatGPT-Assistenten
if (typeof ChatGPTAssistant !== 'undefined') {
const assistant = new ChatGPTAssistant();
assistant.init();
// Speichere als Teil von MindMap
this.assistant = assistant;
}
// Seiten-spezifische Initialisierer aufrufen
if (this.currentPage && this.pageInitializers[this.currentPage]) {
this.pageInitializers[this.currentPage]();
}
// Event-Listener einrichten
this.setupEventListeners();
// Dunkel-/Hellmodus aus LocalStorage wiederherstellen
if (localStorage.getItem('darkMode') === 'dark') {
document.documentElement.classList.add('dark');
this.darkMode = true;
}
// Mindmap initialisieren, falls auf der richtigen Seite
this.initializeMindmap();
this.initialized = true;
},
/**
* Initialisiert die D3.js Mindmap-Visualisierung
*/
initializeMindmap() {
// Prüfe, ob wir auf der Mindmap-Seite sind
const mindmapContainer = document.getElementById('mindmap-container');
if (!mindmapContainer) return;
try {
console.log('Initialisiere Mindmap...');
// Prüfe, ob MindMapVisualization geladen ist
if (typeof MindMapVisualization === 'undefined') {
console.error('MindMapVisualization-Klasse ist nicht definiert!');
return;
}
// Initialisiere die Mindmap
const mindmap = new MindMapVisualization('#mindmap-container', {
height: mindmapContainer.clientHeight || 600,
nodeRadius: 18,
selectedNodeRadius: 24,
linkDistance: 150,
onNodeClick: this.handleNodeClick.bind(this)
});
// Globale Referenz für andere Module
window.mindmapInstance = mindmap;
// Event-Listener für Zoom-Buttons
const zoomInBtn = document.getElementById('zoom-in-btn');
if (zoomInBtn) {
zoomInBtn.addEventListener('click', () => {
const svg = d3.select('#mindmap-container svg');
const currentZoom = d3.zoomTransform(svg.node());
const newScale = currentZoom.k * 1.3;
svg.transition().duration(300).call(
d3.zoom().transform,
d3.zoomIdentity.translate(currentZoom.x, currentZoom.y).scale(newScale)
);
});
}
const zoomOutBtn = document.getElementById('zoom-out-btn');
if (zoomOutBtn) {
zoomOutBtn.addEventListener('click', () => {
const svg = d3.select('#mindmap-container svg');
const currentZoom = d3.zoomTransform(svg.node());
const newScale = currentZoom.k / 1.3;
svg.transition().duration(300).call(
d3.zoom().transform,
d3.zoomIdentity.translate(currentZoom.x, currentZoom.y).scale(newScale)
);
});
}
const centerBtn = document.getElementById('center-btn');
if (centerBtn) {
centerBtn.addEventListener('click', () => {
const svg = d3.select('#mindmap-container svg');
svg.transition().duration(500).call(
d3.zoom().transform,
d3.zoomIdentity.scale(1)
);
});
}
// Event-Listener für Add-Thought-Button
const addThoughtBtn = document.getElementById('add-thought-btn');
if (addThoughtBtn) {
addThoughtBtn.addEventListener('click', () => {
this.showAddThoughtDialog();
});
}
// Event-Listener für Connect-Button
const connectBtn = document.getElementById('connect-btn');
if (connectBtn) {
connectBtn.addEventListener('click', () => {
this.showConnectDialog();
});
}
} catch (error) {
console.error('Fehler bei der Initialisierung der Mindmap:', error);
}
},
/**
* Handler für Klick auf einen Knoten in der Mindmap
* @param {Object} node - Der angeklickte Knoten
*/
handleNodeClick(node) {
console.log('Knoten wurde angeklickt:', node);
// Hier könnte man Logik hinzufügen, um Detailinformationen anzuzeigen
// oder den ausgewählten Knoten hervorzuheben
const detailsContainer = document.getElementById('node-details');
if (detailsContainer) {
detailsContainer.innerHTML = `
<div class="p-4">
<h3 class="text-xl font-bold mb-2">${node.name}</h3>
<p class="text-gray-300 mb-4">${node.description || 'Keine Beschreibung verfügbar.'}</p>
<div class="flex items-center justify-between">
<span class="text-sm">
<i class="fas fa-brain mr-1"></i> ${node.thought_count || 0} Gedanken
</span>
<button class="px-3 py-1 bg-purple-600 bg-opacity-30 rounded-lg text-sm">
<i class="fas fa-plus mr-1"></i> Gedanke hinzufügen
</button>
</div>
</div>
`;
// Button zum Hinzufügen eines Gedankens
const addThoughtBtn = detailsContainer.querySelector('button');
addThoughtBtn.addEventListener('click', () => {
this.showAddThoughtDialog(node);
});
}
},
/**
* Dialog zum Hinzufügen eines neuen Knotens
*/
showAddNodeDialog() {
// Diese Funktionalität würde in einer vollständigen Implementierung eingebunden werden
alert('Diese Funktion steht bald zur Verfügung!');
},
/**
* Dialog zum Hinzufügen eines neuen Gedankens zu einem Knoten
*/
showAddThoughtDialog(node) {
// Diese Funktionalität würde in einer vollständigen Implementierung eingebunden werden
alert('Diese Funktion steht bald zur Verfügung!');
},
/**
* Dialog zum Verbinden von Knoten
*/
showConnectDialog() {
// Diese Funktionalität würde in einer vollständigen Implementierung eingebunden werden
alert('Diese Funktion steht bald zur Verfügung!');
},
/**
* Richtet Event-Listener für die Benutzeroberfläche ein
*/
setupEventListeners() {
// Event-Listener für Dark Mode-Wechsel
document.addEventListener('darkModeToggled', (event) => {
this.darkMode = event.detail.isDark;
});
// Responsive Anpassungen bei Fenstergröße
window.addEventListener('resize', () => {
if (window.mindmapInstance) {
const container = document.getElementById('mindmap-container');
if (container) {
window.mindmapInstance.width = container.clientWidth;
window.mindmapInstance.height = container.clientHeight;
}
}
});
}
};
// Globale Export für andere Module
window.MindMap = MindMap;

View File

@@ -0,0 +1,572 @@
/**
* ChatGPT Assistent Modul
* Verwaltet die Interaktion mit der OpenAI API und die Benutzeroberfläche des Assistenten
*/
class ChatGPTAssistant {
constructor() {
this.messages = [];
this.isOpen = false;
this.isLoading = false;
this.container = null;
this.chatHistory = null;
this.inputField = null;
this.suggestionArea = null;
this.maxRetries = 2;
this.retryCount = 0;
this.markdownParser = null;
this.initializeMarkdownParser();
}
/**
* Initialisiert den Markdown-Parser
*/
async initializeMarkdownParser() {
// Dynamisch marked.js laden, wenn noch nicht vorhanden
if (!window.marked) {
try {
// Prüfen, ob marked.js bereits im Dokument geladen ist
if (!document.querySelector('script[src*="marked"]')) {
// Falls nicht, Script-Tag erstellen und einfügen
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/marked/marked.min.js';
script.async = true;
// Promise erstellen, das resolved wird, wenn das Script geladen wurde
await new Promise((resolve, reject) => {
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
});
console.log('Marked.js erfolgreich geladen');
}
// Marked konfigurieren
this.markdownParser = window.marked;
this.markdownParser.setOptions({
gfm: true,
breaks: true,
sanitize: true,
smartLists: true,
smartypants: true
});
} catch (error) {
console.error('Fehler beim Laden von marked.js:', error);
// Fallback-Parser, der nur einfache Absätze erkennt
this.markdownParser = {
parse: (text) => {
return text.split('\n').map(line => {
if (line.trim() === '') return '<br>';
return `<p>${line}</p>`;
}).join('');
}
};
}
} else {
// Marked ist bereits geladen
this.markdownParser = window.marked;
}
}
/**
* Initialisiert den Assistenten und fügt die UI zum DOM hinzu
*/
init() {
// Assistent-Container erstellen
this.createAssistantUI();
// Event-Listener hinzufügen
this.setupEventListeners();
// Ersten Willkommensnachricht anzeigen
this.addMessage("assistant", "Hallo! Ich bin dein KI-Assistent (4o-mini) und habe Zugriff auf die Wissensdatenbank. Wie kann ich dir helfen?\n\nDu kannst mir Fragen über:\n- **Gedanken** in der Datenbank\n- **Kategorien** und Wissenschaftsbereiche\n- **Mindmaps** und Wissensverknüpfungen\n\nstellen.");
// Vorschläge anzeigen
this.showSuggestions([
"Zeige mir Gedanken zur künstlichen Intelligenz",
"Welche Kategorien gibt es in der Datenbank?",
"Suche nach Mindmaps zum Thema Informatik"
]);
console.log('KI-Assistent initialisiert!');
}
/**
* Erstellt die UI-Elemente für den Assistenten
*/
createAssistantUI() {
// Hauptcontainer erstellen
this.container = document.createElement('div');
this.container.id = 'chatgpt-assistant';
this.container.className = 'fixed bottom-4 right-4 z-50 flex flex-col';
// Button zum Öffnen/Schließen des Assistenten
const toggleButton = document.createElement('button');
toggleButton.id = 'assistant-toggle';
toggleButton.className = 'ml-auto bg-primary-600 hover:bg-primary-700 text-white rounded-full p-3 shadow-lg transition-all duration-300 mb-2';
toggleButton.innerHTML = '<i class="fas fa-robot text-xl"></i>';
// Chat-Container
const chatContainer = document.createElement('div');
chatContainer.id = 'assistant-chat';
chatContainer.className = 'bg-white dark:bg-dark-800 rounded-lg shadow-xl overflow-hidden transition-all duration-300 w-80 md:w-96 max-h-0 opacity-0';
// Chat-Header
const header = document.createElement('div');
header.className = 'bg-primary-600 text-white p-3 flex items-center justify-between';
header.innerHTML = `
<div class="flex items-center">
<i class="fas fa-robot mr-2"></i>
<span>KI-Assistent (4o-mini)</span>
</div>
<button id="assistant-close" class="text-white hover:text-gray-200">
<i class="fas fa-times"></i>
</button>
`;
// Chat-Verlauf
this.chatHistory = document.createElement('div');
this.chatHistory.id = 'assistant-history';
this.chatHistory.className = 'p-3 overflow-y-auto max-h-96 space-y-3';
// Vorschlagsbereich
this.suggestionArea = document.createElement('div');
this.suggestionArea.id = 'assistant-suggestions';
this.suggestionArea.className = 'px-3 pb-2 flex flex-wrap gap-2 overflow-x-auto hidden';
// Chat-Eingabe
const inputContainer = document.createElement('div');
inputContainer.className = 'border-t border-gray-200 dark:border-dark-600 p-3 flex items-center';
this.inputField = document.createElement('input');
this.inputField.type = 'text';
this.inputField.placeholder = 'Stelle eine Frage zur Wissensdatenbank...';
this.inputField.className = 'flex-1 border border-gray-300 dark:border-dark-600 dark:bg-dark-700 dark:text-white rounded-l-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500';
const sendButton = document.createElement('button');
sendButton.id = 'assistant-send';
sendButton.className = 'bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-r-lg';
sendButton.innerHTML = '<i class="fas fa-paper-plane"></i>';
// Elemente zusammenfügen
inputContainer.appendChild(this.inputField);
inputContainer.appendChild(sendButton);
chatContainer.appendChild(header);
chatContainer.appendChild(this.chatHistory);
chatContainer.appendChild(this.suggestionArea);
chatContainer.appendChild(inputContainer);
this.container.appendChild(toggleButton);
this.container.appendChild(chatContainer);
// Zum DOM hinzufügen
document.body.appendChild(this.container);
}
/**
* Richtet Event-Listener für die Benutzeroberfläche ein
*/
setupEventListeners() {
// Toggle-Button
const toggleButton = document.getElementById('assistant-toggle');
if (toggleButton) {
toggleButton.addEventListener('click', () => this.toggleAssistant());
}
// Schließen-Button
const closeButton = document.getElementById('assistant-close');
if (closeButton) {
closeButton.addEventListener('click', () => this.toggleAssistant(false));
}
// Senden-Button
const sendButton = document.getElementById('assistant-send');
if (sendButton) {
sendButton.addEventListener('click', () => this.sendMessage());
}
// Enter-Taste im Eingabefeld
if (this.inputField) {
this.inputField.addEventListener('keyup', (e) => {
if (e.key === 'Enter') {
this.sendMessage();
}
});
}
// Vorschläge klickbar machen
if (this.suggestionArea) {
this.suggestionArea.addEventListener('click', (e) => {
if (e.target.classList.contains('suggestion-pill')) {
this.inputField.value = e.target.textContent;
this.sendMessage();
}
});
}
}
/**
* Öffnet oder schließt den Assistenten
* @param {boolean} state - Optional: erzwingt einen bestimmten Zustand
*/
toggleAssistant(state = null) {
const chatContainer = document.getElementById('assistant-chat');
if (!chatContainer) return;
this.isOpen = state !== null ? state : !this.isOpen;
if (this.isOpen) {
chatContainer.classList.remove('max-h-0', 'opacity-0');
chatContainer.classList.add('max-h-[32rem]', 'opacity-100');
if (this.inputField) this.inputField.focus();
// Zeige Vorschläge wenn verfügbar
if (this.suggestionArea && this.suggestionArea.children.length > 0) {
this.suggestionArea.classList.remove('hidden');
}
} else {
chatContainer.classList.remove('max-h-[32rem]', 'opacity-100');
chatContainer.classList.add('max-h-0', 'opacity-0');
}
}
/**
* Fügt eine Nachricht zum Chat-Verlauf hinzu
* @param {string} sender - 'user' oder 'assistant'
* @param {string} text - Nachrichtentext
*/
addMessage(sender, text) {
// Nachricht zum Verlauf hinzufügen
this.messages.push({ role: sender, content: text });
// DOM-Element erstellen
const messageEl = document.createElement('div');
messageEl.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
const bubble = document.createElement('div');
bubble.className = sender === 'user'
? 'bg-primary-100 dark:bg-primary-900 text-gray-800 dark:text-white rounded-lg py-2 px-3 max-w-[85%]'
: 'bg-gray-100 dark:bg-dark-700 text-gray-800 dark:text-white rounded-lg py-2 px-3 max-w-[85%]';
// Formatierung des Texts (mit Markdown für Assistent-Nachrichten)
let formattedText = '';
if (sender === 'assistant' && this.markdownParser) {
// Für Assistentnachrichten Markdown verwenden
try {
formattedText = this.markdownParser.parse(text);
// CSS für Markdown-Formatierung hinzufügen
const markdownStyles = `
.markdown-bubble h1, .markdown-bubble h2, .markdown-bubble h3,
.markdown-bubble h4, .markdown-bubble h5, .markdown-bubble h6 {
font-weight: bold;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.markdown-bubble h1 { font-size: 1.4rem; }
.markdown-bubble h2 { font-size: 1.3rem; }
.markdown-bubble h3 { font-size: 1.2rem; }
.markdown-bubble h4 { font-size: 1.1rem; }
.markdown-bubble ul, .markdown-bubble ol {
padding-left: 1.5rem;
margin: 0.5rem 0;
}
.markdown-bubble ul { list-style-type: disc; }
.markdown-bubble ol { list-style-type: decimal; }
.markdown-bubble p { margin: 0.5rem 0; }
.markdown-bubble code {
font-family: monospace;
background-color: rgba(0, 0, 0, 0.1);
padding: 1px 4px;
border-radius: 3px;
}
.markdown-bubble pre {
background-color: rgba(0, 0, 0, 0.1);
padding: 0.5rem;
border-radius: 4px;
overflow-x: auto;
margin: 0.5rem 0;
}
.markdown-bubble pre code {
background-color: transparent;
padding: 0;
}
.markdown-bubble blockquote {
border-left: 3px solid rgba(0, 0, 0, 0.2);
padding-left: 0.8rem;
margin: 0.5rem 0;
font-style: italic;
}
.dark .markdown-bubble code {
background-color: rgba(255, 255, 255, 0.1);
}
.dark .markdown-bubble pre {
background-color: rgba(255, 255, 255, 0.1);
}
.dark .markdown-bubble blockquote {
border-left-color: rgba(255, 255, 255, 0.2);
}
`;
// Füge die Styles hinzu, wenn sie noch nicht vorhanden sind
if (!document.querySelector('#markdown-chat-styles')) {
const style = document.createElement('style');
style.id = 'markdown-chat-styles';
style.textContent = markdownStyles;
document.head.appendChild(style);
}
// Klasse für Markdown-Formatierung hinzufügen
bubble.classList.add('markdown-bubble');
} catch (error) {
console.error('Fehler bei der Markdown-Formatierung:', error);
// Fallback zur einfachen Formatierung
formattedText = text.split('\n').map(line => {
if (line.trim() === '') return '<br>';
return `<p>${line}</p>`;
}).join('');
}
} else {
// Für Benutzernachrichten einfache Formatierung
formattedText = text.split('\n').map(line => {
if (line.trim() === '') return '<br>';
return `<p>${line}</p>`;
}).join('');
}
bubble.innerHTML = formattedText;
messageEl.appendChild(bubble);
if (this.chatHistory) {
this.chatHistory.appendChild(messageEl);
// Scroll zum Ende des Verlaufs
this.chatHistory.scrollTop = this.chatHistory.scrollHeight;
}
}
/**
* Zeigt Vorschläge als klickbare Pills an
* @param {string[]} suggestions - Liste von Vorschlägen
*/
showSuggestions(suggestions) {
if (!this.suggestionArea) return;
// Vorherige Vorschläge entfernen
this.suggestionArea.innerHTML = '';
if (suggestions && suggestions.length > 0) {
suggestions.forEach(suggestion => {
const pill = document.createElement('button');
pill.className = 'suggestion-pill text-sm bg-gray-200 dark:bg-dark-600 hover:bg-gray-300 dark:hover:bg-dark-500 text-gray-800 dark:text-gray-200 rounded-full px-3 py-1 mb-2 transition-colors';
pill.textContent = suggestion;
this.suggestionArea.appendChild(pill);
});
this.suggestionArea.classList.remove('hidden');
} else {
this.suggestionArea.classList.add('hidden');
}
}
/**
* Sendet die Benutzernachricht an den Server und zeigt die Antwort an
*/
async sendMessage() {
if (!this.inputField) return;
const userInput = this.inputField.value.trim();
if (!userInput || this.isLoading) return;
// Vorschläge ausblenden
if (this.suggestionArea) {
this.suggestionArea.classList.add('hidden');
}
// Benutzernachricht anzeigen
this.addMessage('user', userInput);
// Eingabefeld zurücksetzen
this.inputField.value = '';
// Ladeindikator anzeigen
this.isLoading = true;
this.showLoadingIndicator();
try {
console.log('Sende Anfrage an KI-Assistent API...');
// Anfrage an den Server senden
const response = await fetch('/api/assistant', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: this.messages
}),
cache: 'no-cache', // Kein Cache verwenden
credentials: 'same-origin' // Cookies senden
});
// Ladeindikator entfernen
this.removeLoadingIndicator();
if (!response.ok) {
throw new Error(`Serverfehler: ${response.status} ${response.statusText}`);
}
const data = await response.json();
console.log('Antwort erhalten:', data);
// Antwort anzeigen
if (data.response) {
this.addMessage('assistant', data.response);
// Neue Vorschläge basierend auf dem aktuellen Kontext anzeigen
this.generateContextualSuggestions();
// Erfolgreiche Anfrage zurücksetzen
this.retryCount = 0;
} else if (data.error) {
this.addMessage('assistant', `Fehler: ${data.error}`);
} else {
throw new Error('Unerwartetes Antwortformat vom Server');
}
} catch (error) {
console.error('Fehler bei der Kommunikation mit dem Assistenten:', error);
// Ladeindikator entfernen, falls noch vorhanden
this.removeLoadingIndicator();
// Fehlermeldung anzeigen oder Wiederholungsversuch starten
if (this.retryCount < this.maxRetries) {
this.retryCount++;
this.addMessage('assistant', 'Es gab ein Problem mit der Anfrage. Ich versuche es erneut...');
// Kurze Verzögerung vor dem erneuten Versuch
setTimeout(() => {
// Letzte Benutzernachricht aus dem Messages-Array entfernen
const lastUserMessage = this.messages[this.messages.length - 2].content;
this.messages = this.messages.slice(0, -2); // Entferne Benutzernachricht und Fehlermeldung
// Erneuter Versand mit gleicher Nachricht
this.inputField.value = lastUserMessage;
this.sendMessage();
}, 1500);
} else {
// Maximale Anzahl an Wiederholungsversuchen erreicht
this.addMessage('assistant', 'Es tut mir leid, aber es gab ein Problem bei der Verarbeitung deiner Anfrage. Bitte versuche es später noch einmal.');
this.retryCount = 0; // Zurücksetzen für die nächste Anfrage
}
} finally {
this.isLoading = false;
}
}
/**
* Generiert kontextbasierte Vorschläge basierend auf dem aktuellen Chat-Verlauf
*/
generateContextualSuggestions() {
// Basierend auf letzter Antwort des Assistenten, verschiedene Vorschläge generieren
const lastAssistantMessage = this.messages.findLast(msg => msg.role === 'assistant')?.content || '';
let suggestions = [];
// Intelligente Vorschläge basierend auf Kontext
if (lastAssistantMessage.includes('Künstliche Intelligenz') ||
lastAssistantMessage.includes('KI ') ||
lastAssistantMessage.includes('AI ')) {
suggestions = [
"Wie wird KI in der Wissenschaft eingesetzt?",
"Zeige mir Gedanken zum maschinellen Lernen",
"Was ist der Unterschied zwischen KI und ML?"
];
} else if (lastAssistantMessage.includes('Kategorie') ||
lastAssistantMessage.includes('Kategorien')) {
suggestions = [
"Zeige mir die Unterkategorien",
"Welche Gedanken gehören zu dieser Kategorie?",
"Liste alle Wissenschaftskategorien auf"
];
} else if (lastAssistantMessage.includes('Mindmap') ||
lastAssistantMessage.includes('Visualisierung')) {
suggestions = [
"Wie kann ich eine eigene Mindmap erstellen?",
"Zeige mir Beispiele für Mindmaps",
"Wie funktionieren die Verbindungen in Mindmaps?"
];
} else {
// Standardvorschläge
suggestions = [
"Erzähle mir mehr dazu",
"Gibt es Beispiele dafür?",
"Wie kann ich diese Information nutzen?"
];
}
this.showSuggestions(suggestions);
}
/**
* Zeigt einen Ladeindikator im Chat an
*/
showLoadingIndicator() {
if (!this.chatHistory) return;
// Entferne vorhandenen Ladeindikator (falls vorhanden)
this.removeLoadingIndicator();
const loadingEl = document.createElement('div');
loadingEl.id = 'assistant-loading';
loadingEl.className = 'flex justify-start';
const bubble = document.createElement('div');
bubble.className = 'bg-gray-100 dark:bg-dark-700 text-gray-800 dark:text-white rounded-lg py-2 px-3';
bubble.innerHTML = '<div class="typing-indicator"><span></span><span></span><span></span></div>';
loadingEl.appendChild(bubble);
this.chatHistory.appendChild(loadingEl);
// Scroll zum Ende des Verlaufs
this.chatHistory.scrollTop = this.chatHistory.scrollHeight;
}
/**
* Entfernt den Ladeindikator aus dem Chat
*/
removeLoadingIndicator() {
const loadingIndicator = document.getElementById('assistant-loading');
if (loadingIndicator) {
loadingIndicator.remove();
}
}
/**
* Öffnet den Assistenten und sendet eine vorgegebene Frage
* @param {string} question - Die zu stellende Frage
*/
async sendQuestion(question) {
if (!question || this.isLoading) return;
// Assistenten öffnen
this.toggleAssistant(true);
// Kurze Verzögerung, um sicherzustellen, dass der UI vollständig geöffnet ist
await new Promise(resolve => setTimeout(resolve, 300));
// Frage in Eingabefeld setzen
if (this.inputField) {
this.inputField.value = question;
// Sende die Frage
this.sendMessage();
}
}
}
// Mache die Klasse global verfügbar
window.ChatGPTAssistant = ChatGPTAssistant;

View File

@@ -0,0 +1,768 @@
/**
* Mindmap-Seite JavaScript
* Spezifische Funktionen für die Mindmap-Seite
*/
// Füge das Modul zum globalen MindMap-Objekt hinzu
if (!window.MindMap) {
window.MindMap = {};
}
// Registriere den Initialisierer im MindMap-Objekt
if (window.MindMap) {
window.MindMap.pageInitializers = window.MindMap.pageInitializers || {};
window.MindMap.pageInitializers.mindmap = initMindmapPage;
}
document.addEventListener('DOMContentLoaded', function() {
// Prüfe, ob wir auf der Mindmap-Seite sind und initialisiere
if (document.body.dataset.page === 'mindmap') {
initMindmapPage();
}
});
/**
* Initialisiert die Mindmap-Seite
*/
function initMindmapPage() {
console.log('Mindmap-Seite Initialisierung startet...');
console.log('D3 Bibliothek verfügbar:', typeof d3 !== 'undefined');
console.log('MindMapVisualization verfügbar:', typeof MindMapVisualization !== 'undefined');
const mindmapContainer = document.getElementById('mindmap-container');
const thoughtsContainer = document.getElementById('thoughts-container');
if (!mindmapContainer) {
console.error('Mindmap-Container nicht gefunden!');
return;
}
console.log('Mindmap-Container gefunden:', mindmapContainer);
// Prüfe, ob D3.js geladen ist
if (typeof d3 === 'undefined') {
console.error('D3.js ist nicht geladen!');
mindmapContainer.innerHTML = `
<div class="glass-effect p-6 text-center">
<div class="text-red-500 mb-4">
<i class="fa-solid fa-triangle-exclamation text-4xl"></i>
</div>
<p class="text-xl">D3.js konnte nicht geladen werden. Bitte laden Sie die Seite neu.</p>
</div>
`;
return;
}
// Prüfe, ob MindMapVisualization definiert ist
if (typeof MindMapVisualization === 'undefined') {
console.error('MindMapVisualization-Klasse ist nicht definiert!');
mindmapContainer.innerHTML = `
<div class="glass-effect p-6 text-center">
<div class="text-red-500 mb-4">
<i class="fa-solid fa-triangle-exclamation text-4xl"></i>
</div>
<p class="text-xl">MindMap-Visualisierung konnte nicht geladen werden. Bitte laden Sie die Seite neu.</p>
</div>
`;
return;
}
// Erstelle die Mindmap-Visualisierung
try {
console.log('Versuche, MindMapVisualization zu erstellen...');
const mindmap = new MindMapVisualization('#mindmap-container', {
height: 600,
onNodeClick: handleNodeClick
});
// Globale Referenz für die Zoom-Buttons erstellen
window.mindmapInstance = mindmap;
// Lade die Mindmap-Daten
mindmap.loadData();
console.log('MindMapVisualization erfolgreich erstellt und geladen');
} catch (error) {
console.error('Fehler beim Erstellen der MindMapVisualization:', error);
mindmapContainer.innerHTML = `
<div class="glass-effect p-6 text-center">
<div class="text-red-500 mb-4">
<i class="fa-solid fa-triangle-exclamation text-4xl"></i>
</div>
<p class="text-xl">Fehler beim Erstellen der Mindmap-Visualisierung:</p>
<p class="text-md mt-2">${error.message}</p>
</div>
`;
return;
}
// Suchfunktion für die Mindmap
const searchInput = document.getElementById('mindmap-search');
if (searchInput) {
searchInput.addEventListener('input', function(e) {
mindmap.filterBySearchTerm(e.target.value);
});
}
/**
* Behandelt Klicks auf Mindmap-Knoten
*/
async function handleNodeClick(node) {
if (!thoughtsContainer) return;
// Zeige Lade-Animation
thoughtsContainer.innerHTML = `
<div class="flex justify-center items-center p-12">
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-400"></div>
</div>
`;
try {
// Lade Gedanken für den ausgewählten Knoten
const response = await fetch(`/api/nodes/${node.id}/thoughts`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const thoughts = await response.json();
// Gedanken anzeigen
renderThoughts(thoughts, node.name);
} catch (error) {
console.error('Fehler beim Laden der Gedanken:', error);
thoughtsContainer.innerHTML = `
<div class="glass-effect p-6 text-center">
<div class="text-red-500 mb-4">
<i class="fa-solid fa-triangle-exclamation text-4xl"></i>
</div>
<p class="text-xl">Fehler beim Laden der Gedanken.</p>
<p class="text-gray-300">Bitte versuchen Sie es später erneut.</p>
</div>
`;
}
}
/**
* Rendert die Gedanken in den Container
*/
function renderThoughts(thoughts, nodeName) {
// Wenn keine Gedanken vorhanden sind
if (thoughts.length === 0) {
thoughtsContainer.innerHTML = `
<div class="glass-effect p-6 text-center">
<div class="text-blue-400 mb-4">
<i class="fa-solid fa-info-circle text-4xl"></i>
</div>
<p class="text-xl">Keine Gedanken für "${nodeName}" vorhanden.</p>
<button id="add-thought-btn" class="btn-primary mt-4">
<i class="fa-solid fa-plus mr-2"></i> Gedanke hinzufügen
</button>
</div>
`;
// Event-Listener für den Button
document.getElementById('add-thought-btn').addEventListener('click', () => {
openAddThoughtModal(nodeName);
});
return;
}
// Gedanken anzeigen
thoughtsContainer.innerHTML = `
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-white">Gedanken zu "${nodeName}"</h2>
<button id="add-thought-btn" class="btn-primary">
<i class="fa-solid fa-plus mr-2"></i> Neuer Gedanke
</button>
</div>
<div class="grid grid-cols-1 gap-4" id="thoughts-grid"></div>
`;
// Button-Event-Listener
document.getElementById('add-thought-btn').addEventListener('click', () => {
openAddThoughtModal(nodeName);
});
// Gedanken-Karten rendern
const thoughtsGrid = document.getElementById('thoughts-grid');
thoughts.forEach((thought, index) => {
const card = createThoughtCard(thought);
// Animation verzögern für gestaffeltes Erscheinen
setTimeout(() => {
card.classList.add('opacity-100');
card.classList.remove('opacity-0', 'translate-y-4');
}, index * 100);
thoughtsGrid.appendChild(card);
});
}
/**
* Erstellt eine Gedanken-Karte
*/
function createThoughtCard(thought) {
const card = document.createElement('div');
card.className = 'card transition-all duration-300 opacity-0 translate-y-4 transform hover:shadow-lg border-l-4';
card.style.borderLeftColor = thought.color_code || '#4080ff';
// Karten-Inhalt
card.innerHTML = `
<div class="p-4">
<div class="flex justify-between items-start">
<h3 class="text-lg font-bold text-white">${thought.title}</h3>
<div class="text-sm text-gray-400">${thought.timestamp}</div>
</div>
<div class="prose dark:prose-invert mt-2">
<p>${thought.content}</p>
</div>
${thought.keywords ? `
<div class="flex flex-wrap gap-1 mt-3">
${thought.keywords.split(',').map(keyword =>
`<span class="px-2 py-1 text-xs rounded-full bg-secondary-700 text-white">${keyword.trim()}</span>`
).join('')}
</div>
` : ''}
<div class="mt-4 flex justify-between items-center">
<div class="text-sm text-gray-400">
<i class="fa-solid fa-user mr-1"></i> ${thought.author}
</div>
<div class="flex space-x-2">
<button class="text-sm px-2 py-1 rounded hover:bg-white/10 transition-colors"
onclick="showComments(${thought.id})">
<i class="fa-solid fa-comments mr-1"></i> Kommentare
</button>
<button class="text-sm px-2 py-1 rounded hover:bg-white/10 transition-colors"
onclick="showRelations(${thought.id})">
<i class="fa-solid fa-diagram-project mr-1"></i> Beziehungen
</button>
</div>
</div>
</div>
`;
return card;
}
/**
* Öffnet das Modal zum Hinzufügen eines neuen Gedankens
*/
function openAddThoughtModal(nodeName) {
// Node-Information extrahieren
let nodeId, nodeTitle;
if (typeof nodeName === 'string') {
// Wenn nur ein String übergeben wurde
nodeTitle = nodeName;
// Versuche nodeId aus der Mindmap zu finden
const nodeElement = d3.selectAll('.node-group').filter(d => d.name === nodeName);
if (nodeElement.size() > 0) {
nodeId = nodeElement.datum().id;
}
} else if (typeof nodeName === 'object') {
// Wenn ein Node-Objekt übergeben wurde
nodeId = nodeName.id;
nodeTitle = nodeName.name;
} else {
console.error('Ungültiger Node-Parameter', nodeName);
return;
}
// Modal-Struktur erstellen
const modal = document.createElement('div');
modal.className = 'fixed inset-0 z-50 flex items-center justify-center p-4';
modal.innerHTML = `
<div class="absolute inset-0 bg-black/50 backdrop-blur-sm" id="modal-backdrop"></div>
<div class="glass-effect relative rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto z-10 transform transition-all">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white flex items-center">
<span class="w-3 h-3 rounded-full bg-primary-400 mr-2"></span>
Neuer Gedanke zu "${nodeTitle}"
</h3>
<button id="close-modal-btn" class="text-gray-400 hover:text-white transition-colors">
<i class="fa-solid fa-xmark text-xl"></i>
</button>
</div>
<form id="add-thought-form" class="space-y-4">
<input type="hidden" id="node_id" name="node_id" value="${nodeId || ''}">
<div>
<label for="title" class="block text-sm font-medium text-gray-300">Titel</label>
<input type="text" id="title" name="title" required
class="mt-1 block w-full rounded-md bg-dark-700 border border-dark-500 text-white p-2.5 focus:ring-2 focus:ring-primary-500 focus:border-transparent">
</div>
<div>
<label for="content" class="block text-sm font-medium text-gray-300">Inhalt</label>
<textarea id="content" name="content" rows="5" required
class="mt-1 block w-full rounded-md bg-dark-700 border border-dark-500 text-white p-2.5 focus:ring-2 focus:ring-primary-500 focus:border-transparent"></textarea>
</div>
<div>
<label for="keywords" class="block text-sm font-medium text-gray-300">Schlüsselwörter (kommagetrennt)</label>
<input type="text" id="keywords" name="keywords"
class="mt-1 block w-full rounded-md bg-dark-700 border border-dark-500 text-white p-2.5 focus:ring-2 focus:ring-primary-500 focus:border-transparent">
</div>
<div>
<label for="abstract" class="block text-sm font-medium text-gray-300">Zusammenfassung (optional)</label>
<textarea id="abstract" name="abstract" rows="2"
class="mt-1 block w-full rounded-md bg-dark-700 border border-dark-500 text-white p-2.5 focus:ring-2 focus:ring-primary-500 focus:border-transparent"></textarea>
</div>
<div>
<label for="color_code" class="block text-sm font-medium text-gray-300">Farbcode</label>
<div class="flex space-x-2 mt-1">
<input type="color" id="color_code" name="color_code" value="#4080ff"
class="h-10 w-10 rounded bg-dark-700 border border-dark-500">
<select id="predefined_colors"
class="block flex-grow rounded-md bg-dark-700 border border-dark-500 text-white p-2.5">
<option value="#4080ff">Blau</option>
<option value="#a040ff">Lila</option>
<option value="#40bf80">Grün</option>
<option value="#ff4080">Rot</option>
<option value="#ffaa00">Orange</option>
<option value="#00ccff">Türkis</option>
</select>
</div>
</div>
<div class="flex justify-between pt-4">
<div class="flex items-center">
<div class="relative">
<button type="button" id="open-relation-btn" class="btn-outline text-sm pl-3 pr-9">
<i class="fa-solid fa-diagram-project mr-2"></i> Verbindung
<i class="fa-solid fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2"></i>
</button>
<div id="relation-menu" class="absolute left-0 mt-2 w-60 rounded-md shadow-lg bg-dark-800 ring-1 ring-black ring-opacity-5 z-10 hidden">
<div class="py-1">
<div class="px-3 py-2 text-xs font-semibold text-gray-400 border-b border-dark-600">BEZIEHUNGSTYPEN</div>
<div class="max-h-48 overflow-y-auto">
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="supports">
<i class="fa-solid fa-circle-arrow-up text-green-400 mr-2"></i> Stützt
</button>
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="contradicts">
<i class="fa-solid fa-circle-arrow-down text-red-400 mr-2"></i> Widerspricht
</button>
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="builds_upon">
<i class="fa-solid fa-arrow-right text-blue-400 mr-2"></i> Baut auf auf
</button>
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="generalizes">
<i class="fa-solid fa-arrow-up-wide-short text-purple-400 mr-2"></i> Verallgemeinert
</button>
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="specifies">
<i class="fa-solid fa-arrow-down-wide-short text-yellow-400 mr-2"></i> Spezifiziert
</button>
<button type="button" class="relation-type-btn w-full text-left px-4 py-2 text-sm text-white hover:bg-dark-600" data-type="inspires">
<i class="fa-solid fa-lightbulb text-amber-400 mr-2"></i> Inspiriert
</button>
</div>
</div>
</div>
</div>
<input type="hidden" id="relation_type" name="relation_type" value="">
<input type="hidden" id="relation_target" name="relation_target" value="">
</div>
<div class="flex space-x-3">
<button type="button" id="cancel-btn" class="btn-outline">Abbrechen</button>
<button type="submit" class="btn-primary">
<i class="fa-solid fa-save mr-2"></i> Speichern
</button>
</div>
</div>
</form>
</div>
</div>
`;
document.body.appendChild(modal);
// Focus auf das erste Feld setzen
setTimeout(() => {
modal.querySelector('#title').focus();
}, 100);
// Event-Listener hinzufügen
modal.querySelector('#modal-backdrop').addEventListener('click', closeModal);
modal.querySelector('#close-modal-btn').addEventListener('click', closeModal);
modal.querySelector('#cancel-btn').addEventListener('click', closeModal);
// Farbauswahl-Event-Listener
const colorInput = modal.querySelector('#color_code');
const predefinedColors = modal.querySelector('#predefined_colors');
predefinedColors.addEventListener('change', function() {
colorInput.value = this.value;
});
// Beziehungsmenü-Funktionalität
const relationBtn = modal.querySelector('#open-relation-btn');
const relationMenu = modal.querySelector('#relation-menu');
relationBtn.addEventListener('click', function() {
relationMenu.classList.toggle('hidden');
});
// Klick außerhalb des Menüs schließt es
document.addEventListener('click', function(event) {
if (!relationBtn.contains(event.target) && !relationMenu.contains(event.target)) {
relationMenu.classList.add('hidden');
}
});
// Beziehungstyp-Auswahl
const relationTypeBtns = modal.querySelectorAll('.relation-type-btn');
const relationTypeInput = modal.querySelector('#relation_type');
relationTypeBtns.forEach(btn => {
btn.addEventListener('click', function() {
const relationType = this.dataset.type;
relationTypeInput.value = relationType;
// Sichtbare Anzeige aktualisieren
relationBtn.innerHTML = `
<i class="fa-solid fa-diagram-project mr-2"></i>
${this.innerText.trim()}
<i class="fa-solid fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2"></i>
`;
// Menü schließen
relationMenu.classList.add('hidden');
});
});
// Form-Submit-Handler
const form = modal.querySelector('#add-thought-form');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData(form);
const thoughtData = {
node_id: formData.get('node_id'),
title: formData.get('title'),
content: formData.get('content'),
keywords: formData.get('keywords'),
abstract: formData.get('abstract'),
color_code: formData.get('color_code'),
relation_type: formData.get('relation_type'),
relation_target: formData.get('relation_target')
};
try {
const response = await fetch('/api/thoughts', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(thoughtData)
});
if (!response.ok) {
throw new Error('Fehler beim Speichern des Gedankens.');
}
// Modal schließen
closeModal();
// Gedanken neu laden
if (nodeId) {
handleNodeClick({ id: nodeId, name: nodeTitle });
}
// Erfolgsbenachrichtigung
if (window.MindMap && window.MindMap.showNotification) {
window.MindMap.showNotification('Gedanke erfolgreich gespeichert.', 'success');
}
} catch (error) {
console.error('Fehler beim Speichern:', error);
if (window.MindMap && window.MindMap.showNotification) {
window.MindMap.showNotification('Fehler beim Speichern des Gedankens.', 'error');
}
}
});
// Modal schließen
function closeModal() {
modal.classList.add('opacity-0');
setTimeout(() => {
modal.remove();
}, 300);
}
}
}
/**
* Füge globale Funktionen für das Mindmap-Objekt hinzu
*/
window.showComments = async function(thoughtId) {
try {
// Lade-Animation erstellen
const modal = createModalWithLoading('Kommentare werden geladen...');
document.body.appendChild(modal);
// Kommentare laden
const response = await fetch(`/api/comments/${thoughtId}`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const comments = await response.json();
// Modal mit Kommentaren aktualisieren
updateModalWithComments(modal, comments, thoughtId);
} catch (error) {
console.error('Fehler beim Laden der Kommentare:', error);
if (window.MindMap && window.MindMap.showNotification) {
window.MindMap.showNotification('Fehler beim Laden der Kommentare.', 'error');
} else {
alert('Fehler beim Laden der Kommentare.');
}
}
};
/**
* Zeigt die Beziehungen eines Gedankens an
*/
window.showRelations = async function(thoughtId) {
try {
// Lade-Animation erstellen
const modal = createModalWithLoading('Beziehungen werden geladen...');
document.body.appendChild(modal);
// Beziehungen laden
const response = await fetch(`/api/thoughts/${thoughtId}/relations`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const relations = await response.json();
// Modal mit Beziehungen aktualisieren
updateModalWithRelations(modal, relations, thoughtId);
} catch (error) {
console.error('Fehler beim Laden der Beziehungen:', error);
if (window.MindMap && window.MindMap.showNotification) {
window.MindMap.showNotification('Fehler beim Laden der Beziehungen.', 'error');
} else {
alert('Fehler beim Laden der Beziehungen.');
}
}
};
/**
* Erstellt ein Modal mit Lade-Animation
*/
function createModalWithLoading(loadingText) {
const modal = document.createElement('div');
modal.className = 'fixed inset-0 z-50 flex items-center justify-center p-4';
modal.innerHTML = `
<div class="absolute inset-0 bg-black/50" id="modal-backdrop"></div>
<div class="glass-effect relative rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto z-10">
<div class="p-6 text-center">
<div class="flex justify-center mb-4">
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-400"></div>
</div>
<p class="text-lg text-white">${loadingText}</p>
</div>
</div>
`;
// Event-Listener zum Schließen
modal.querySelector('#modal-backdrop').addEventListener('click', () => {
modal.remove();
});
return modal;
}
/**
* Aktualisiert das Modal mit Kommentaren
*/
function updateModalWithComments(modal, comments, thoughtId) {
const modalContent = modal.querySelector('.glass-effect');
modalContent.innerHTML = `
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white">Kommentare</h3>
<button id="close-modal-btn" class="text-gray-400 hover:text-white">
<i class="fa-solid fa-xmark text-xl"></i>
</button>
</div>
<div class="comments-list mb-6 space-y-4">
${comments.length === 0 ?
'<div class="text-center text-gray-400 py-4">Keine Kommentare vorhanden.</div>' :
comments.map(comment => `
<div class="glass-effect p-3 rounded">
<div class="flex justify-between items-start">
<div class="font-medium text-white">${comment.author}</div>
<div class="text-xs text-gray-400">${comment.timestamp}</div>
</div>
<p class="mt-2 text-gray-200">${comment.content}</p>
</div>
`).join('')
}
</div>
<form id="comment-form" class="space-y-3">
<div>
<label for="comment-content" class="block text-sm font-medium text-gray-300">Neuer Kommentar</label>
<textarea id="comment-content" name="content" rows="3" required
class="mt-1 block w-full rounded-md bg-dark-700 border-dark-500 text-white"></textarea>
</div>
<div class="flex justify-end pt-2">
<button type="submit" class="btn-primary">
<i class="fa-solid fa-paper-plane mr-2"></i> Senden
</button>
</div>
</form>
</div>
`;
// Event-Listener hinzufügen
modalContent.querySelector('#close-modal-btn').addEventListener('click', () => {
modal.remove();
});
// Kommentar-Formular
const form = modalContent.querySelector('#comment-form');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const content = form.elements.content.value;
try {
const response = await fetch('/api/comments', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
thought_id: thoughtId,
content: content
})
});
if (!response.ok) {
throw new Error('Fehler beim Speichern des Kommentars.');
}
// Modal schließen
modal.remove();
// Erfolgsbenachrichtigung
MindMap.showNotification('Kommentar erfolgreich gespeichert.', 'success');
} catch (error) {
console.error('Fehler beim Speichern des Kommentars:', error);
MindMap.showNotification('Fehler beim Speichern des Kommentars.', 'error');
}
});
}
/**
* Aktualisiert das Modal mit Beziehungen
*/
function updateModalWithRelations(modal, relations, thoughtId) {
const modalContent = modal.querySelector('.glass-effect');
modalContent.innerHTML = `
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white">Beziehungen</h3>
<button id="close-modal-btn" class="text-gray-400 hover:text-white">
<i class="fa-solid fa-xmark text-xl"></i>
</button>
</div>
<div class="relations-list mb-6 space-y-4">
${relations.length === 0 ?
'<div class="text-center text-gray-400 py-4">Keine Beziehungen vorhanden.</div>' :
relations.map(relation => `
<div class="glass-effect p-3 rounded">
<div class="flex items-center">
<span class="inline-block px-2 py-1 rounded-full text-xs font-medium bg-primary-600 text-white">
${relation.relation_type}
</span>
<div class="ml-3">
<div class="text-white">Ziel: Gedanke #${relation.target_id}</div>
<div class="text-xs text-gray-400">Erstellt von ${relation.created_by} am ${relation.created_at}</div>
</div>
</div>
</div>
`).join('')
}
</div>
<form id="relation-form" class="space-y-3">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="target_id" class="block text-sm font-medium text-gray-300">Ziel-Gedanke ID</label>
<input type="number" id="target_id" name="target_id" required
class="mt-1 block w-full rounded-md bg-dark-700 border-dark-500 text-white">
</div>
<div>
<label for="relation_type" class="block text-sm font-medium text-gray-300">Beziehungstyp</label>
<select id="relation_type" name="relation_type" required
class="mt-1 block w-full rounded-md bg-dark-700 border-dark-500 text-white">
<option value="SUPPORTS">Stützt</option>
<option value="CONTRADICTS">Widerspricht</option>
<option value="BUILDS_UPON">Baut auf auf</option>
<option value="GENERALIZES">Verallgemeinert</option>
<option value="SPECIFIES">Spezifiziert</option>
<option value="INSPIRES">Inspiriert</option>
</select>
</div>
</div>
<div class="flex justify-end pt-2">
<button type="submit" class="btn-primary">
<i class="fa-solid fa-plus mr-2"></i> Beziehung erstellen
</button>
</div>
</form>
</div>
`;
// Event-Listener hinzufügen
modalContent.querySelector('#close-modal-btn').addEventListener('click', () => {
modal.remove();
});
// Beziehungs-Formular
const form = modalContent.querySelector('#relation-form');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const formData = {
source_id: thoughtId,
target_id: parseInt(form.elements.target_id.value),
relation_type: form.elements.relation_type.value
};
try {
const response = await fetch('/api/relations', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
});
if (!response.ok) {
throw new Error('Fehler beim Erstellen der Beziehung.');
}
// Modal schließen
modal.remove();
// Erfolgsbenachrichtigung
MindMap.showNotification('Beziehung erfolgreich erstellt.', 'success');
} catch (error) {
console.error('Fehler beim Erstellen der Beziehung:', error);
MindMap.showNotification('Fehler beim Erstellen der Beziehung.', 'error');
}
});
}

View File

@@ -0,0 +1,824 @@
/**
* MindMap D3.js Modul
* Visualisiert die Mindmap mit D3.js
*/
class MindMapVisualization {
constructor(containerSelector, options = {}) {
this.containerSelector = containerSelector;
this.container = d3.select(containerSelector);
this.width = options.width || this.container.node().clientWidth || 800;
this.height = options.height || 600;
this.nodeRadius = options.nodeRadius || 14;
this.selectedNodeRadius = options.selectedNodeRadius || 20;
this.linkDistance = options.linkDistance || 150;
this.chargeStrength = options.chargeStrength || -900;
this.centerForce = options.centerForce || 0.15;
this.onNodeClick = options.onNodeClick || ((node) => console.log('Node clicked:', node));
this.nodes = [];
this.links = [];
this.simulation = null;
this.svg = null;
this.linkElements = null;
this.nodeElements = null;
this.textElements = null;
this.tooltipEnabled = options.tooltipEnabled !== undefined ? options.tooltipEnabled : true;
this.mouseoverNode = null;
this.selectedNode = null;
this.zoomFactor = 1;
this.tooltipDiv = null;
this.isLoading = true;
// Lade die gemerkten Knoten
this.bookmarkedNodes = this.loadBookmarkedNodes();
// Sicherstellen, dass der Container bereit ist
if (this.container.node()) {
this.init();
this.setupDefaultNodes();
// Sofortige Datenladung
window.setTimeout(() => {
this.loadData();
}, 100);
} else {
console.error('Mindmap-Container nicht gefunden:', containerSelector);
}
}
// Standardknoten als Fallback einrichten, falls die API nicht reagiert
setupDefaultNodes() {
// Basis-Mindmap mit Hauptthemen
const defaultNodes = [
{ id: "root", name: "Wissen", description: "Zentrale Wissensbasis", thought_count: 0 },
{ id: "philosophy", name: "Philosophie", description: "Philosophisches Denken", thought_count: 0 },
{ id: "science", name: "Wissenschaft", description: "Wissenschaftliche Erkenntnisse", thought_count: 0 },
{ id: "technology", name: "Technologie", description: "Technologische Entwicklungen", thought_count: 0 },
{ id: "arts", name: "Künste", description: "Künstlerische Ausdrucksformen", thought_count: 0 }
];
const defaultLinks = [
{ source: "root", target: "philosophy" },
{ source: "root", target: "science" },
{ source: "root", target: "technology" },
{ source: "root", target: "arts" }
];
// Als Fallback verwenden, falls die API fehlschlägt
this.defaultNodes = defaultNodes;
this.defaultLinks = defaultLinks;
}
init() {
// SVG erstellen, wenn noch nicht vorhanden
if (!this.svg) {
// Container zuerst leeren
this.container.html('');
this.svg = this.container
.append('svg')
.attr('width', '100%')
.attr('height', this.height)
.attr('viewBox', `0 0 ${this.width} ${this.height}`)
.attr('class', 'mindmap-svg')
.call(
d3.zoom()
.scaleExtent([0.1, 5])
.on('zoom', (event) => {
this.handleZoom(event.transform);
})
);
// Hauptgruppe für alles, was zoom-transformierbar ist
this.g = this.svg.append('g');
// Tooltip initialisieren
if (!d3.select('body').select('.node-tooltip').size()) {
this.tooltipDiv = d3.select('body')
.append('div')
.attr('class', 'node-tooltip')
.style('opacity', 0)
.style('position', 'absolute')
.style('pointer-events', 'none')
.style('background', 'rgba(20, 20, 40, 0.9)')
.style('color', '#ffffff')
.style('border', '1px solid rgba(160, 80, 255, 0.2)')
.style('border-radius', '6px')
.style('padding', '8px 12px')
.style('font-size', '14px')
.style('max-width', '250px')
.style('box-shadow', '0 10px 25px rgba(0, 0, 0, 0.5), 0 0 10px rgba(160, 80, 255, 0.2)');
} else {
this.tooltipDiv = d3.select('body').select('.node-tooltip');
}
}
// Force-Simulation initialisieren
this.simulation = d3.forceSimulation()
.force('link', d3.forceLink().id(d => d.id).distance(this.linkDistance))
.force('charge', d3.forceManyBody().strength(this.chargeStrength))
.force('center', d3.forceCenter(this.width / 2, this.height / 2).strength(this.centerForce))
.force('collision', d3.forceCollide().radius(this.nodeRadius * 2));
// Globale Mindmap-Instanz für externe Zugriffe setzen
window.mindmapInstance = this;
}
handleZoom(transform) {
this.g.attr('transform', transform);
this.zoomFactor = transform.k;
// Knotengröße anpassen, um bei Zoom lesbar zu bleiben
if (this.nodeElements) {
this.nodeElements
.attr('r', d => (d === this.selectedNode ? this.selectedNodeRadius : this.nodeRadius) / Math.sqrt(transform.k));
}
// Textgröße anpassen
if (this.textElements) {
this.textElements
.style('font-size', `${12 / Math.sqrt(transform.k)}px`);
}
}
async loadData() {
try {
// Ladeindikator anzeigen
this.showLoading();
// Verwende sofort die Standarddaten für eine schnelle erste Anzeige
this.nodes = [...this.defaultNodes];
this.links = [...this.defaultLinks];
// Visualisierung sofort aktualisieren
this.isLoading = false;
this.updateVisualization();
// Status auf bereit setzen - don't wait for API
this.container.attr('data-status', 'ready');
// API-Aufruf mit kürzerem Timeout im Hintergrund durchführen
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 Sekunden Timeout
const response = await fetch('/api/mindmap', {
signal: controller.signal,
headers: {
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
}
});
clearTimeout(timeoutId);
if (!response.ok) {
console.warn(`HTTP Fehler: ${response.status}, versuche erneute Verbindung`);
// Bei Verbindungsfehler versuchen, die Verbindung neu herzustellen
const retryResponse = await fetch('/api/refresh-mindmap', {
headers: {
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
}
});
if (!retryResponse.ok) {
throw new Error(`Retry failed with status: ${retryResponse.status}`);
}
const retryData = await retryResponse.json();
if (!retryData.success || !retryData.nodes || retryData.nodes.length === 0) {
console.warn('Keine Mindmap-Daten nach Neuversuch, verwende weiterhin Standard-Daten.');
return; // Keep using default data
}
// Flache Liste von Knoten und Verbindungen erstellen
this.nodes = [];
this.links = [];
// Knoten direkt übernehmen
retryData.nodes.forEach(node => {
this.nodes.push({
id: node.id,
name: node.name,
description: node.description || '',
thought_count: node.thought_count || 0,
color: this.generateColorFromString(node.name),
});
// Verbindungen hinzufügen
if (node.connections && node.connections.length > 0) {
node.connections.forEach(conn => {
this.links.push({
source: node.id,
target: conn.target
});
});
}
});
// Visualisierung aktualisieren mit den tatsächlichen Daten
this.updateVisualization();
return;
}
const data = await response.json();
if (!data || !data.nodes || data.nodes.length === 0) {
console.warn('Keine Mindmap-Daten vorhanden, verwende weiterhin Standard-Daten.');
return; // Keep using default data
}
// Flache Liste von Knoten und Verbindungen erstellen
this.nodes = [];
this.links = [];
this.processHierarchicalData(data.nodes);
// Visualisierung aktualisieren mit den tatsächlichen Daten
this.updateVisualization();
} catch (error) {
console.warn('Fehler beim Laden der Mindmap-Daten, verwende Standarddaten:', error);
// Already using default data, no action needed
}
} catch (error) {
console.error('Kritischer Fehler bei der Mindmap-Darstellung:', error);
this.showError('Fehler beim Laden der Mindmap-Daten. Bitte laden Sie die Seite neu.');
this.container.attr('data-status', 'error');
}
}
showLoading() {
// Element nur leeren, wenn es noch kein SVG enthält
if (!this.container.select('svg').size()) {
this.container.html(`
<div class="flex justify-center items-center h-full">
<div class="text-center">
<div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-primary-400 mx-auto mb-4"></div>
<p class="text-lg text-white">Mindmap wird geladen...</p>
</div>
</div>
`);
}
}
processHierarchicalData(hierarchicalNodes, parentId = null) {
hierarchicalNodes.forEach(node => {
// Knoten hinzufügen, wenn noch nicht vorhanden
if (!this.nodes.find(n => n.id === node.id)) {
this.nodes.push({
id: node.id,
name: node.name,
description: node.description || '',
thought_count: node.thought_count || 0,
color: this.generateColorFromString(node.name),
});
}
// Verbindung zum Elternknoten hinzufügen
if (parentId !== null) {
this.links.push({
source: parentId,
target: node.id
});
}
// Rekursiv für Kindknoten aufrufen
if (node.children && node.children.length > 0) {
this.processHierarchicalData(node.children, node.id);
}
});
}
generateColorFromString(str) {
// Erzeugt eine deterministische Farbe basierend auf dem String
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
// Verwende deterministische Farbe aus unserem Farbschema
const colors = [
'#4080ff', // primary-400
'#a040ff', // secondary-400
'#205cf5', // primary-500
'#8020f5', // secondary-500
'#1040e0', // primary-600
'#6010e0', // secondary-600
];
return colors[Math.abs(hash) % colors.length];
}
updateVisualization() {
// Starte die Visualisierung nur, wenn nicht mehr im Ladezustand
if (this.isLoading) return;
// Container leeren, wenn Diagramm neu erstellt wird
if (!this.svg) {
this.container.html('');
this.init();
}
// Performance-Optimierung: Deaktiviere Transition während des Datenladens
const useTransitions = false;
// Links (Edges) erstellen
this.linkElements = this.g.selectAll('.link')
.data(this.links)
.join(
enter => enter.append('line')
.attr('class', 'link')
.attr('stroke', '#ffffff30')
.attr('stroke-width', 2)
.attr('stroke-dasharray', d => d.relation_type === 'contradicts' ? '5,5' : null)
.attr('marker-end', d => d.relation_type === 'builds_upon' ? 'url(#arrowhead)' : null),
update => update
.attr('stroke', '#ffffff30')
.attr('stroke-dasharray', d => d.relation_type === 'contradicts' ? '5,5' : null)
.attr('marker-end', d => d.relation_type === 'builds_upon' ? 'url(#arrowhead)' : null),
exit => exit.remove()
);
// Pfeilspitze für gerichtete Beziehungen hinzufügen (falls noch nicht vorhanden)
if (!this.svg.select('defs').node()) {
const defs = this.svg.append('defs');
defs.append('marker')
.attr('id', 'arrowhead')
.attr('viewBox', '0 -5 10 10')
.attr('refX', 20)
.attr('refY', 0)
.attr('orient', 'auto')
.attr('markerWidth', 6)
.attr('markerHeight', 6)
.append('path')
.attr('d', 'M0,-5L10,0L0,5')
.attr('fill', '#ffffff50');
}
// Simplified Effekte definieren, falls noch nicht vorhanden
if (!this.svg.select('#glow').node()) {
const defs = this.svg.select('defs').size() ? this.svg.select('defs') : this.svg.append('defs');
// Glow-Effekt für Knoten
const filter = defs.append('filter')
.attr('id', 'glow')
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
filter.append('feGaussianBlur')
.attr('stdDeviation', '1')
.attr('result', 'blur');
filter.append('feComposite')
.attr('in', 'SourceGraphic')
.attr('in2', 'blur')
.attr('operator', 'over');
// Blur-Effekt für Schatten
const blurFilter = defs.append('filter')
.attr('id', 'blur')
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
.attr('height', '200%');
blurFilter.append('feGaussianBlur')
.attr('stdDeviation', '1');
}
// Knoten-Gruppe erstellen/aktualisieren
const nodeGroups = this.g.selectAll('.node-group')
.data(this.nodes)
.join(
enter => {
const group = enter.append('g')
.attr('class', 'node-group')
.call(d3.drag()
.on('start', (event, d) => this.dragStarted(event, d))
.on('drag', (event, d) => this.dragged(event, d))
.on('end', (event, d) => this.dragEnded(event, d)));
// Hintergrundschatten für besseren Kontrast
group.append('circle')
.attr('class', 'node-shadow')
.attr('r', d => this.nodeRadius * 1.2)
.attr('fill', 'rgba(0, 0, 0, 0.3)')
.attr('filter', 'url(#blur)');
// Kreis für jeden Knoten
group.append('circle')
.attr('class', d => `node ${this.isNodeBookmarked(d.id) ? 'bookmarked' : ''}`)
.attr('r', this.nodeRadius)
.attr('fill', d => d.color || this.generateColorFromString(d.name))
.attr('stroke', d => this.isNodeBookmarked(d.id) ? '#FFD700' : '#ffffff50')
.attr('stroke-width', d => this.isNodeBookmarked(d.id) ? 3 : 2)
.attr('filter', 'url(#glow)');
// Text-Label mit besserem Kontrast
group.append('text')
.attr('class', 'node-label')
.attr('dy', '0.35em')
.attr('text-anchor', 'middle')
.attr('fill', '#ffffff')
.attr('stroke', 'rgba(0, 0, 0, 0.4)')
.attr('stroke-width', '0.7px')
.attr('paint-order', 'stroke')
.style('font-size', '12px')
.style('font-weight', '500')
.style('pointer-events', 'none')
.text(d => d.name.length > 12 ? d.name.slice(0, 10) + '...' : d.name);
// Interaktivität hinzufügen
group
.on('mouseover', (event, d) => this.nodeMouseover(event, d))
.on('mouseout', (event, d) => this.nodeMouseout(event, d))
.on('click', (event, d) => this.nodeClicked(event, d));
return group;
},
update => {
// Knoten aktualisieren
update.select('.node')
.attr('class', d => `node ${this.isNodeBookmarked(d.id) ? 'bookmarked' : ''}`)
.attr('fill', d => d.color || this.generateColorFromString(d.name))
.attr('stroke', d => this.isNodeBookmarked(d.id) ? '#FFD700' : '#ffffff50')
.attr('stroke-width', d => this.isNodeBookmarked(d.id) ? 3 : 2);
// Text aktualisieren
update.select('.node-label')
.text(d => d.name.length > 12 ? d.name.slice(0, 10) + '...' : d.name);
return update;
},
exit => exit.remove()
);
// Einzelne Elemente für direkten Zugriff speichern
this.nodeElements = this.g.selectAll('.node');
this.textElements = this.g.selectAll('.node-label');
// Performance-Optimierung: Weniger Simulationsschritte für schnellere Stabilisierung
this.simulation
.nodes(this.nodes)
.on('tick', () => this.ticked())
.alpha(0.3) // Reduzierter Wert für schnellere Stabilisierung
.alphaDecay(0.05); // Erhöhter Wert für schnellere Stabilisierung
this.simulation.force('link')
.links(this.links);
// Simulation neu starten
this.simulation.restart();
// Update connection counts
this.updateConnectionCounts();
}
ticked() {
// Linienpositionen aktualisieren
this.linkElements
.attr('x1', d => d.source.x)
.attr('y1', d => d.source.y)
.attr('x2', d => d.target.x)
.attr('y2', d => d.target.y);
// Knotenpositionen aktualisieren
this.g.selectAll('.node-group')
.attr('transform', d => `translate(${d.x}, ${d.y})`);
}
dragStarted(event, d) {
if (!event.active) this.simulation.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}
dragged(event, d) {
d.fx = event.x;
d.fy = event.y;
}
dragEnded(event, d) {
if (!event.active) this.simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}
nodeMouseover(event, d) {
this.mouseoverNode = d;
// Tooltip anzeigen
if (this.tooltipEnabled) {
const isBookmarked = this.isNodeBookmarked(d.id);
const tooltipContent = `
<div class="p-2">
<strong>${d.name}</strong>
${d.description ? `<p class="text-sm text-gray-200 mt-1">${d.description}</p>` : ''}
<div class="text-xs text-gray-300 mt-1">
Gedanken: ${d.thought_count}
</div>
<div class="mt-2">
<button id="bookmark-button" class="px-2 py-1 text-xs rounded bg-gray-700 hover:bg-gray-600 text-white"
data-nodeid="${d.id}">
${isBookmarked ? '<i class="fas fa-bookmark mr-1"></i> Gemerkt' : '<i class="far fa-bookmark mr-1"></i> Merken'}
</button>
</div>
</div>
`;
this.tooltipDiv
.html(tooltipContent)
.style('left', (event.pageX + 10) + 'px')
.style('top', (event.pageY - 10) + 'px')
.transition()
.duration(200)
.style('opacity', 1);
// Event-Listener für den Bookmark-Button hinzufügen
document.getElementById('bookmark-button').addEventListener('click', (e) => {
e.stopPropagation();
const nodeId = e.currentTarget.getAttribute('data-nodeid');
const isNowBookmarked = this.toggleBookmark(nodeId);
// Button-Text aktualisieren
if (isNowBookmarked) {
e.currentTarget.innerHTML = '<i class="fas fa-bookmark mr-1"></i> Gemerkt';
} else {
e.currentTarget.innerHTML = '<i class="far fa-bookmark mr-1"></i> Merken';
}
});
}
// Knoten visuell hervorheben
d3.select(event.currentTarget).select('circle')
.transition()
.duration(200)
.attr('r', this.nodeRadius * 1.2)
.attr('stroke', this.isNodeBookmarked(d.id) ? '#FFD700' : '#ffffff');
}
nodeMouseout(event, d) {
this.mouseoverNode = null;
// Tooltip ausblenden
if (this.tooltipEnabled) {
this.tooltipDiv
.transition()
.duration(200)
.style('opacity', 0);
}
// Knoten-Stil zurücksetzen, wenn nicht ausgewählt
const nodeElement = d3.select(event.currentTarget).select('circle');
if (d !== this.selectedNode) {
const isBookmarked = this.isNodeBookmarked(d.id);
nodeElement
.transition()
.duration(200)
.attr('r', this.nodeRadius)
.attr('stroke', isBookmarked ? '#FFD700' : '#ffffff50')
.attr('stroke-width', isBookmarked ? 3 : 2);
}
}
nodeClicked(event, d) {
// Frühere Auswahl zurücksetzen
if (this.selectedNode && this.selectedNode !== d) {
this.g.selectAll('.node')
.filter(n => n === this.selectedNode)
.transition()
.duration(200)
.attr('r', this.nodeRadius)
.attr('stroke', '#ffffff50');
}
// Neue Auswahl hervorheben
if (this.selectedNode !== d) {
this.selectedNode = d;
d3.select(event.currentTarget).select('circle')
.transition()
.duration(200)
.attr('r', this.selectedNodeRadius)
.attr('stroke', '#ffffff');
}
// Callback mit Node-Daten aufrufen
this.onNodeClick(d);
}
showError(message) {
this.container.html(`
<div class="w-full text-center p-6">
<div class="mb-4 text-red-500">
<i class="fas fa-exclamation-triangle text-4xl"></i>
</div>
<p class="text-lg text-gray-200">${message}</p>
</div>
`);
}
// Fokussiert die Ansicht auf einen bestimmten Knoten
focusNode(nodeId) {
const node = this.nodes.find(n => n.id === nodeId);
if (!node) return;
// Simuliere einen Klick auf den Knoten
const nodeElement = this.g.selectAll('.node-group')
.filter(d => d.id === nodeId);
nodeElement.dispatch('click');
// Zentriere den Knoten in der Ansicht
const transform = d3.zoomIdentity
.translate(this.width / 2, this.height / 2)
.scale(1.2)
.translate(-node.x, -node.y);
this.svg.transition()
.duration(750)
.call(
d3.zoom().transform,
transform
);
}
// Filtert die Mindmap basierend auf einem Suchbegriff
filterBySearchTerm(searchTerm) {
if (!searchTerm || searchTerm.trim() === '') {
// Alle Knoten anzeigen
this.g.selectAll('.node-group')
.style('opacity', 1)
.style('pointer-events', 'all');
this.g.selectAll('.link')
.style('opacity', 1);
return;
}
const searchLower = searchTerm.toLowerCase();
const matchingNodes = this.nodes.filter(node =>
node.name.toLowerCase().includes(searchLower) ||
(node.description && node.description.toLowerCase().includes(searchLower))
);
const matchingNodeIds = new Set(matchingNodes.map(n => n.id));
// Passende Knoten hervorheben, andere ausblenden
this.g.selectAll('.node-group')
.style('opacity', d => matchingNodeIds.has(d.id) ? 1 : 0.2)
.style('pointer-events', d => matchingNodeIds.has(d.id) ? 'all' : 'none');
// Verbindungen zwischen passenden Knoten hervorheben
this.g.selectAll('.link')
.style('opacity', d =>
matchingNodeIds.has(d.source.id) && matchingNodeIds.has(d.target.id) ? 1 : 0.1
);
// Auf den ersten passenden Knoten fokussieren, wenn vorhanden
if (matchingNodes.length > 0) {
this.focusNode(matchingNodes[0].id);
}
}
/**
* Updates the thought_count property for each node based on existing connections
*/
updateConnectionCounts() {
// Reset all counts first
this.nodes.forEach(node => {
// Initialize thought_count if it doesn't exist
if (typeof node.thought_count !== 'number') {
node.thought_count = 0;
}
// Count connections for this node
const connectedNodes = this.getConnectedNodes(node);
node.thought_count = connectedNodes.length;
});
// Update UI to show counts
this.updateNodeLabels();
}
/**
* Updates the visual representation of node labels to include connection counts
*/
updateNodeLabels() {
if (!this.textElements) return;
this.textElements.text(d => {
if (d.thought_count > 0) {
return `${d.name} (${d.thought_count})`;
}
return d.name;
});
}
/**
* Adds a new connection between nodes and updates the counts
*/
addConnection(sourceNode, targetNode) {
if (!sourceNode || !targetNode) return false;
// Check if connection already exists
if (this.isConnected(sourceNode, targetNode)) return false;
// Add new connection
this.links.push({
source: sourceNode.id,
target: targetNode.id
});
// Update counts
this.updateConnectionCounts();
// Update visualization
this.updateVisualization();
return true;
}
// Lädt gemerkete Knoten aus dem LocalStorage
loadBookmarkedNodes() {
try {
const bookmarked = localStorage.getItem('bookmarkedNodes');
return bookmarked ? JSON.parse(bookmarked) : [];
} catch (error) {
console.error('Fehler beim Laden der gemerkten Knoten:', error);
return [];
}
}
// Speichert gemerkete Knoten im LocalStorage
saveBookmarkedNodes() {
try {
localStorage.setItem('bookmarkedNodes', JSON.stringify(this.bookmarkedNodes));
} catch (error) {
console.error('Fehler beim Speichern der gemerkten Knoten:', error);
}
}
// Prüft, ob ein Knoten gemerkt ist
isNodeBookmarked(nodeId) {
return this.bookmarkedNodes.includes(nodeId);
}
// Merkt einen Knoten oder hebt die Markierung auf
toggleBookmark(nodeId) {
const index = this.bookmarkedNodes.indexOf(nodeId);
if (index === -1) {
// Node hinzufügen
this.bookmarkedNodes.push(nodeId);
this.updateNodeAppearance(nodeId, true);
} else {
// Node entfernen
this.bookmarkedNodes.splice(index, 1);
this.updateNodeAppearance(nodeId, false);
}
// Änderungen speichern
this.saveBookmarkedNodes();
// Event auslösen für andere Komponenten
const event = new CustomEvent('nodeBookmarkToggled', {
detail: {
nodeId: nodeId,
isBookmarked: index === -1
}
});
document.dispatchEvent(event);
return index === -1; // true wenn jetzt gemerkt, false wenn Markierung aufgehoben
}
// Aktualisiert das Aussehen eines Knotens basierend auf Bookmark-Status
updateNodeAppearance(nodeId, isBookmarked) {
this.g.selectAll('.node-group')
.filter(d => d.id === nodeId)
.select('.node')
.classed('bookmarked', isBookmarked)
.attr('stroke', isBookmarked ? '#FFD700' : '#ffffff50')
.attr('stroke-width', isBookmarked ? 3 : 2);
}
// Aktualisiert das Aussehen aller gemerkten Knoten
updateAllBookmarkedNodes() {
this.g.selectAll('.node-group')
.each((d) => {
const isBookmarked = this.isNodeBookmarked(d.id);
this.updateNodeAppearance(d.id, isBookmarked);
});
}
}
// Exportiere die Klasse für die Verwendung in anderen Modulen
window.MindMapVisualization = MindMapVisualization;

1904
static/mindmap.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,955 @@
/**
* Neural Network Background Animation
* Modern, darker, mystical theme using WebGL
* Subtle flowing network aesthetic
*/
class NeuralNetworkBackground {
constructor() {
// Canvas setup
this.canvas = document.createElement('canvas');
this.canvas.id = 'neural-network-background';
this.canvas.style.position = 'fixed';
this.canvas.style.top = '0';
this.canvas.style.left = '0';
this.canvas.style.width = '100%';
this.canvas.style.height = '100%';
this.canvas.style.zIndex = '-10'; // Ensure it's behind content but visible
this.canvas.style.pointerEvents = 'none';
this.canvas.style.opacity = '1'; // Force visibility
// If canvas already exists, remove it first
const existingCanvas = document.getElementById('neural-network-background');
if (existingCanvas) {
existingCanvas.remove();
}
// Append to body as first child to ensure it's behind everything
if (document.body.firstChild) {
document.body.insertBefore(this.canvas, document.body.firstChild);
} else {
document.body.appendChild(this.canvas);
}
// WebGL context
this.gl = this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl');
if (!this.gl) {
console.warn('WebGL not supported, falling back to canvas rendering');
this.gl = null;
this.ctx = this.canvas.getContext('2d');
this.useWebGL = false;
} else {
this.useWebGL = true;
}
// Animation properties
this.nodes = [];
this.connections = [];
this.flows = []; // Flow animations along connections
this.animationFrameId = null;
this.isDarkMode = true; // Always use dark mode for the background
// Colors - Updated for intense visibility and neural effect
this.darkModeColors = {
background: '#030610', // Noch dunklerer Hintergrund für besseren Kontrast
nodeColor: '#88a5ff', // Hellere, leuchtende Knoten
nodePulse: '#c0d5ff', // Strahlend helles Pulsieren
connectionColor: '#5a6ca8', // Hellere, sichtbarere Verbindungen
flowColor: '#90c8ffee' // Sehr leuchtende, fast undurchsichtige Flüsse
};
this.lightModeColors = {
background: '#f9fafb',
nodeColor: '#8c4aff',
nodePulse: '#ab7cff',
connectionColor: '#b798ff',
flowColor: '#d4c5ff'
};
// Config - Drastisch verstärkt für strahlende Animationen und neuronale Vernetzung
this.config = {
nodeCount: 120, // Viel mehr Knoten für ein dichtes Netzwerk
nodeSize: 1.4, // Größere Knoten für mehr Sichtbarkeit
nodeVariation: 0.6, // Mehr Variation für organisches Aussehen
connectionDistance: 220, // Deutlich längere Verbindungen für mehr Vernetzung
connectionOpacity: 0.4, // Wesentlich stärkere Verbindungen
animationSpeed: 0.08, // Schnellere Bewegung
pulseSpeed: 0.006, // Schnelleres Pulsieren für lebendiges Aussehen
flowSpeed: 0.8, // Schnellere Flussanimationen
flowDensity: 0.005, // Viel mehr Flussanimationen
flowLength: 0.25, // Längere Flussanimationen
maxConnections: 6, // NEW: Neue Eigenschaft für mehr neuronale Verbindungen pro Knoten
clusteringFactor: 0.3 // NEW: Erzeugt Cluster wie in einem neuronalen Netzwerk
};
// Initialize
this.init();
// Event listeners
window.addEventListener('resize', this.resizeCanvas.bind(this));
document.addEventListener('darkModeToggled', (event) => {
this.isDarkMode = event.detail.isDark;
});
// Log that the background is initialized
console.log('Neural Network Background initialized');
}
init() {
this.resizeCanvas();
if (this.useWebGL) {
this.initWebGL();
}
this.createNodes();
this.createConnections();
this.startAnimation();
}
resizeCanvas() {
const pixelRatio = window.devicePixelRatio || 1;
const width = window.innerWidth;
const height = window.innerHeight;
this.canvas.style.width = width + 'px';
this.canvas.style.height = height + 'px';
this.canvas.width = width * pixelRatio;
this.canvas.height = height * pixelRatio;
if (this.useWebGL) {
this.gl.viewport(0, 0, this.canvas.width, this.canvas.height);
} else if (this.ctx) {
this.ctx.scale(pixelRatio, pixelRatio);
}
// Recalculate node positions after resize
if (this.nodes.length) {
this.createNodes();
this.createConnections();
}
}
initWebGL() {
// Vertex shader
const vsSource = `
attribute vec2 aVertexPosition;
attribute float aPointSize;
uniform vec2 uResolution;
void main() {
// Convert from pixel to clip space
vec2 position = (aVertexPosition / uResolution) * 2.0 - 1.0;
// Flip Y coordinate
position.y = -position.y;
gl_Position = vec4(position, 0, 1);
gl_PointSize = aPointSize;
}
`;
// Fragment shader - Softer glow effect
const fsSource = `
precision mediump float;
uniform vec4 uColor;
void main() {
float distance = length(gl_PointCoord - vec2(0.5, 0.5));
// Softer glow with smoother falloff
float alpha = 1.0 - smoothstep(0.1, 0.5, distance);
alpha = pow(alpha, 1.5); // Make the glow even softer
gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
}
`;
// Initialize shaders
const vertexShader = this.loadShader(this.gl.VERTEX_SHADER, vsSource);
const fragmentShader = this.loadShader(this.gl.FRAGMENT_SHADER, fsSource);
// Create shader program
this.shaderProgram = this.gl.createProgram();
this.gl.attachShader(this.shaderProgram, vertexShader);
this.gl.attachShader(this.shaderProgram, fragmentShader);
this.gl.linkProgram(this.shaderProgram);
if (!this.gl.getProgramParameter(this.shaderProgram, this.gl.LINK_STATUS)) {
console.error('Unable to initialize the shader program: ' +
this.gl.getProgramInfoLog(this.shaderProgram));
return;
}
// Get attribute and uniform locations
this.programInfo = {
program: this.shaderProgram,
attribLocations: {
vertexPosition: this.gl.getAttribLocation(this.shaderProgram, 'aVertexPosition'),
pointSize: this.gl.getAttribLocation(this.shaderProgram, 'aPointSize')
},
uniformLocations: {
resolution: this.gl.getUniformLocation(this.shaderProgram, 'uResolution'),
color: this.gl.getUniformLocation(this.shaderProgram, 'uColor')
}
};
// Create buffers
this.positionBuffer = this.gl.createBuffer();
this.sizeBuffer = this.gl.createBuffer();
// Set clear color for WebGL context
const bgColor = this.hexToRgb(this.darkModeColors.background);
this.gl.clearColor(bgColor.r/255, bgColor.g/255, bgColor.b/255, 1.0);
}
loadShader(type, source) {
const shader = this.gl.createShader(type);
this.gl.shaderSource(shader, source);
this.gl.compileShader(shader);
if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) {
console.error('An error occurred compiling the shaders: ' +
this.gl.getShaderInfoLog(shader));
this.gl.deleteShader(shader);
return null;
}
return shader;
}
createNodes() {
this.nodes = [];
const width = this.canvas.width / (window.devicePixelRatio || 1);
const height = this.canvas.height / (window.devicePixelRatio || 1);
// Erstelle Cluster-Zentren für neuronale Netzwerkmuster
const clusterCount = Math.floor(5 + Math.random() * 4); // 5-8 Cluster
const clusters = [];
for (let i = 0; i < clusterCount; i++) {
clusters.push({
x: Math.random() * width,
y: Math.random() * height,
radius: 100 + Math.random() * 150
});
}
// Create nodes with random positions and properties
for (let i = 0; i < this.config.nodeCount; i++) {
// Entscheide, ob dieser Knoten zu einem Cluster gehört oder nicht
const useCluster = Math.random() < this.config.clusteringFactor;
let x, y;
if (useCluster && clusters.length > 0) {
// Wähle ein zufälliges Cluster
const cluster = clusters[Math.floor(Math.random() * clusters.length)];
const angle = Math.random() * Math.PI * 2;
const distance = Math.random() * cluster.radius;
// Platziere in der Nähe des Clusters mit einiger Streuung
x = cluster.x + Math.cos(angle) * distance;
y = cluster.y + Math.sin(angle) * distance;
// Stelle sicher, dass es innerhalb des Bildschirms bleibt
x = Math.max(0, Math.min(width, x));
y = Math.max(0, Math.min(height, y));
} else {
// Zufällige Position außerhalb von Clustern
x = Math.random() * width;
y = Math.random() * height;
}
// Bestimme die Knotengröße - wichtigere Knoten (in Clustern) sind größer
const nodeImportance = useCluster ? 1.2 : 0.8;
const size = this.config.nodeSize * nodeImportance + Math.random() * this.config.nodeVariation;
const node = {
x: x,
y: y,
size: size,
speed: {
x: (Math.random() - 0.5) * this.config.animationSpeed,
y: (Math.random() - 0.5) * this.config.animationSpeed
},
pulsePhase: Math.random() * Math.PI * 2, // Random starting phase
connections: [],
isActive: Math.random() < 0.3, // Some nodes start active for neural firing effect
lastFired: 0, // For neural firing animation
firingRate: 1000 + Math.random() * 4000 // Random firing rate in ms
};
this.nodes.push(node);
}
}
createConnections() {
this.connections = [];
this.flows = []; // Reset flows
// Create connections between nearby nodes
for (let i = 0; i < this.nodes.length; i++) {
const nodeA = this.nodes[i];
nodeA.connections = [];
// Sortiere andere Knoten nach Entfernung für bevorzugte nahe Verbindungen
const potentialConnections = [];
for (let j = 0; j < this.nodes.length; j++) {
if (i === j) continue;
const nodeB = this.nodes[j];
const dx = nodeB.x - nodeA.x;
const dy = nodeB.y - nodeA.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < this.config.connectionDistance) {
potentialConnections.push({
index: j,
distance: distance
});
}
}
// Sortiere nach Entfernung
potentialConnections.sort((a, b) => a.distance - b.distance);
// Wähle die nächsten N Verbindungen, maximal maxConnections
const maxConn = Math.min(
this.config.maxConnections,
potentialConnections.length,
1 + Math.floor(Math.random() * this.config.maxConnections)
);
for (let c = 0; c < maxConn; c++) {
const connection = potentialConnections[c];
const j = connection.index;
const nodeB = this.nodes[j];
const distance = connection.distance;
// Create weighted connection (closer = stronger)
const connectionStrength = Math.max(0, 1 - distance / this.config.connectionDistance);
const connOpacity = connectionStrength * this.config.connectionOpacity;
// Check if connection already exists
if (!this.connections.some(conn =>
(conn.from === i && conn.to === j) || (conn.from === j && conn.to === i)
)) {
// Create connection
this.connections.push({
from: i,
to: j,
distance: distance,
opacity: connOpacity,
strength: connectionStrength,
hasFlow: false, // Each connection can have a flow
lastActivated: 0 // For neural firing animation
});
nodeA.connections.push(j);
nodeB.connections.push(i);
}
}
}
}
startAnimation() {
this.animationFrameId = requestAnimationFrame(this.animate.bind(this));
}
animate() {
// Update nodes
const width = this.canvas.width / (window.devicePixelRatio || 1);
const height = this.canvas.height / (window.devicePixelRatio || 1);
const now = Date.now();
// Simulate neural firing
for (let i = 0; i < this.nodes.length; i++) {
const node = this.nodes[i];
// Check if node should fire based on its firing rate
if (now - node.lastFired > node.firingRate) {
node.isActive = true;
node.lastFired = now;
// Activate connected nodes with probability based on connection strength
for (const connIndex of node.connections) {
// Find the connection
const conn = this.connections.find(c =>
(c.from === i && c.to === connIndex) || (c.from === connIndex && c.to === i)
);
if (conn) {
// Mark connection as recently activated
conn.lastActivated = now;
// Create a flow along this connection
if (Math.random() < conn.strength * 0.8) {
this.flows.push({
connection: conn,
progress: 0,
direction: conn.from === i, // Flow from activated node
length: this.config.flowLength + Math.random() * 0.1,
intensity: 0.7 + Math.random() * 0.3 // Random intensity for variation
});
}
// Probability for connected node to activate
if (Math.random() < conn.strength * 0.5) {
this.nodes[connIndex].isActive = true;
this.nodes[connIndex].lastFired = now - Math.random() * 500; // Slight variation
}
}
}
} else if (now - node.lastFired > 300) { // Deactivate after short period
node.isActive = false;
}
}
// Update flows
this.updateFlows();
// Occasionally create new flows along connections
if (Math.random() < this.config.flowDensity) {
this.createNewFlow();
}
// Recalculate connections occasionally for a living network
if (Math.random() < 0.01) { // Only recalculate 1% of the time for performance
this.createConnections();
}
// Render
if (this.useWebGL) {
this.renderWebGL();
} else {
this.renderCanvas();
}
// Continue animation
this.animationFrameId = requestAnimationFrame(this.animate.bind(this));
}
// New method to update flow animations
updateFlows() {
// Update existing flows
for (let i = this.flows.length - 1; i >= 0; i--) {
const flow = this.flows[i];
flow.progress += this.config.flowSpeed / flow.connection.distance;
// Remove completed flows
if (flow.progress > 1.0) {
this.flows.splice(i, 1);
}
}
// Generate more flows for enhanced visibility
if (Math.random() < this.config.flowDensity * 2) {
this.createNewFlow();
}
}
// New method to create flow animations
createNewFlow() {
if (this.connections.length === 0) return;
// Select a random connection with preference for more connected nodes
let connectionIdx = Math.floor(Math.random() * this.connections.length);
let attempts = 0;
// Try to find a connection with more connected nodes
while (attempts < 5) {
const testIdx = Math.floor(Math.random() * this.connections.length);
const testConn = this.connections[testIdx];
const fromNode = this.nodes[testConn.from];
if (fromNode.connections.length > 2) {
connectionIdx = testIdx;
break;
}
attempts++;
}
const connection = this.connections[connectionIdx];
// Create a new flow along this connection
this.flows.push({
connection: connection,
progress: 0,
direction: Math.random() > 0.5, // Randomly decide direction
length: this.config.flowLength + Math.random() * 0.1 // Slightly vary lengths
});
}
renderWebGL() {
this.gl.clear(this.gl.COLOR_BUFFER_BIT);
const width = this.canvas.width / (window.devicePixelRatio || 1);
const height = this.canvas.height / (window.devicePixelRatio || 1);
// Select shader program
this.gl.useProgram(this.programInfo.program);
// Set resolution uniform
this.gl.uniform2f(this.programInfo.uniformLocations.resolution, width, height);
// Draw connections first (behind nodes)
this.renderConnectionsWebGL();
// Draw flows on top of connections
this.renderFlowsWebGL();
// Draw nodes
this.renderNodesWebGL();
}
renderNodesWebGL() {
// Prepare node positions for WebGL
const positions = new Float32Array(this.nodes.length * 2);
const sizes = new Float32Array(this.nodes.length);
const now = Date.now();
for (let i = 0; i < this.nodes.length; i++) {
const node = this.nodes[i];
positions[i * 2] = node.x;
positions[i * 2 + 1] = node.y;
// Enhanced pulse effect with additional boost for active nodes
let pulse = Math.sin(node.pulsePhase) * 0.4 + 1;
// Make active nodes pulse more intensely (neural firing effect)
if (node.isActive) {
const timeSinceFired = now - node.lastFired;
if (timeSinceFired < 300) {
// Quick expand then contract effect
const normalizedTime = timeSinceFired / 300;
const fireBoost = 1.5 * (1 - normalizedTime);
pulse += fireBoost;
}
}
// Nodes with more connections are larger (hub neurons)
const connectivityFactor = 1 + (node.connections.length / this.config.maxConnections) * 0.8;
sizes[i] = node.size * pulse * connectivityFactor;
}
// Bind position buffer
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.positionBuffer);
this.gl.bufferData(this.gl.ARRAY_BUFFER, positions, this.gl.STATIC_DRAW);
this.gl.vertexAttribPointer(
this.programInfo.attribLocations.vertexPosition,
2, // components per vertex
this.gl.FLOAT, // data type
false, // normalize
0, // stride
0 // offset
);
this.gl.enableVertexAttribArray(this.programInfo.attribLocations.vertexPosition);
// Bind size buffer
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.sizeBuffer);
this.gl.bufferData(this.gl.ARRAY_BUFFER, sizes, this.gl.STATIC_DRAW);
this.gl.vertexAttribPointer(
this.programInfo.attribLocations.pointSize,
1, // components per vertex
this.gl.FLOAT, // data type
false, // normalize
0, // stride
0 // offset
);
this.gl.enableVertexAttribArray(this.programInfo.attribLocations.pointSize);
// Enable blending for all nodes
this.gl.enable(this.gl.BLEND);
this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE); // Additive blending for glow
// Draw each node individually with its own color
for (let i = 0; i < this.nodes.length; i++) {
const node = this.nodes[i];
// Set node color - more visible with active highlighting
const colorObj = this.isDarkMode ? this.darkModeColors : this.lightModeColors;
const nodeColor = this.hexToRgb(colorObj.nodeColor);
const nodePulseColor = this.hexToRgb(colorObj.nodePulse);
// Use pulse color for active nodes
let r = nodeColor.r / 255;
let g = nodeColor.g / 255;
let b = nodeColor.b / 255;
// Active nodes get brighter color
if (node.isActive) {
r = (r + nodePulseColor.r / 255) / 2;
g = (g + nodePulseColor.g / 255) / 2;
b = (b + nodePulseColor.b / 255) / 2;
}
this.gl.uniform4f(
this.programInfo.uniformLocations.color,
r, g, b,
0.95 // Higher opacity for maximum visibility
);
// Draw each node individually for better control
this.gl.drawArrays(this.gl.POINTS, i, 1);
}
}
renderConnectionsWebGL() {
const now = Date.now();
// For each connection, draw a line
for (const connection of this.connections) {
const fromNode = this.nodes[connection.from];
const toNode = this.nodes[connection.to];
// Line positions
const positions = new Float32Array([
fromNode.x, fromNode.y,
toNode.x, toNode.y
]);
// Bind position buffer
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.positionBuffer);
this.gl.bufferData(this.gl.ARRAY_BUFFER, positions, this.gl.STATIC_DRAW);
this.gl.vertexAttribPointer(
this.programInfo.attribLocations.vertexPosition,
2, // components per vertex
this.gl.FLOAT, // data type
false, // normalize
0, // stride
0 // offset
);
this.gl.enableVertexAttribArray(this.programInfo.attribLocations.vertexPosition);
// Disable point size attribute for lines
this.gl.disableVertexAttribArray(this.programInfo.attribLocations.pointSize);
// Set line color with connection opacity
const colorObj = this.isDarkMode ? this.darkModeColors : this.lightModeColors;
let lineColor = this.hexToRgb(colorObj.connectionColor);
// Highlight recently activated connections for neural pathway effect
let opacity = connection.opacity * 1.4; // Base increased visibility
if (now - connection.lastActivated < 800) {
// Make recently activated connections brighter
lineColor = this.hexToRgb(colorObj.flowColor);
// Fade out effect
const timeFactor = 1 - ((now - connection.lastActivated) / 800);
opacity = Math.max(opacity, timeFactor * 0.9);
}
this.gl.uniform4f(
this.programInfo.uniformLocations.color,
lineColor.r / 255,
lineColor.g / 255,
lineColor.b / 255,
opacity
);
// Draw the line
this.gl.enable(this.gl.BLEND);
this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE);
this.gl.lineWidth(1);
this.gl.drawArrays(this.gl.LINES, 0, 2);
}
}
// New method to render the flowing animations
renderFlowsWebGL() {
// For each flow, draw a segment along its connection
for (const flow of this.flows) {
const connection = flow.connection;
const fromNode = this.nodes[connection.from];
const toNode = this.nodes[connection.to];
// Calculate flow position
const startProgress = flow.progress;
const endProgress = Math.min(1, startProgress + flow.length);
// If flow hasn't started yet or has finished
if (startProgress >= 1 || endProgress <= 0) continue;
// Calculate actual positions
const direction = flow.direction ? 1 : -1;
let p1, p2;
if (direction > 0) {
p1 = {
x: fromNode.x + (toNode.x - fromNode.x) * startProgress,
y: fromNode.y + (toNode.y - fromNode.y) * startProgress
};
p2 = {
x: fromNode.x + (toNode.x - fromNode.x) * endProgress,
y: fromNode.y + (toNode.y - fromNode.y) * endProgress
};
} else {
p1 = {
x: toNode.x + (fromNode.x - toNode.x) * startProgress,
y: toNode.y + (fromNode.y - toNode.y) * startProgress
};
p2 = {
x: toNode.x + (fromNode.x - toNode.x) * endProgress,
y: toNode.y + (fromNode.y - toNode.y) * endProgress
};
}
// Line positions for the flow
const positions = new Float32Array([
p1.x, p1.y,
p2.x, p2.y
]);
// Bind position buffer
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.positionBuffer);
this.gl.bufferData(this.gl.ARRAY_BUFFER, positions, this.gl.STATIC_DRAW);
this.gl.vertexAttribPointer(
this.programInfo.attribLocations.vertexPosition,
2, // components per vertex
this.gl.FLOAT, // data type
false, // normalize
0, // stride
0 // offset
);
this.gl.enableVertexAttribArray(this.programInfo.attribLocations.vertexPosition);
// Disable point size attribute for lines
this.gl.disableVertexAttribArray(this.programInfo.attribLocations.pointSize);
// Fade the flow at the beginning and end
const fadeEdge = 0.2;
const fadeOpacity = Math.min(
startProgress / fadeEdge,
(1 - endProgress) / fadeEdge,
1
);
// Flow color - much stronger glow
const colorObj = this.isDarkMode ? this.darkModeColors : this.lightModeColors;
const flowColor = this.hexToRgb(colorObj.flowColor);
this.gl.uniform4f(
this.programInfo.uniformLocations.color,
flowColor.r / 255,
flowColor.g / 255,
flowColor.b / 255,
0.9 * fadeOpacity * flow.intensity // Much stronger flow opacity with intensity variation
);
// Draw the flow line
this.gl.enable(this.gl.BLEND);
this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE);
this.gl.lineWidth(2.5); // Even thicker for dramatic visibility
this.gl.drawArrays(this.gl.LINES, 0, 2);
}
}
renderCanvas() {
// Clear canvas
const width = this.canvas.width / (window.devicePixelRatio || 1);
const height = this.canvas.height / (window.devicePixelRatio || 1);
this.ctx.clearRect(0, 0, width, height);
// Set background
const backgroundColor = this.isDarkMode
? this.darkModeColors.background
: this.lightModeColors.background;
this.ctx.fillStyle = backgroundColor;
this.ctx.fillRect(0, 0, width, height);
// Draw connections
const connectionColor = this.isDarkMode
? this.darkModeColors.connectionColor
: this.lightModeColors.connectionColor;
for (const connection of this.connections) {
const fromNode = this.nodes[connection.from];
const toNode = this.nodes[connection.to];
this.ctx.beginPath();
this.ctx.moveTo(fromNode.x, fromNode.y);
this.ctx.lineTo(toNode.x, toNode.y);
const rgbColor = this.hexToRgb(connectionColor);
this.ctx.strokeStyle = `rgba(${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}, ${connection.opacity})`;
this.ctx.stroke();
}
// Draw flows
this.renderFlowsCanvas();
// Draw nodes
const nodeColor = this.isDarkMode
? this.darkModeColors.nodeColor
: this.lightModeColors.nodeColor;
const nodePulse = this.isDarkMode
? this.darkModeColors.nodePulse
: this.lightModeColors.nodePulse;
for (const node of this.nodes) {
// Node with subtle glow effect
const pulse = Math.sin(node.pulsePhase) * 0.2 + 1;
const nodeSize = node.size * pulse * (node.connections.length > 3 ? 1.3 : 1);
// Glow effect
const glow = this.ctx.createRadialGradient(
node.x, node.y, 0,
node.x, node.y, nodeSize * 2
);
const rgbNodeColor = this.hexToRgb(nodeColor);
const rgbPulseColor = this.hexToRgb(nodePulse);
glow.addColorStop(0, `rgba(${rgbPulseColor.r}, ${rgbPulseColor.g}, ${rgbPulseColor.b}, 0.6)`);
glow.addColorStop(0.5, `rgba(${rgbNodeColor.r}, ${rgbNodeColor.g}, ${rgbNodeColor.b}, 0.2)`);
glow.addColorStop(1, `rgba(${rgbNodeColor.r}, ${rgbNodeColor.g}, ${rgbNodeColor.b}, 0)`);
this.ctx.beginPath();
this.ctx.arc(node.x, node.y, nodeSize * 2, 0, Math.PI * 2);
this.ctx.fillStyle = glow;
this.ctx.fill();
// Main node
this.ctx.beginPath();
this.ctx.arc(node.x, node.y, nodeSize, 0, Math.PI * 2);
this.ctx.fillStyle = nodeColor;
this.ctx.fill();
}
}
// New method to render flows in Canvas mode
renderFlowsCanvas() {
if (!this.ctx) return;
const flowColor = this.isDarkMode
? this.darkModeColors.flowColor
: this.lightModeColors.flowColor;
const rgbFlowColor = this.hexToRgb(flowColor);
for (const flow of this.flows) {
const connection = flow.connection;
const fromNode = this.nodes[connection.from];
const toNode = this.nodes[connection.to];
// Calculate flow position
const startProgress = flow.progress;
const endProgress = Math.min(1, startProgress + flow.length);
// If flow hasn't started yet or has finished
if (startProgress >= 1 || endProgress <= 0) continue;
// Calculate actual positions
const direction = flow.direction ? 1 : -1;
let p1, p2;
if (direction > 0) {
p1 = {
x: fromNode.x + (toNode.x - fromNode.x) * startProgress,
y: fromNode.y + (toNode.y - fromNode.y) * startProgress
};
p2 = {
x: fromNode.x + (toNode.x - fromNode.x) * endProgress,
y: fromNode.y + (toNode.y - fromNode.y) * startProgress
};
} else {
p1 = {
x: toNode.x + (fromNode.x - toNode.x) * startProgress,
y: toNode.y + (fromNode.y - toNode.y) * startProgress
};
p2 = {
x: toNode.x + (fromNode.x - toNode.x) * endProgress,
y: toNode.y + (fromNode.y - toNode.y) * endProgress
};
}
// Fade the flow at the beginning and end
const fadeEdge = 0.2;
const fadeOpacity = Math.min(
startProgress / fadeEdge,
(1 - endProgress) / fadeEdge,
1
);
// Draw flow
this.ctx.beginPath();
this.ctx.moveTo(p1.x, p1.y);
this.ctx.lineTo(p2.x, p2.y);
this.ctx.strokeStyle = `rgba(${rgbFlowColor.r}, ${rgbFlowColor.g}, ${rgbFlowColor.b}, ${0.4 * fadeOpacity})`;
this.ctx.lineWidth = 1.5;
this.ctx.stroke();
}
}
// Helper method to convert hex to RGB
hexToRgb(hex) {
// Remove # if present
hex = hex.replace(/^#/, '');
// Handle rgba hex format
let alpha = 1;
if (hex.length === 8) {
alpha = parseInt(hex.slice(6, 8), 16) / 255;
hex = hex.slice(0, 6);
}
// Parse hex values
const bigint = parseInt(hex, 16);
const r = (bigint >> 16) & 255;
const g = (bigint >> 8) & 255;
const b = bigint & 255;
return { r, g, b, a: alpha };
}
// Cleanup method
destroy() {
if (this.animationFrameId) {
cancelAnimationFrame(this.animationFrameId);
}
window.removeEventListener('resize', this.resizeCanvas.bind(this));
if (this.canvas && this.canvas.parentNode) {
this.canvas.parentNode.removeChild(this.canvas);
}
if (this.gl) {
// Clean up WebGL resources
this.gl.deleteBuffer(this.positionBuffer);
this.gl.deleteBuffer(this.sizeBuffer);
this.gl.deleteProgram(this.shaderProgram);
}
}
}
// Initialize when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
// Short delay to ensure DOM is fully loaded
setTimeout(() => {
if (!window.neuralNetworkBackground) {
console.log('Creating Neural Network Background');
window.neuralNetworkBackground = new NeuralNetworkBackground();
}
}, 100);
});
// Re-initialize when page is fully loaded (for safety)
window.addEventListener('load', () => {
if (!window.neuralNetworkBackground) {
console.log('Re-initializing Neural Network Background on full load');
window.neuralNetworkBackground = new NeuralNetworkBackground();
}
});
// Clean up when window is closed
window.addEventListener('beforeunload', () => {
if (window.neuralNetworkBackground) {
window.neuralNetworkBackground.destroy();
}
});

492
static/style.css Normal file
View File

@@ -0,0 +1,492 @@
/* Main Systades Styles - Dark Mystical Theme */
/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');
/* Root Variables */
:root {
/* Light Theme Colors */
--light-bg-primary: #f8fafc;
--light-bg-secondary: #f1f5f9;
--light-text-primary: #1e293b;
--light-text-secondary: #475569;
--light-accent-primary: #7c3aed;
--light-accent-secondary: #8b5cf6;
--light-border: #e2e8f0;
/* Dark Theme Colors */
--dark-bg-primary: #0a0e19;
--dark-bg-secondary: #111827;
--dark-text-primary: #f9fafb;
--dark-text-secondary: #e5e7eb;
--dark-accent-primary: #6d28d9;
--dark-accent-secondary: #8b5cf6;
--dark-border: #1f2937;
/* Common */
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
--shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
/* Transitions */
--transition-fast: 150ms ease-in-out;
--transition-normal: 300ms ease-in-out;
--transition-slow: 500ms ease-in-out;
}
/* Base Elements */
body {
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transition: background-color var(--transition-normal), color var(--transition-normal);
background-color: transparent !important; /* Ensure background is transparent */
}
/* HTML root element should also be transparent */
html {
background-color: transparent !important;
}
html.dark {
background-color: transparent !important;
}
/* Theme Specific - keep the color but remove background */
body {
color: var(--light-text-primary);
}
body.dark {
color: var(--dark-text-primary);
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
line-height: 1.2;
}
p {
line-height: 1.6;
}
.gradient-text {
background-clip: text;
-webkit-background-clip: text;
color: transparent;
position: relative;
}
body .gradient-text {
background-image: linear-gradient(135deg, var(--light-accent-primary), var(--light-accent-secondary));
}
body.dark .gradient-text {
background-image: linear-gradient(135deg, var(--dark-accent-primary), var(--dark-accent-secondary));
}
/* Subtle glow for dark mode gradient text */
body.dark .gradient-text::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
filter: blur(8px);
opacity: 0.3;
background-image: inherit;
z-index: -1;
pointer-events: none;
}
/* Containers and Layout */
.container {
width: 100%;
margin-left: auto;
margin-right: auto;
padding-left: 1rem;
padding-right: 1rem;
}
@media (min-width: 640px) {
.container {
max-width: 640px;
}
}
@media (min-width: 768px) {
.container {
max-width: 768px;
}
}
@media (min-width: 1024px) {
.container {
max-width: 1024px;
}
}
@media (min-width: 1280px) {
.container {
max-width: 1280px;
}
}
/* Glass Morphism */
.glass-morphism {
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
body .glass-navbar-light {
background-color: rgba(255, 255, 255, 0.8);
border-color: rgba(226, 232, 240, 0.5);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
body.dark .glass-navbar-dark {
background-color: rgba(10, 14, 25, 0.8);
border-color: rgba(31, 41, 55, 0.5);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
/* Navigation */
.nav-link {
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
transition: all var(--transition-normal);
}
body .nav-link {
color: var(--light-text-secondary);
}
body.dark .nav-link {
color: var(--dark-text-secondary);
}
body .nav-link:hover {
color: var(--light-text-primary);
background-color: rgba(241, 245, 249, 0.5);
}
body.dark .nav-link:hover {
color: var(--dark-text-primary);
background-color: rgba(31, 41, 55, 0.5);
}
body .nav-link-light-active {
color: var(--light-accent-primary);
background-color: rgba(139, 92, 246, 0.1);
}
body.dark .nav-link-active {
color: var(--dark-accent-secondary);
background-color: rgba(109, 40, 217, 0.15);
}
/* Buttons */
.btn {
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-weight: 500;
transition: all var(--transition-normal);
display: inline-flex;
align-items: center;
justify-content: center;
}
body .btn-primary {
background-color: var(--light-accent-primary);
color: white;
}
body.dark .btn-primary {
background-color: var(--dark-accent-primary);
color: white;
}
body .btn-primary:hover {
background-color: var(--light-accent-secondary);
box-shadow: 0 0 15px rgba(124, 58, 237, 0.3);
}
body.dark .btn-primary:hover {
background-color: var(--dark-accent-secondary);
box-shadow: 0 0 15px rgba(109, 40, 217, 0.5);
}
body .btn-secondary {
background-color: transparent;
border: 1px solid var(--light-border);
color: var(--light-text-primary);
}
body.dark .btn-secondary {
background-color: transparent;
border: 1px solid var(--dark-border);
color: var(--dark-text-primary);
}
body .btn-secondary:hover {
background-color: var(--light-bg-secondary);
border-color: var(--light-accent-secondary);
}
body.dark .btn-secondary:hover {
background-color: var(--dark-bg-secondary);
border-color: var(--dark-accent-secondary);
}
/* Cards */
.card {
border-radius: 0.75rem;
overflow: hidden;
transition: all var(--transition-normal);
}
body .card {
background-color: white;
border: 1px solid var(--light-border);
box-shadow: var(--shadow);
}
body.dark .card {
background-color: var(--dark-bg-secondary);
border: 1px solid var(--dark-border);
box-shadow: var(--shadow);
}
body .card:hover {
transform: translateY(-5px);
box-shadow: var(--shadow-md);
}
body.dark .card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}
/* Form Elements */
.form-input {
width: 100%;
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
transition: all var(--transition-normal);
}
body .form-input {
background-color: white;
border: 1px solid var(--light-border);
color: var(--light-text-primary);
}
body.dark .form-input {
background-color: var(--dark-bg-secondary);
border: 1px solid var(--dark-border);
color: var(--dark-text-primary);
}
body .form-input:focus {
outline: none;
border-color: var(--light-accent-secondary);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
body.dark .form-input:focus {
outline: none;
border-color: var(--dark-accent-secondary);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.animate-fade-in {
animation: fadeIn 0.5s ease-out forwards;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.animate-float {
animation: float 5s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 0.7; }
50% { opacity: 1; }
}
.animate-pulse {
animation: pulse 3s ease-in-out infinite;
}
/* Utilities */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
.shadow-elevation {
transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
body .shadow-elevation {
box-shadow: var(--shadow);
}
body.dark .shadow-elevation {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}
body .shadow-elevation:hover {
box-shadow: var(--shadow-md);
transform: translateY(-2px);
}
body.dark .shadow-elevation:hover {
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
transform: translateY(-2px);
}
/* Tooltips */
.tooltip {
position: relative;
}
.tooltip:hover::before {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
font-size: 0.75rem;
white-space: nowrap;
z-index: 10;
opacity: 0;
animation: fadeIn 0.3s ease-out forwards;
}
body .tooltip:hover::before {
background-color: var(--light-text-primary);
color: white;
}
body.dark .tooltip:hover::before {
background-color: var(--dark-text-primary);
color: var(--dark-bg-primary);
}
/* Mystical elements */
.mystical-border {
position: relative;
overflow: hidden;
}
.mystical-border::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 1px solid;
border-radius: inherit;
pointer-events: none;
opacity: 0.3;
transition: opacity var(--transition-normal);
}
body .mystical-border::after {
border-color: var(--light-accent-primary);
}
body.dark .mystical-border::after {
border-color: var(--dark-accent-primary);
}
.mystical-border:hover::after {
opacity: 0.6;
}
/* Responsive Design Helpers */
@media (max-width: 640px) {
.container {
padding-left: 1rem;
padding-right: 1rem;
}
.hero-heading {
font-size: 2rem;
}
.section-heading {
font-size: 1.5rem;
}
}
/* Accessibility */
:focus-visible {
outline: 2px solid;
outline-offset: 2px;
}
body :focus-visible {
outline-color: var(--light-accent-primary);
}
body.dark :focus-visible {
outline-color: var(--dark-accent-primary);
}
/* Scrollbar styling */
::-webkit-scrollbar {
width: 0.5rem;
height: 0.5rem;
}
body ::-webkit-scrollbar-track {
background: var(--light-bg-secondary);
}
body.dark ::-webkit-scrollbar-track {
background: var(--dark-bg-secondary);
}
body ::-webkit-scrollbar-thumb {
background: var(--light-accent-primary);
border-radius: 0.25rem;
}
body.dark ::-webkit-scrollbar-thumb {
background: var(--dark-accent-primary);
border-radius: 0.25rem;
}
body ::-webkit-scrollbar-thumb:hover {
background: var(--light-accent-secondary);
}
body.dark ::-webkit-scrollbar-thumb:hover {
background: var(--dark-accent-secondary);
}

6
static/three.min.js vendored Normal file

File diff suppressed because one or more lines are too long

308
templates/admin.html Normal file
View File

@@ -0,0 +1,308 @@
{% extends "base.html" %}
{% block title %}Admin-Bereich{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-8">
<h1 class="text-3xl font-bold mb-8 text-gray-800 dark:text-white">Admin-Bereich</h1>
<!-- Tabs für verschiedene Bereiche -->
<div x-data="{ activeTab: 'users' }" class="mb-8">
<div class="flex space-x-2 mb-6 overflow-x-auto">
<button
@click="activeTab = 'users'"
:class="activeTab === 'users' ? 'bg-primary-600 text-white' : 'bg-white/10 text-gray-700 dark:text-gray-200'"
class="px-4 py-2 rounded-lg font-medium transition-all">
<i class="fas fa-users mr-2"></i> Benutzer
</button>
<button
@click="activeTab = 'nodes'"
:class="activeTab === 'nodes' ? 'bg-primary-600 text-white' : 'bg-white/10 text-gray-700 dark:text-gray-200'"
class="px-4 py-2 rounded-lg font-medium transition-all">
<i class="fas fa-project-diagram mr-2"></i> Mindmap-Knoten
</button>
<button
@click="activeTab = 'thoughts'"
:class="activeTab === 'thoughts' ? 'bg-primary-600 text-white' : 'bg-white/10 text-gray-700 dark:text-gray-200'"
class="px-4 py-2 rounded-lg font-medium transition-all">
<i class="fas fa-lightbulb mr-2"></i> Gedanken
</button>
<button
@click="activeTab = 'stats'"
:class="activeTab === 'stats' ? 'bg-primary-600 text-white' : 'bg-white/10 text-gray-700 dark:text-gray-200'"
class="px-4 py-2 rounded-lg font-medium transition-all">
<i class="fas fa-chart-bar mr-2"></i> Statistiken
</button>
</div>
<!-- Benutzer-Tab -->
<div x-show="activeTab === 'users'" class="glass-morphism rounded-lg p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-gray-800 dark:text-white">Benutzerverwaltung</h2>
<button class="btn-outline">
<i class="fas fa-plus mr-2"></i> Neuer Benutzer
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead>
<tr class="text-left border-b border-gray-200 dark:border-gray-700">
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">ID</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Benutzername</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">E-Mail</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Admin</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Gedanken</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Aktionen</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr class="border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-dark-700/30">
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ user.id }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300 font-medium">{{ user.username }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ user.email }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">
{% if user.is_admin %}
<span class="bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300 px-2 py-1 rounded text-xs">Admin</span>
{% else %}
<span class="bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 px-2 py-1 rounded text-xs">User</span>
{% endif %}
</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ user.thoughts|length }}</td>
<td class="px-4 py-3 flex space-x-2">
<button class="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Mindmap-Knoten-Tab -->
<div x-show="activeTab === 'nodes'" class="glass-morphism rounded-lg p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-gray-800 dark:text-white">Mindmap-Knoten Verwaltung</h2>
<button class="btn-outline">
<i class="fas fa-plus mr-2"></i> Neuer Knoten
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead>
<tr class="text-left border-b border-gray-200 dark:border-gray-700">
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">ID</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Name</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Elternknoten</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Gedanken</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Aktionen</th>
</tr>
</thead>
<tbody>
{% for node in nodes %}
<tr class="border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-dark-700/30">
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ node.id }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300 font-medium">{{ node.name }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">
{% if node.parent %}
{{ node.parent.name }}
{% else %}
<span class="text-gray-400 dark:text-gray-500">Wurzelknoten</span>
{% endif %}
</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ node.thoughts|length }}</td>
<td class="px-4 py-3 flex space-x-2">
<button class="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Gedanken-Tab -->
<div x-show="activeTab === 'thoughts'" class="glass-morphism rounded-lg p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-gray-800 dark:text-white">Gedanken-Verwaltung</h2>
<div class="flex space-x-2">
<div class="relative">
<input type="text" placeholder="Suchen..." class="form-input pl-10 pr-4 py-2 rounded-lg bg-white/10 border border-gray-200/20 dark:border-gray-700/20 focus:outline-none focus:ring-2 focus:ring-primary-500 text-gray-700 dark:text-gray-200">
<div class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500">
<i class="fas fa-search"></i>
</div>
</div>
<button class="btn-outline">
<i class="fas fa-filter mr-2"></i> Filter
</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead>
<tr class="text-left border-b border-gray-200 dark:border-gray-700">
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">ID</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Titel</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Autor</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Datum</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Bewertung</th>
<th class="px-4 py-2 text-gray-700 dark:text-gray-300">Aktionen</th>
</tr>
</thead>
<tbody>
{% for thought in thoughts %}
<tr class="border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-dark-700/30">
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ thought.id }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300 font-medium">{{ thought.title }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ thought.author.username }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ thought.timestamp.strftime('%d.%m.%Y') }}</td>
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">
<div class="flex items-center">
<span class="mr-2">{{ "%.1f"|format(thought.average_rating) }}</span>
<div class="flex">
{% for i in range(5) %}
{% if i < thought.average_rating|int %}
<i class="fas fa-star text-yellow-400"></i>
{% elif i < (thought.average_rating|int + 0.5) %}
<i class="fas fa-star-half-alt text-yellow-400"></i>
{% else %}
<i class="far fa-star text-yellow-400"></i>
{% endif %}
{% endfor %}
</div>
</div>
</td>
<td class="px-4 py-3 flex space-x-2">
<button class="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button class="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Statistiken-Tab -->
<div x-show="activeTab === 'stats'" class="glass-morphism rounded-lg p-6">
<h2 class="text-xl font-bold mb-6 text-gray-800 dark:text-white">Systemstatistiken</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="glass-effect p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="bg-blue-500/20 p-3 rounded-lg mr-3">
<i class="fas fa-users text-blue-500"></i>
</div>
<div>
<h3 class="text-sm font-medium text-gray-600 dark:text-gray-300">Benutzer</h3>
<p class="text-2xl font-bold text-gray-800 dark:text-white">{{ users|length }}</p>
</div>
</div>
</div>
<div class="glass-effect p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="bg-purple-500/20 p-3 rounded-lg mr-3">
<i class="fas fa-project-diagram text-purple-500"></i>
</div>
<div>
<h3 class="text-sm font-medium text-gray-600 dark:text-gray-300">Knoten</h3>
<p class="text-2xl font-bold text-gray-800 dark:text-white">{{ nodes|length }}</p>
</div>
</div>
</div>
<div class="glass-effect p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="bg-green-500/20 p-3 rounded-lg mr-3">
<i class="fas fa-lightbulb text-green-500"></i>
</div>
<div>
<h3 class="text-sm font-medium text-gray-600 dark:text-gray-300">Gedanken</h3>
<p class="text-2xl font-bold text-gray-800 dark:text-white">{{ thoughts|length }}</p>
</div>
</div>
</div>
<div class="glass-effect p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="bg-red-500/20 p-3 rounded-lg mr-3">
<i class="fas fa-comments text-red-500"></i>
</div>
<div>
<h3 class="text-sm font-medium text-gray-600 dark:text-gray-300">Kommentare</h3>
<p class="text-2xl font-bold text-gray-800 dark:text-white">
{% set comment_count = 0 %}
{% for thought in thoughts %}
{% set comment_count = comment_count + thought.comments|length %}
{% endfor %}
{{ comment_count }}
</p>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="glass-effect p-4 rounded-lg">
<h3 class="text-lg font-bold mb-4 text-gray-800 dark:text-white">Aktive Benutzer</h3>
<div class="h-64 flex items-center justify-center bg-gray-100/20 dark:bg-dark-700/20 rounded">
<p class="text-gray-500 dark:text-gray-400">Hier würde ein Aktivitätsdiagramm angezeigt werden</p>
</div>
</div>
<div class="glass-effect p-4 rounded-lg">
<h3 class="text-lg font-bold mb-4 text-gray-800 dark:text-white">Gedanken pro Kategorie</h3>
<div class="h-64 flex items-center justify-center bg-gray-100/20 dark:bg-dark-700/20 rounded">
<p class="text-gray-500 dark:text-gray-400">Hier würde eine Verteilungsstatistik angezeigt werden</p>
</div>
</div>
</div>
</div>
</div>
<!-- System-Log (immer sichtbar) -->
<div class="mt-8">
<h2 class="text-xl font-bold mb-4 text-gray-800 dark:text-white">System-Log</h2>
<div class="glass-morphism rounded-lg p-4 h-32 overflow-y-auto font-mono text-sm text-gray-700 dark:text-gray-300">
<div class="text-green-500">[INFO] [{{ now.strftime('%Y-%m-%d %H:%M:%S') }}] System gestartet</div>
<div class="text-blue-500">[INFO] [{{ now.strftime('%Y-%m-%d %H:%M:%S') }}] Admin-Bereich aufgerufen von {{ current_user.username }}</div>
<div class="text-yellow-500">[WARN] [{{ now.strftime('%Y-%m-%d %H:%M:%S') }}] Hohe Serverauslastung erkannt</div>
<div class="text-gray-500">[INFO] [{{ now.strftime('%Y-%m-%d %H:%M:%S') }}] Backup erfolgreich erstellt</div>
<div class="text-red-500">[ERROR] [{{ now.strftime('%Y-%m-%d %H:%M:%S') }}] API-Zugriffsfehler (Timeout) bei externer Anfrage</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script>
// Admin-spezifische JavaScript-Funktionen
document.addEventListener('DOMContentLoaded', function() {
console.log('Admin-Bereich geladen');
// Beispiel für AJAX-Ladeverhalten von Daten
// Kann später durch echte API-Calls ersetzt werden
});
</script>
{% endblock %}

71
templates/agb.html Normal file
View File

@@ -0,0 +1,71 @@
{% extends "base.html" %}
{% block title %}AGB{% endblock %}
{% block content %}
<div class="max-w-3xl mx-auto">
<div class="card p-6 md:p-8">
<h1 class="text-3xl font-bold mb-6 gradient-text">Allgemeine Geschäftsbedingungen</h1>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">1. Geltungsbereich</h2>
<p class="mb-4">Diese Allgemeinen Geschäftsbedingungen (nachfolgend "AGB") gelten für die Nutzung der MindMap-Plattform (nachfolgend "Plattform"), die von der MindMap GmbH, Musterstraße 123, 12345 Musterstadt (nachfolgend "Anbieter") betrieben wird.</p>
<p class="mb-4">Mit der Registrierung und/oder Nutzung der Plattform erkennt der Nutzer diese AGB an. Die Nutzung der Plattform ist nur zulässig, wenn der Nutzer diese AGB akzeptiert.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">2. Leistungsbeschreibung</h2>
<p class="mb-4">Die Plattform bietet dem Nutzer die Möglichkeit, komplexe Informationen in Form von Mindmaps zu visualisieren, zu organisieren und zu teilen. Der genaue Funktionsumfang ergibt sich aus der jeweiligen Leistungsbeschreibung auf der Website des Anbieters.</p>
<p class="mb-4">Der Anbieter ist berechtigt, die angebotenen Dienste zu ändern, neue Dienste unentgeltlich oder entgeltlich verfügbar zu machen und die Bereitstellung unentgeltlicher Dienste einzustellen. Der Anbieter wird hierbei jeweils auf die berechtigten Interessen des Nutzers Rücksicht nehmen.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">3. Registrierung und Nutzerkonto</h2>
<p class="mb-4">Die Nutzung bestimmter Funktionen der Plattform setzt die Registrierung eines Nutzerkontos voraus. Die Registrierung ist nur volljährigen und voll geschäftsfähigen natürlichen Personen erlaubt.</p>
<p class="mb-4">Der Nutzer verpflichtet sich, bei der Registrierung wahrheitsgemäße und vollständige Angaben zu machen und diese Daten stets aktuell zu halten. Es ist nicht gestattet, mehrere Nutzerkonten zu erstellen.</p>
<p class="mb-4">Der Nutzer ist verpflichtet, seine Zugangsdaten geheim zu halten und vor dem Zugriff durch unbefugte Dritte zu schützen. Der Anbieter wird den Nutzer niemals nach seinem Passwort fragen.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">4. Nutzungsrechte</h2>
<p class="mb-4">Der Anbieter gewährt dem Nutzer für die Dauer der Vertragslaufzeit ein einfaches, nicht übertragbares Recht zur Nutzung der Plattform im vertraglich vereinbarten Umfang.</p>
<p class="mb-4">Der Nutzer räumt dem Anbieter an den von ihm auf der Plattform eingestellten Inhalten ein einfaches, übertragbares, unterlizenzierbares, räumlich und zeitlich unbeschränktes Nutzungsrecht ein, soweit dies für den Betrieb der Plattform erforderlich ist.</p>
<p class="mb-4">Der Nutzer garantiert, dass er über alle Rechte an den von ihm eingestellten Inhalten verfügt und durch diese keine Rechte Dritter verletzt werden.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">5. Pflichten des Nutzers</h2>
<p class="mb-4">Der Nutzer verpflichtet sich, die Plattform nur im Einklang mit diesen AGB und den geltenden Gesetzen zu nutzen. Insbesondere ist es dem Nutzer untersagt:</p>
<ul class="list-disc pl-6 mb-4 space-y-2">
<li>die Plattform für rechtswidrige oder betrügerische Zwecke zu nutzen</li>
<li>rechtswidrige, beleidigende, diskriminierende oder anderweitig anstößige Inhalte zu verbreiten</li>
<li>Schadsoftware, Viren oder andere schädliche Computercodes zu verbreiten</li>
<li>die normale Funktion der Plattform zu stören oder übermäßig zu belasten</li>
<li>auf die Plattform mit automatisierten Mitteln zuzugreifen (wie z.B. Bots, Scraper)</li>
<li>die Plattform zu reverse-engineeren, zu dekompilieren oder zu disassemblieren</li>
</ul>
<p class="mb-4">Der Anbieter behält sich das Recht vor, bei Verstößen gegen diese Pflichten entsprechende Maßnahmen zu ergreifen, einschließlich der Sperrung des Nutzerkontos.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">6. Verfügbarkeit und Wartung</h2>
<p class="mb-4">Der Anbieter ist bemüht, eine hohe Verfügbarkeit der Plattform zu gewährleisten, kann jedoch keine unterbrechungsfreie Verfügbarkeit garantieren. Insbesondere können Wartungsarbeiten, Sicherheits- oder Kapazitätsprobleme sowie Ereignisse, die außerhalb des Einflussbereichs des Anbieters liegen, zu vorübergehenden Unterbrechungen führen.</p>
<p class="mb-4">Der Anbieter wird planmäßige Wartungsarbeiten, sofern möglich, vorher ankündigen und zu Zeiten durchführen, in denen die Nutzung der Plattform typischerweise gering ist.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">7. Haftung</h2>
<p class="mb-4">Der Anbieter haftet unbeschränkt für Vorsatz und grobe Fahrlässigkeit sowie nach dem Produkthaftungsgesetz. Für leichte Fahrlässigkeit haftet der Anbieter nur bei Verletzung einer wesentlichen Vertragspflicht und der Höhe nach beschränkt auf die bei Vertragsschluss vorhersehbaren und vertragstypischen Schäden. Wesentliche Vertragspflichten sind solche, deren Erfüllung die ordnungsgemäße Durchführung des Vertrags überhaupt erst ermöglicht und auf deren Einhaltung der Nutzer regelmäßig vertrauen darf.</p>
<p class="mb-4">Diese Haftungsbeschränkung gilt nicht für Schäden aus der Verletzung des Lebens, des Körpers oder der Gesundheit.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">8. Schlussbestimmungen</h2>
<p class="mb-4">Es gilt das Recht der Bundesrepublik Deutschland unter Ausschluss des UN-Kaufrechts.</p>
<p class="mb-4">Sollten einzelne Bestimmungen dieser AGB unwirksam sein oder werden, bleibt die Wirksamkeit der übrigen Bestimmungen unberührt.</p>
<p class="mb-4">Der Anbieter behält sich vor, diese AGB jederzeit zu ändern. Änderungen werden dem Nutzer rechtzeitig vor ihrem Inkrafttreten mitgeteilt. Die Änderungen gelten als akzeptiert, wenn der Nutzer ihnen nicht innerhalb von vier Wochen nach Erhalt der Mitteilung widerspricht.</p>
<p class="mb-4">Stand: Mai 2023</p>
</section>
</div>
</div>
{% endblock %}

615
templates/base.html Normal file
View File

@@ -0,0 +1,615 @@
<!DOCTYPE html>
<html lang="de" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Systades - {% block title %}{% endblock %}</title>
<!-- Favicon -->
<link rel="icon" href="{{ url_for('static', filename='img/favicon.svg') }}" type="image/svg+xml">
<link rel="icon" href="{{ url_for('static', filename='img/favicon.ico') }}" sizes="any">
<!-- Meta Tags -->
<meta name="description" content="Eine interaktive Plattform zum Visualisieren, Erforschen und Teilen von Wissen">
<meta name="keywords" content="systades, wissen, visualisierung, lernen, gedanken, theorie">
<meta name="author" content="Systades-Team">
<!-- Tailwind CSS - Beide Optionen verfügbar -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Alternative lokale Version, falls die CDN-Version blockiert wird -->
<link href="{{ url_for('static', filename='css/tailwind.min.css') }}" rel="stylesheet">
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'ui-sans-serif', 'system-ui', '-apple-system', 'sans-serif'],
mono: ['JetBrains Mono', 'ui-monospace', 'monospace']
},
colors: {
primary: {
50: '#f5f3ff',
100: '#ede9fe',
200: '#ddd6fe',
300: '#c4b5fd',
400: '#a78bfa',
500: '#8b5cf6',
600: '#7c3aed',
700: '#6d28d9',
800: '#5b21b6',
900: '#4c1d95'
},
secondary: {
50: '#ecfdf5',
100: '#d1fae5',
200: '#a7f3d0',
300: '#6ee7b7',
400: '#34d399',
500: '#10b981',
600: '#059669',
700: '#047857',
800: '#065f46',
900: '#064e3b'
},
dark: {
500: '#374151',
600: '#1f2937',
700: '#111827',
800: '#0e1220',
900: '#0a0e19'
}
}
}
}
}
</script>
<!-- Local Font Files -->
<link href="{{ url_for('static', filename='fonts/inter.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='fonts/jetbrains-mono.css') }}" rel="stylesheet">
<!-- Icons - Self-hosted Font Awesome -->
<link href="{{ url_for('static', filename='css/all.min.css') }}" rel="stylesheet">
<!-- Assistent CSS -->
<link href="{{ url_for('static', filename='css/assistant.css') }}" rel="stylesheet">
<!-- Basis-Stylesheet -->
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet">
<!-- Base-Styles ausgelagert in eigene Datei -->
<link href="{{ url_for('static', filename='css/base-styles.css') }}" rel="stylesheet">
<!-- Alpine.js - CDN Version -->
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.3/dist/cdn.min.js"></script>
<!-- Neural Network Background CSS -->
<link href="{{ url_for('static', filename='css/neural-network-background.css') }}" rel="stylesheet">
<!-- D3.js für Visualisierungen -->
<script src="https://d3js.org/d3.v7.min.js"></script>
<!-- Marked.js für Markdown-Parsing -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- ChatGPT Assistant -->
<script src="{{ url_for('static', filename='js/modules/chatgpt-assistant.js') }}"></script>
<!-- MindMap Visualization Module -->
<script src="{{ url_for('static', filename='js/modules/mindmap.js') }}"></script>
<!-- MindMap Page Module -->
<script src="{{ url_for('static', filename='js/modules/mindmap-page.js') }}"></script>
<!-- Neural Network Background Script -->
<script src="{{ url_for('static', filename='neural-network-background.js') }}"></script>
<!-- Hauptmodul laden (als traditionelles Skript) -->
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
<!-- Seitenspezifische Styles -->
{% block extra_css %}{% endblock %}
<!-- Custom dark mode styles -->
<style>
/* Dark mystical theme */
.dark {
--bg-primary: #0a0e19;
--bg-secondary: #111827;
--text-primary: #f9fafb;
--text-secondary: #e5e7eb;
--accent-primary: #6d28d9;
--accent-secondary: #8b5cf6;
--glow-effect: 0 0 15px rgba(124, 58, 237, 0.5);
}
/* Light theme with mystical tones */
:root {
--bg-primary: #f8fafc;
--bg-secondary: #f1f5f9;
--text-primary: #1e293b;
--text-secondary: #475569;
--accent-primary: #7c3aed;
--accent-secondary: #8b5cf6;
--glow-effect: 0 0 15px rgba(139, 92, 246, 0.3);
}
body.dark {
background-color: var(--bg-primary);
color: var(--text-primary);
}
/* Mystical glowing effects */
.mystical-glow {
text-shadow: var(--glow-effect);
}
.gradient-text {
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
text-shadow: none;
}
/* Glass morphism effects */
.glass-morphism {
backdrop-filter: blur(10px);
}
.dark .glass-navbar-dark {
background-color: rgba(10, 14, 25, 0.8);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.glass-navbar-light {
background-color: rgba(255, 255, 255, 0.8);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
/* Alpine.js x-cloak für ausgeblendete Elemente */
[x-cloak] { display: none !important; }
/* Grundlegende Klassen, um sicherzustellen, dass Tailwind geladen wird */
.nav-link {
@apply text-gray-300 hover:text-white transition-colors duration-200;
}
.nav-link-active {
@apply text-white font-medium;
}
.nav-link-light {
@apply text-gray-600 hover:text-gray-900 transition-colors duration-200;
}
.nav-link-light-active {
@apply text-gray-900 font-medium;
}
</style>
</head>
<body data-page="{{ request.endpoint }}" class="relative overflow-x-hidden dark bg-gray-900 text-white" x-data="{
darkMode: true,
mobileMenuOpen: false,
userMenuOpen: false,
showSettingsModal: false,
init() {
this.fetchDarkModeFromSession();
},
fetchDarkModeFromSession() {
fetch('/api/get_dark_mode')
.then(response => response.json())
.then(data => {
if (data.success) {
this.darkMode = data.darkMode === 'true';
document.querySelector('html').classList.toggle('dark', this.darkMode);
}
})
.catch(error => {
console.error('Fehler beim Laden der Dark Mode-Einstellung:', error);
});
},
toggleDarkMode() {
this.darkMode = !this.darkMode;
document.querySelector('html').classList.toggle('dark', this.darkMode);
fetch('/api/set_dark_mode', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ darkMode: this.darkMode })
})
.then(response => response.json())
.then(data => {
if (data.success) {
localStorage.setItem('darkMode', this.darkMode ? 'dark' : 'light');
document.dispatchEvent(new CustomEvent('darkModeToggled', {
detail: { isDark: this.darkMode }
}));
} else {
console.error('Fehler beim Speichern der Dark Mode-Einstellung:', data.error);
}
})
.catch(error => {
console.error('Fehler beim Speichern der Dark Mode-Einstellung:', error);
});
}
}">
<!-- App-Container -->
<div id="app-container" class="flex flex-col min-h-screen">
<!-- Hauptnavigation -->
<nav class="sticky top-0 left-0 right-0 z-50 transition-all duration-300 py-4 px-5 border-b glass-morphism"
x-bind:class="darkMode ? 'glass-navbar-dark border-white/10' : 'glass-navbar-light border-gray-200/50'">
<div class="container mx-auto flex justify-between items-center">
<!-- Logo -->
<a href="{{ url_for('index') }}" class="flex items-center group">
<span class="text-2xl font-bold gradient-text transform transition-transform group-hover:scale-105">Systades</span>
</a>
<!-- Hauptnavigation - Desktop -->
<div class="hidden md:flex items-center space-x-5">
<a href="{{ url_for('index') }}"
class="nav-link flex items-center"
x-bind:class="darkMode
? '{{ 'nav-link-active' if request.endpoint == 'index' else '' }}'
: '{{ 'nav-link-light-active' if request.endpoint == 'index' else 'nav-link-light' }}'">
<i class="fa-solid fa-home mr-2"></i>Start
</a>
<a href="{{ url_for('mindmap') }}"
class="nav-link flex items-center"
x-bind:class="darkMode
? '{{ 'nav-link-active' if request.endpoint == 'mindmap' else '' }}'
: '{{ 'nav-link-light-active' if request.endpoint == 'mindmap' else 'nav-link-light' }}'">
<i class="fa-solid fa-diagram-project mr-2"></i>Mindmap
</a>
<a href="{{ url_for('search_thoughts_page') }}"
class="nav-link flex items-center"
x-bind:class="darkMode
? '{{ 'nav-link-active' if request.endpoint == 'search_thoughts_page' else '' }}'
: '{{ 'nav-link-light-active' if request.endpoint == 'search_thoughts_page' else 'nav-link-light' }}'">
<i class="fa-solid fa-search mr-2"></i>Suche
</a>
<!-- KI-Assistent Button -->
<button onclick="window.MindMap && window.MindMap.assistant && window.MindMap.assistant.toggleAssistant(true)"
class="nav-link flex items-center"
x-bind:class="darkMode
? 'bg-gradient-to-r from-purple-900/90 to-indigo-800/90 text-white font-medium px-4 py-2 rounded-xl hover:shadow-lg hover:shadow-purple-800/30 transition-all duration-300'
: 'bg-gradient-to-r from-purple-600/30 to-indigo-500/30 text-gray-800 font-medium px-4 py-2 rounded-xl hover:shadow-md transition-all duration-300'">
<i class="fa-solid fa-robot mr-2"></i>KI-Chat
</button>
{% if current_user.is_authenticated %}
<a href="{{ url_for('profile') }}"
class="nav-link flex items-center"
x-bind:class="darkMode
? '{{ 'nav-link-active' if request.endpoint == 'profile' else '' }}'
: '{{ 'nav-link-light-active' if request.endpoint == 'profile' else 'nav-link-light' }}'">
<i class="fa-solid fa-user mr-2"></i>Profil
</a>
{% endif %}
</div>
<!-- Rechte Seite -->
<div class="flex items-center space-x-4">
<!-- Dark Mode Toggle Switch -->
<div class="flex items-center cursor-pointer" @click="toggleDarkMode">
<div class="relative w-12 h-6">
<input type="checkbox" id="darkModeToggle" class="sr-only" x-model="darkMode">
<div class="block w-12 h-6 rounded-full transition-colors duration-300"
x-bind:class="darkMode ? 'bg-purple-800/50' : 'bg-gray-400/50'"></div>
<div class="dot absolute left-1 top-1 w-4 h-4 rounded-full transition-transform duration-300 shadow-md"
x-bind:class="darkMode ? 'bg-purple-600 transform translate-x-6' : 'bg-white'"></div>
</div>
<div class="ml-3 hidden sm:block"
x-bind:class="darkMode ? 'text-white/90' : 'text-gray-700'">
<span x-text="darkMode ? 'Dunkel' : 'Hell'"></span>
</div>
<div class="ml-2 sm:hidden"
x-bind:class="darkMode ? 'text-white/90' : 'text-gray-700'">
<i class="fa-solid" :class="darkMode ? 'fa-sun' : 'fa-moon'"></i>
</div>
</div>
<!-- Profil-Link oder Login -->
{% if current_user.is_authenticated %}
<div class="relative" x-data="{ open: false }">
<button @click="open = !open"
class="flex items-center space-x-2 p-2 rounded-full transition-all duration-300 cursor-pointer"
x-bind:class="darkMode
? 'bg-gray-800/80 text-white/90 hover:bg-gray-700/80'
: 'bg-gray-200/80 text-gray-700 hover:bg-gray-300/80'">
<div class="w-9 h-9 rounded-full flex items-center justify-center text-white font-medium text-sm overflow-hidden"
style="background: linear-gradient(135deg, #8b5cf6, #6366f1);">
{% if current_user.avatar %}
<img src="{{ current_user.avatar }}" alt="{{ current_user.username }}" class="w-full h-full object-cover">
{% else %}
{{ current_user.username[0].upper() }}
{% endif %}
</div>
<span class="text-sm hidden lg:block">{{ current_user.username }}</span>
<i class="fa-solid fa-chevron-down text-xs hidden lg:block transition-transform duration-200"
x-bind:class="open ? 'transform rotate-180' : ''"></i>
</button>
<!-- Dropdown-Menü -->
<div x-show="open"
@click.away="open = false"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute right-0 mt-2 w-52 rounded-2xl overflow-hidden shadow-lg transform origin-top-right z-50"
x-bind:class="darkMode
? 'bg-gray-800/95 backdrop-blur-md border border-white/10'
: 'bg-white/95 backdrop-blur-md border border-gray-200/50'">
<a href="{{ url_for('profile') }}"
class="block px-4 py-3 transition-colors duration-200 flex items-center"
x-bind:class="darkMode
? 'text-white/90 hover:bg-purple-500/20'
: 'text-gray-700 hover:bg-purple-500/10'">
<i class="fa-solid fa-user mr-2 text-purple-400"></i>Profil
</a>
<a href="{{ url_for('my_account') }}"
class="block px-4 py-3 transition-colors duration-200 flex items-center"
x-bind:class="darkMode
? 'text-white/90 hover:bg-purple-500/20'
: 'text-gray-700 hover:bg-purple-500/10'">
<i class="fa-solid fa-bookmark mr-2 text-purple-400"></i>Meine Merkliste
</a>
<a href="{{ url_for('settings') }}"
class="block px-4 py-3 transition-colors duration-200 flex items-center"
x-bind:class="darkMode
? 'text-white/90 hover:bg-purple-500/20'
: 'text-gray-700 hover:bg-purple-500/10'">
<i class="fa-solid fa-gear mr-2 text-purple-400"></i>Einstellungen
</a>
<div class="my-2 h-px" x-bind:class="darkMode ? 'bg-white/10' : 'bg-gray-200'"></div>
<a href="{{ url_for('logout') }}"
class="block px-4 py-3 transition-colors duration-200 flex items-center"
x-bind:class="darkMode
? 'text-white/90 hover:bg-red-500/20'
: 'text-gray-700 hover:bg-red-500/10'">
<i class="fa-solid fa-right-from-bracket mr-2 text-red-400"></i>Abmelden
</a>
</div>
</div>
{% else %}
<div class="flex items-center space-x-2">
<a href="{{ url_for('login') }}"
class="py-2 px-4 rounded-lg transition-all duration-300"
x-bind:class="darkMode
? 'text-white/90 hover:bg-dark-700/80'
: 'text-gray-700 hover:bg-gray-100/80'">
<i class="fa-solid fa-sign-in-alt mr-2"></i>Login
</a>
<a href="{{ url_for('register') }}"
class="py-2 px-4 rounded-lg transition-all duration-300 font-medium"
x-bind:class="darkMode
? 'bg-purple-800/80 text-white hover:bg-purple-700/80'
: 'bg-purple-600/20 text-gray-700 hover:bg-purple-600/30'">
Registrieren
</a>
</div>
{% endif %}
<!-- Mobilmenü-Button -->
<button @click="mobileMenuOpen = !mobileMenuOpen"
class="md:hidden rounded-xl p-2.5 transition-colors duration-200 focus:outline-none"
x-bind:class="darkMode
? 'text-white/90 hover:bg-gray-700/50'
: 'text-gray-700 hover:bg-gray-200/80'">
<i class="fa-solid" :class="mobileMenuOpen ? 'fa-times' : 'fa-bars'"></i>
</button>
</div>
</div>
</nav>
<!-- Mobile Menü -->
<div x-show="mobileMenuOpen"
x-cloak
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 -translate-y-4"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 -translate-y-4"
class="md:hidden w-full z-40 border-b"
x-bind:class="darkMode
? 'bg-gray-900/90 backdrop-blur-lg border-white/10'
: 'bg-white/90 backdrop-blur-lg border-gray-200'">
<div class="px-4 py-4 space-y-3">
<a href="{{ url_for('index') }}"
class="block py-3.5 px-4 rounded-xl transition-all duration-200 flex items-center"
x-bind:class="darkMode
? '{{ 'bg-purple-500/20 text-white' if request.endpoint == 'index' else 'text-white/80 hover:bg-gray-800/80 hover:text-white' }}'
: '{{ 'bg-purple-500/10 text-gray-900' if request.endpoint == 'index' else 'text-gray-700 hover:bg-gray-100 hover:text-gray-900' }}'">
<i class="fa-solid fa-home w-5 mr-3"></i>Start
</a>
<a href="{{ url_for('mindmap') }}"
class="block py-3.5 px-4 rounded-xl transition-all duration-200 flex items-center"
x-bind:class="darkMode
? '{{ 'bg-purple-500/20 text-white' if request.endpoint == 'mindmap' else 'text-white/80 hover:bg-gray-800/80 hover:text-white' }}'
: '{{ 'bg-purple-500/10 text-gray-900' if request.endpoint == 'mindmap' else 'text-gray-700 hover:bg-gray-100 hover:text-gray-900' }}'">
<i class="fa-solid fa-diagram-project w-5 mr-3"></i>Mindmap
</a>
<a href="{{ url_for('search_thoughts_page') }}"
class="block py-3.5 px-4 rounded-xl transition-all duration-200 flex items-center"
x-bind:class="darkMode
? '{{ 'bg-purple-500/20 text-white' if request.endpoint == 'search_thoughts_page' else 'text-white/80 hover:bg-gray-800/80 hover:text-white' }}'
: '{{ 'bg-purple-500/10 text-gray-900' if request.endpoint == 'search_thoughts_page' else 'text-gray-700 hover:bg-gray-100 hover:text-gray-900' }}'">
<i class="fa-solid fa-search w-5 mr-3"></i>Suche
</a>
<!-- KI-Button für Mobilmenü -->
<button onclick="window.MindMap && window.MindMap.assistant && window.MindMap.assistant.toggleAssistant(true); mobileMenuOpen = false;"
class="block w-full text-left py-3.5 px-4 rounded-xl transition-all duration-200 flex items-center"
x-bind:class="darkMode
? 'bg-gradient-to-r from-purple-600/30 to-blue-500/30 text-white hover:from-purple-600/40 hover:to-blue-500/40'
: 'bg-gradient-to-r from-purple-500/10 to-blue-400/10 text-gray-900 hover:from-purple-500/20 hover:to-blue-400/20'">
<i class="fa-solid fa-robot w-5 mr-3"></i>KI-Chat
</button>
{% if current_user.is_authenticated %}
<a href="{{ url_for('profile') }}"
class="block py-3.5 px-4 rounded-xl transition-all duration-200 flex items-center"
x-bind:class="darkMode
? '{{ 'bg-purple-500/20 text-white' if request.endpoint == 'profile' else 'text-white/80 hover:bg-gray-800/80 hover:text-white' }}'
: '{{ 'bg-purple-500/10 text-gray-900' if request.endpoint == 'profile' else 'text-gray-700 hover:bg-gray-100 hover:text-gray-900' }}'">
<i class="fa-solid fa-user w-5 mr-3"></i>Profil
</a>
{% endif %}
</div>
</div>
<!-- Hauptinhalt -->
<main class="flex-grow pt-6">
{% block content %}{% endblock %}
</main>
<!-- Footer -->
<footer class="mt-12 py-10 transition-colors duration-300 rounded-t-3xl mx-4 sm:mx-6 md:mx-8"
:class="darkMode ? 'bg-gray-900/60 backdrop-blur-xl border-t border-white/10' : 'bg-white/60 backdrop-blur-xl border-t border-gray-200/50'">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-3 gap-10">
<!-- Logo und Beschreibung -->
<div class="text-center md:text-left flex flex-col">
<a href="{{ url_for('index') }}" class="text-2xl font-bold mb-4 gradient-text inline-block transform transition-transform hover:scale-105">Systades</a>
<p class="mt-2 text-sm max-w-md"
:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
Eine interaktive Plattform zum Visualisieren, Erforschen und Teilen von Wissen und Gedanken in einem strukturierten Format.
</p>
<!-- Social Media Icons -->
<div class="flex items-center space-x-4 mt-6 justify-center md:justify-start">
<a href="#" class="transition-all duration-200 transform hover:scale-110 hover:-translate-y-1"
:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fab fa-twitter text-xl"></i>
</a>
<a href="#" class="transition-all duration-200 transform hover:scale-110 hover:-translate-y-1"
:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fab fa-linkedin text-xl"></i>
</a>
<a href="#" class="transition-all duration-200 transform hover:scale-110 hover:-translate-y-1"
:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fab fa-github text-xl"></i>
</a>
<a href="#" class="transition-all duration-200 transform hover:scale-110 hover:-translate-y-1"
:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fab fa-discord text-xl"></i>
</a>
</div>
</div>
<!-- Links -->
<div class="grid grid-cols-2 gap-8">
<div class="flex flex-col space-y-3">
<h3 class="font-semibold text-lg mb-2"
:class="darkMode ? 'text-white' : 'text-gray-800'">Navigation</h3>
<a href="{{ url_for('index') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Startseite
</a>
<a href="{{ url_for('mindmap') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Mindmap
</a>
{% if current_user.is_authenticated %}
<a href="{{ url_for('profile') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Profil
</a>
<a href="{{ url_for('my_account') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Meine Merkliste
</a>
{% else %}
<a href="{{ url_for('login') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Anmelden
</a>
<a href="{{ url_for('register') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Registrieren
</a>
{% endif %}
</div>
<div class="flex flex-col space-y-3">
<h3 class="font-semibold text-lg mb-2"
:class="darkMode ? 'text-white' : 'text-gray-800'">Rechtliches</h3>
<a href="{{ url_for('impressum') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Impressum
</a>
<a href="{{ url_for('datenschutz') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Datenschutz
</a>
<a href="{{ url_for('agb') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
AGB
</a>
</div>
</div>
<!-- Newsletter Anmeldung -->
<div class="flex flex-col">
<h3 class="font-semibold text-lg mb-4"
:class="darkMode ? 'text-white' : 'text-gray-800'">Newsletter</h3>
<p class="text-sm mb-4"
:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
Bleibe auf dem Laufenden mit unseren neuesten Funktionen und Updates.
</p>
<form class="flex flex-col space-y-3">
<input type="email" placeholder="Deine E-Mail Adresse"
class="px-4 py-2.5 rounded-xl transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-purple-500"
:class="darkMode ? 'bg-gray-800/80 text-white border border-gray-700 focus:bg-gray-800' : 'bg-white/80 text-gray-800 border border-gray-300 focus:bg-white'" />
<button type="submit"
class="px-4 py-2.5 rounded-xl font-medium transition-all duration-300 bg-gradient-to-r from-purple-600 to-indigo-600 text-white shadow-md hover:shadow-lg hover:-translate-y-0.5">
Abonnieren
</button>
</form>
</div>
</div>
<!-- Untere Linie -->
<div class="mt-10 pt-6 border-t flex flex-col md:flex-row justify-between items-center"
:class="darkMode ? 'border-gray-800/50 text-gray-400' : 'border-gray-300/50 text-gray-600'">
<div class="text-xs md:text-sm mb-3 md:mb-0">
&copy; {{ current_year }} Systades. Alle Rechte vorbehalten.
</div>
<div class="text-xs md:text-sm">
Designed with <i class="fas fa-heart text-pink-500"></i> in Deutschland
</div>
</div>
</div>
</footer>
</div>
<!-- Hilfsscripts -->
{% block scripts %}{% endblock %}
<!-- KI-Chat Initialisierung -->
<script>
// Initialisiere den ChatGPT-Assistenten direkt, um sicherzustellen,
// dass er auf jeder Seite verfügbar ist, selbst wenn MindMap nicht geladen ist
document.addEventListener('DOMContentLoaded', function() {
// Prüfen, ob der Assistent bereits durch MindMap initialisiert wurde
if (!window.MindMap || !window.MindMap.assistant) {
console.log('KI-Assistent wird direkt initialisiert...');
const assistant = new ChatGPTAssistant();
assistant.init();
// Speichere in window.MindMap, falls es existiert, oder erstelle es
if (!window.MindMap) {
window.MindMap = {};
}
window.MindMap.assistant = assistant;
}
});
</script>
</body>
</html>

View File

@@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block title %}Datenschutz{% endblock %}
{% block content %}
<div class="max-w-3xl mx-auto">
<div class="card p-6 md:p-8">
<h1 class="text-3xl font-bold mb-6 gradient-text">Datenschutzerklärung</h1>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">1. Datenschutz auf einen Blick</h2>
<h3 class="text-lg font-bold mb-2">Allgemeine Hinweise</h3>
<p class="mb-4">Die folgenden Hinweise geben einen einfachen Überblick darüber, was mit Ihren personenbezogenen Daten passiert, wenn Sie diese Website besuchen. Personenbezogene Daten sind alle Daten, mit denen Sie persönlich identifiziert werden können. Ausführliche Informationen zum Thema Datenschutz entnehmen Sie unserer unter diesem Text aufgeführten Datenschutzerklärung.</p>
<h3 class="text-lg font-bold mb-2">Datenerfassung auf dieser Website</h3>
<p class="mb-4"><strong>Wer ist verantwortlich für die Datenerfassung auf dieser Website?</strong></p>
<p class="mb-4">Die Datenverarbeitung auf dieser Website erfolgt durch den Websitebetreiber. Dessen Kontaktdaten können Sie dem Impressum dieser Website entnehmen.</p>
<p class="mb-4"><strong>Wie erfassen wir Ihre Daten?</strong></p>
<p class="mb-4">Ihre Daten werden zum einen dadurch erhoben, dass Sie uns diese mitteilen. Hierbei kann es sich z. B. um Daten handeln, die Sie in ein Kontaktformular eingeben.</p>
<p class="mb-4">Andere Daten werden automatisch oder nach Ihrer Einwilligung beim Besuch der Website durch unsere IT-Systeme erfasst. Das sind vor allem technische Daten (z. B. Internetbrowser, Betriebssystem oder Uhrzeit des Seitenaufrufs). Die Erfassung dieser Daten erfolgt automatisch, sobald Sie diese Website betreten.</p>
<p class="mb-4"><strong>Wofür nutzen wir Ihre Daten?</strong></p>
<p class="mb-4">Ein Teil der Daten wird erhoben, um eine fehlerfreie Bereitstellung der Website zu gewährleisten. Andere Daten können zur Analyse Ihres Nutzerverhaltens verwendet werden.</p>
<p class="mb-4"><strong>Welche Rechte haben Sie bezüglich Ihrer Daten?</strong></p>
<p class="mb-4">Sie haben jederzeit das Recht, unentgeltlich Auskunft über Herkunft, Empfänger und Zweck Ihrer gespeicherten personenbezogenen Daten zu erhalten. Sie haben außerdem ein Recht, die Berichtigung oder Löschung dieser Daten zu verlangen. Wenn Sie eine Einwilligung zur Datenverarbeitung erteilt haben, können Sie diese Einwilligung jederzeit für die Zukunft widerrufen. Außerdem haben Sie das Recht, unter bestimmten Umständen die Einschränkung der Verarbeitung Ihrer personenbezogenen Daten zu verlangen.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">2. Allgemeine Hinweise und Pflichtinformationen</h2>
<h3 class="text-lg font-bold mb-2">Datenschutz</h3>
<p class="mb-4">Die Betreiber dieser Seiten nehmen den Schutz Ihrer persönlichen Daten sehr ernst. Wir behandeln Ihre personenbezogenen Daten vertraulich und entsprechend der gesetzlichen Datenschutzvorschriften sowie dieser Datenschutzerklärung.</p>
<p class="mb-4">Wenn Sie diese Website benutzen, werden verschiedene personenbezogene Daten erhoben. Personenbezogene Daten sind Daten, mit denen Sie persönlich identifiziert werden können. Die vorliegende Datenschutzerklärung erläutert, welche Daten wir erheben und wofür wir sie nutzen. Sie erläutert auch, wie und zu welchem Zweck das geschieht.</p>
<p class="mb-4">Wir weisen darauf hin, dass die Datenübertragung im Internet (z. B. bei der Kommunikation per E-Mail) Sicherheitslücken aufweisen kann. Ein lückenloser Schutz der Daten vor dem Zugriff durch Dritte ist nicht möglich.</p>
<h3 class="text-lg font-bold mb-2">Hinweis zur verantwortlichen Stelle</h3>
<p class="mb-4">Die verantwortliche Stelle für die Datenverarbeitung auf dieser Website ist:</p>
<p class="mb-4">
MindMap GmbH<br>
Musterstraße 123<br>
12345 Musterstadt<br>
Deutschland
</p>
<p class="mb-4">
Telefon: +49 (0) 123 456789<br>
E-Mail: info@mindmap-example.com
</p>
<p class="mb-4">Verantwortliche Stelle ist die natürliche oder juristische Person, die allein oder gemeinsam mit anderen über die Zwecke und Mittel der Verarbeitung von personenbezogenen Daten (z. B. Namen, E-Mail-Adressen o. Ä.) entscheidet.</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">3. Datenerfassung auf dieser Website</h2>
<h3 class="text-lg font-bold mb-2">Cookies</h3>
<p class="mb-4">Unsere Internetseiten verwenden so genannte "Cookies". Cookies sind kleine Datenpakete und richten auf Ihrem Endgerät keinen Schaden an. Sie werden entweder vorübergehend für die Dauer einer Sitzung (Session-Cookies) oder dauerhaft (permanente Cookies) auf Ihrem Endgerät gespeichert. Session-Cookies werden nach Ende Ihres Besuchs automatisch gelöscht. Permanente Cookies bleiben auf Ihrem Endgerät gespeichert, bis Sie diese selbst löschen oder eine automatische Löschung durch Ihren Webbrowser erfolgt.</p>
<p class="mb-4">Cookies können von uns (First-Party-Cookies) oder von Drittunternehmen stammen (sog. Third-Party-Cookies). Third-Party-Cookies ermöglichen die Einbindung bestimmter Dienstleistungen von Drittunternehmen innerhalb von Webseiten (z. B. Cookies zur Abwicklung von Zahlungsdienstleistungen).</p>
<p class="mb-4">Die meisten Browser bieten Ihnen die Möglichkeit, das Setzen von Cookies für bestimmte Webseiten zu verbieten oder Cookies jedes Mal vor dem Akzeptieren anzuzeigen. Ebenso können Sie jederzeit mitgeteilt bekommen, sobald Ihr Browser ein neues Cookie empfängt.</p>
</section>
</div>
</div>
{% endblock %}

33
templates/errors/403.html Normal file
View File

@@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}403 - Zugriff verweigert{% endblock %}
{% block content %}
<div class="min-h-[75vh] flex flex-col items-center justify-center px-4 py-12 bg-gradient-to-b from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
<div class="glass-effect max-w-2xl w-full p-6 md:p-10 rounded-xl border border-gray-300/20 dark:border-gray-700/30 shadow-xl transform transition-all duration-300 hover:shadow-2xl">
<div class="text-center">
<div class="flex justify-center mb-6">
<div class="relative">
<h1 class="text-7xl md:text-8xl font-extrabold text-primary-600 dark:text-primary-400 opacity-90">403</h1>
<div class="absolute -top-4 -right-4 w-12 h-12 bg-red-500 rounded-full flex items-center justify-center animate-pulse">
<i class="fa-solid fa-lock text-white text-xl"></i>
</div>
</div>
</div>
<h2 class="text-2xl md:text-3xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Zugriff verweigert</h2>
<p class="text-gray-600 dark:text-gray-300 mb-8 max-w-lg mx-auto text-base md:text-lg">Sie haben nicht die erforderlichen Berechtigungen, um auf diese Seite zuzugreifen. Bitte melden Sie sich an oder nutzen Sie ein Konto mit entsprechenden Rechten.</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="{{ url_for('index') }}" class="btn-primary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-home mr-2"></i>Zur Startseite
</a>
<a href="javascript:history.back()" class="btn-secondary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-arrow-left mr-2"></i>Zurück
</a>
</div>
</div>
</div>
<div class="mt-8 text-sm text-gray-500 dark:text-gray-400">
<p>Benötigen Sie Hilfe? <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Kontaktieren Sie uns</a></p>
</div>
</div>
{% endblock %}

33
templates/errors/404.html Normal file
View File

@@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}404 - Seite nicht gefunden{% endblock %}
{% block content %}
<div class="min-h-[75vh] flex flex-col items-center justify-center px-4 py-12 bg-gradient-to-b from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
<div class="glass-effect max-w-2xl w-full p-6 md:p-10 rounded-xl border border-gray-300/20 dark:border-gray-700/30 shadow-xl transform transition-all duration-300 hover:shadow-2xl">
<div class="text-center">
<div class="flex justify-center mb-6">
<div class="relative">
<h1 class="text-7xl md:text-8xl font-extrabold text-primary-600 dark:text-primary-400 opacity-90">404</h1>
<div class="absolute -top-4 -right-4 w-12 h-12 bg-yellow-500 rounded-full flex items-center justify-center animate-pulse">
<i class="fa-solid fa-question text-white text-xl"></i>
</div>
</div>
</div>
<h2 class="text-2xl md:text-3xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Seite nicht gefunden</h2>
<p class="text-gray-600 dark:text-gray-300 mb-8 max-w-lg mx-auto text-base md:text-lg">Die gesuchte Seite existiert nicht oder wurde verschoben. Bitte prüfen Sie die URL oder nutzen Sie die Navigation.</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="{{ url_for('index') }}" class="btn-primary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-home mr-2"></i>Zur Startseite
</a>
<a href="javascript:history.back()" class="btn-secondary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-arrow-left mr-2"></i>Zurück
</a>
</div>
</div>
</div>
<div class="mt-8 text-sm text-gray-500 dark:text-gray-400">
<p>Benötigen Sie Hilfe? <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Kontaktieren Sie uns</a></p>
</div>
</div>
{% endblock %}

33
templates/errors/429.html Normal file
View File

@@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}429 - Zu viele Anfragen{% endblock %}
{% block content %}
<div class="min-h-[75vh] flex flex-col items-center justify-center px-4 py-12 bg-gradient-to-b from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
<div class="glass-effect max-w-2xl w-full p-6 md:p-10 rounded-xl border border-gray-300/20 dark:border-gray-700/30 shadow-xl transform transition-all duration-300 hover:shadow-2xl">
<div class="text-center">
<div class="flex justify-center mb-6">
<div class="relative">
<h1 class="text-7xl md:text-8xl font-extrabold text-primary-600 dark:text-primary-400 opacity-90">429</h1>
<div class="absolute -top-4 -right-4 w-12 h-12 bg-orange-500 rounded-full flex items-center justify-center animate-pulse">
<i class="fa-solid fa-hourglass-half text-white text-xl"></i>
</div>
</div>
</div>
<h2 class="text-2xl md:text-3xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Zu viele Anfragen</h2>
<p class="text-gray-600 dark:text-gray-300 mb-8 max-w-lg mx-auto text-base md:text-lg">Sie haben zu viele Anfragen in kurzer Zeit gestellt. Bitte warten Sie einen Moment und versuchen Sie es dann erneut.</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="{{ url_for('index') }}" class="btn-primary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-home mr-2"></i>Zur Startseite
</a>
<a href="javascript:history.back()" class="btn-secondary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-arrow-left mr-2"></i>Zurück
</a>
</div>
</div>
</div>
<div class="mt-8 text-sm text-gray-500 dark:text-gray-400">
<p>Benötigen Sie Hilfe? <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Kontaktieren Sie uns</a></p>
</div>
</div>
{% endblock %}

33
templates/errors/500.html Normal file
View File

@@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}500 - Serverfehler{% endblock %}
{% block content %}
<div class="min-h-[75vh] flex flex-col items-center justify-center px-4 py-12 bg-gradient-to-b from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
<div class="glass-effect max-w-2xl w-full p-6 md:p-10 rounded-xl border border-gray-300/20 dark:border-gray-700/30 shadow-xl transform transition-all duration-300 hover:shadow-2xl">
<div class="text-center">
<div class="flex justify-center mb-6">
<div class="relative">
<h1 class="text-7xl md:text-8xl font-extrabold text-primary-600 dark:text-primary-400 opacity-90">500</h1>
<div class="absolute -top-4 -right-4 w-12 h-12 bg-red-600 rounded-full flex items-center justify-center animate-pulse">
<i class="fa-solid fa-exclamation-triangle text-white text-xl"></i>
</div>
</div>
</div>
<h2 class="text-2xl md:text-3xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Interner Serverfehler</h2>
<p class="text-gray-600 dark:text-gray-300 mb-8 max-w-lg mx-auto text-base md:text-lg">Es ist ein Fehler auf unserem Server aufgetreten. Unser Team wurde informiert und arbeitet bereits an einer Lösung. Bitte versuchen Sie es später erneut.</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="{{ url_for('index') }}" class="btn-primary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-home mr-2"></i>Zur Startseite
</a>
<a href="javascript:history.back()" class="btn-secondary transform transition-transform duration-300 hover:scale-105 px-6 py-3 rounded-lg">
<i class="fa-solid fa-arrow-left mr-2"></i>Zurück
</a>
</div>
</div>
</div>
<div class="mt-8 text-sm text-gray-500 dark:text-gray-400">
<p>Benötigen Sie Hilfe? <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Kontaktieren Sie uns</a></p>
</div>
</div>
{% endblock %}

64
templates/impressum.html Normal file
View File

@@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block title %}Impressum{% endblock %}
{% block content %}
<div class="max-w-3xl mx-auto">
<div class="card p-6 md:p-8">
<h1 class="text-3xl font-bold mb-6 gradient-text">Impressum</h1>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">Angaben gemäß § 5 TMG</h2>
<p class="mb-4">MindMap GmbH<br>
Musterstraße 123<br>
12345 Musterstadt<br>
Deutschland</p>
<p class="mb-4">
<strong>Vertreten durch:</strong><br>
Max Mustermann, Geschäftsführer
</p>
<p class="mb-4">
<strong>Kontakt:</strong><br>
Telefon: +49 (0) 123 456789<br>
E-Mail: info@mindmap-example.com
</p>
<p class="mb-4">
<strong>Registereintrag:</strong><br>
Eintragung im Handelsregister.<br>
Registergericht: Amtsgericht Musterstadt<br>
Registernummer: HRB 12345
</p>
<p class="mb-4">
<strong>Umsatzsteuer-ID:</strong><br>
Umsatzsteuer-Identifikationsnummer gemäß §27 a Umsatzsteuergesetz:<br>
DE 123456789
</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">Redaktionell verantwortlich</h2>
<p>
Max Mustermann<br>
Musterstraße 123<br>
12345 Musterstadt
</p>
</section>
<section class="mb-8">
<h2 class="text-xl font-bold mb-4">Haftungsausschluss</h2>
<h3 class="text-lg font-bold mb-2">Haftung für Inhalte</h3>
<p class="mb-4">Als Diensteanbieter sind wir gemäß § 7 Abs.1 TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich. Nach §§ 8 bis 10 TMG sind wir als Diensteanbieter jedoch nicht verpflichtet, übermittelte oder gespeicherte fremde Informationen zu überwachen oder nach Umständen zu forschen, die auf eine rechtswidrige Tätigkeit hinweisen.</p>
<p class="mb-4">Verpflichtungen zur Entfernung oder Sperrung der Nutzung von Informationen nach den allgemeinen Gesetzen bleiben hiervon unberührt. Eine diesbezügliche Haftung ist jedoch erst ab dem Zeitpunkt der Kenntnis einer konkreten Rechtsverletzung möglich. Bei Bekanntwerden von entsprechenden Rechtsverletzungen werden wir diese Inhalte umgehend entfernen.</p>
<h3 class="text-lg font-bold mb-2">Haftung für Links</h3>
<p class="mb-4">Unser Angebot enthält Links zu externen Websites Dritter, auf deren Inhalte wir keinen Einfluss haben. Deshalb können wir für diese fremden Inhalte auch keine Gewähr übernehmen. Für die Inhalte der verlinkten Seiten ist stets der jeweilige Anbieter oder Betreiber der Seiten verantwortlich. Die verlinkten Seiten wurden zum Zeitpunkt der Verlinkung auf mögliche Rechtsverstöße überprüft. Rechtswidrige Inhalte waren zum Zeitpunkt der Verlinkung nicht erkennbar.</p>
<p>Eine permanente inhaltliche Kontrolle der verlinkten Seiten ist jedoch ohne konkrete Anhaltspunkte einer Rechtsverletzung nicht zumutbar. Bei Bekanntwerden von Rechtsverletzungen werden wir derartige Links umgehend entfernen.</p>
</section>
</div>
</div>
{% endblock %}

520
templates/index.html Normal file
View File

@@ -0,0 +1,520 @@
{% extends "base.html" %}
{% block title %}Wissensnetzwerk{% endblock %}
{% block extra_css %}
<style>
/* Full height and width for the page */
html, body {
min-height: 100vh;
width: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* Remove gradient backgrounds */
.hero-gradient, .bg-fade {
background: none !important;
clip-path: none !important;
}
/* Style elements */
.mystical-line {
height: 1px;
background: linear-gradient(to right, transparent, rgba(109, 40, 217, 0.2), transparent);
}
.dark .mystical-line {
background: linear-gradient(to right, transparent, rgba(139, 92, 246, 0.2), transparent);
}
/* Text reveal animation */
@keyframes textReveal {
0% { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); }
100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}
.text-reveal {
animation: textReveal 1s cubic-bezier(0.77, 0, 0.18, 1) forwards;
}
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
/* Home page specific styles */
.featured-card {
transition: transform 0.5s ease, box-shadow 0.5s ease;
border: 1px solid;
border-color: rgba(139, 92, 246, 0.1);
}
.dark .featured-card {
border-color: rgba(109, 40, 217, 0.2);
background-color: rgba(17, 24, 39, 0.7);
}
.featured-card:hover {
transform: translateY(-5px);
}
.dark .featured-card:hover {
box-shadow: 0 5px 15px rgba(109, 40, 217, 0.2);
border-color: rgba(109, 40, 217, 0.3);
}
.featured-card:hover {
box-shadow: 0 5px 15px rgba(139, 92, 246, 0.1);
border-color: rgba(139, 92, 246, 0.2);
}
/* Chat section styles */
.embedded-chat {
height: 350px;
border-radius: 1rem;
overflow: hidden;
transition: all 0.3s ease;
border: 1px solid;
}
.dark .embedded-chat {
background-color: rgba(17, 24, 39, 0.7);
border-color: rgba(109, 40, 217, 0.2);
}
.embedded-chat {
background-color: rgba(255, 255, 255, 0.7);
border-color: rgba(139, 92, 246, 0.1);
}
#embedded-chat-messages {
height: 250px;
overflow-y: auto;
padding: 1rem;
}
/* Chat typing indicator */
.typing-dots span {
display: inline-block;
width: 5px;
height: 5px;
border-radius: 50%;
margin-right: 3px;
background-color: currentColor;
opacity: 0.5;
}
.typing-dots span:nth-child(1) {
animation: dot-pulse 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) {
animation: dot-pulse 1.2s infinite ease-in-out 0.2s;
}
.typing-dots span:nth-child(3) {
animation: dot-pulse 1.2s infinite ease-in-out 0.4s;
}
@keyframes dot-pulse {
0%, 100% { transform: scale(1); opacity: 0.5; }
50% { transform: scale(1.3); opacity: 1; }
}
</style>
{% endblock %}
{% block content %}
<!-- Hero Section -->
<section class="relative pt-20 pb-24">
<!-- Hero Content -->
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
<div class="text-center mb-16">
<h1 class="hero-heading mb-8 text-gray-900 dark:text-white">
<div class="overflow-hidden">
<span class="gradient-text inline-block text-reveal">Wissen</span>
</div>
<div class="overflow-hidden mt-2">
<span class="inline-block text-reveal delay-1">neu</span>
</div>
<div class="mt-2 relative overflow-hidden">
<span class="relative inline-block text-reveal delay-2">vernetzen
<div class="absolute -bottom-2 left-0 right-0 h-1 bg-gradient-to-r from-purple-500/0 via-purple-500/70 to-purple-500/0 rounded-full"></div>
</span>
</div>
</h1>
<div class="overflow-hidden">
<p class="text-xl md:text-2xl text-gray-700 dark:text-gray-300 max-w-3xl mx-auto mb-12 text-reveal delay-3">
Erkunde komplexe Ideen visuell, schaffe Verbindungen und teile deine Gedanken
in einem interaktiven Wissensnetzwerk.
</p>
</div>
<div class="flex flex-col sm:flex-row gap-5 justify-center">
<a href="{{ url_for('mindmap') }}" class="mystical-button mystical-button-primary group transition-all duration-300">
<span class="flex items-center justify-center">
<i class="fa-solid fa-diagram-project mr-3 text-purple-200 group-hover:text-white transition-all duration-300"></i>
<span class="relative">
Mindmap erkunden
<span class="absolute -bottom-1 left-0 w-0 h-0.5 bg-white group-hover:w-full transition-all duration-300"></span>
</span>
</span>
</a>
{% if not current_user.is_authenticated %}
<a href="{{ url_for('register') }}" class="mystical-button mystical-button-secondary group transition-all duration-300">
<span class="flex items-center justify-center">
<i class="fa-solid fa-user-plus mr-3 group-hover:text-accent-secondary-dark dark:group-hover:text-accent-secondary-light transition-all duration-300"></i>
<span class="relative">
Konto erstellen
<span class="absolute -bottom-1 left-0 w-0 h-0.5 bg-accent-primary-light dark:bg-accent-primary-dark group-hover:w-full transition-all duration-300"></span>
</span>
</span>
</a>
{% endif %}
</div>
</div>
<!-- Central logo and name -->
<div class="relative w-full max-w-4xl mx-auto h-40 sm:h-60 mb-16">
<div class="absolute inset-0 flex items-center justify-center">
<div class="text-center">
<div class="text-3xl font-bold gradient-text mb-2 animate-float">Systades</div>
<div class="text-lg text-gray-700 dark:text-gray-300">WISSEN VERNETZEN</div>
</div>
</div>
</div>
</div>
</section>
<!-- Features Section -->
<section class="py-20 relative">
<div class="mystical-line absolute top-0 left-1/2 transform -translate-x-1/2 w-1/3"></div>
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-16">
<h2 class="section-heading mb-4 text-gray-900 dark:text-white">Was ist <span class="gradient-text">Systades?</span></h2>
<p class="text-lg text-gray-700 dark:text-gray-300 max-w-3xl mx-auto">
Ein modernes Werkzeug zum Visualisieren, Erforschen und Teilen von Wissen in einem interaktiven
Netzwerk, das dir hilft, Verbindungen zu entdecken und dein Wissen zu organisieren.
</p>
</div>
<!-- Feature Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-8 mb-12">
<!-- Feature 1: Visualize -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm">
<div class="mb-4 text-purple-600 dark:text-purple-400">
<i class="fa-solid fa-diagram-project text-3xl"></i>
</div>
<h3 class="text-xl font-semibold mb-2 text-gray-900 dark:text-white">Visualisiere Wissen</h3>
<p class="text-gray-700 dark:text-gray-300">
Organisiere Gedanken und Ideen in einem interaktiven Netzwerk, das komplexe Beziehungen
visuell darstellt und neue Verbindungen offenbart.
</p>
</div>
<!-- Feature 2: Connect -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm">
<div class="mb-4 text-indigo-600 dark:text-indigo-400">
<i class="fa-solid fa-network-wired text-3xl"></i>
</div>
<h3 class="text-xl font-semibold mb-2 text-gray-900 dark:text-white">Verknüpfe Gedanken</h3>
<p class="text-gray-700 dark:text-gray-300">
Entdecke Zusammenhänge zwischen scheinbar unzusammenhängenden Ideen und schaffe dein
persönliches Wissensnetzwerk über verschiedene Bereiche hinweg.
</p>
</div>
<!-- Feature 3: Share -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm">
<div class="mb-4 text-purple-600 dark:text-purple-400">
<i class="fa-solid fa-share-nodes text-3xl"></i>
</div>
<h3 class="text-xl font-semibold mb-2 text-gray-900 dark:text-white">Teile und Entdecke</h3>
<p class="text-gray-700 dark:text-gray-300">
Tausche Erkenntnisse mit anderen aus und erweitere dein Wissen durch die
Perspektiven und Gedanken der Community.
</p>
</div>
</div>
</div>
</section>
<!-- AI Assistant Preview -->
<section class="py-20 relative">
<div class="mystical-line absolute top-0 left-1/2 transform -translate-x-1/2 w-1/3"></div>
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-12">
<h2 class="section-heading mb-4 text-gray-900 dark:text-white">Dein <span class="gradient-text">KI-Assistent</span></h2>
<p class="text-lg text-gray-700 dark:text-gray-300 max-w-3xl mx-auto">
Unser integrierter KI-Assistent hilft dir, Wissen zu organisieren, Verbindungen zu finden und
Einsichten zu gewinnen.
</p>
</div>
<!-- Chat Interface Preview -->
<div class="max-w-3xl mx-auto">
<div class="embedded-chat" id="demo-chat">
<!-- Chat Header -->
<div class="p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-gradient-to-r from-purple-600 to-indigo-600 flex items-center justify-center text-white mr-3">
<i class="fa-solid fa-robot text-sm"></i>
</div>
<span class="font-medium text-gray-800 dark:text-gray-200">Systades Assistent (4o-mini)</span>
</div>
<div>
<button id="open-real-assistant" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
<i class="fa-solid fa-expand"></i>
</button>
</div>
</div>
<!-- Chat Messages -->
<div id="embedded-chat-messages" class="border-b border-gray-200 dark:border-gray-700">
<!-- Assistant Message -->
<div class="mb-4 flex">
<div class="w-8 h-8 rounded-full bg-gradient-to-r from-purple-600 to-indigo-600 flex items-center justify-center text-white mr-2 flex-shrink-0">
<i class="fa-solid fa-robot text-sm"></i>
</div>
<div class="bg-gray-100 dark:bg-gray-800 rounded-lg p-3 max-w-[80%]">
<div class="text-gray-700 dark:text-gray-300 markdown-content">
<p>Hallo! Ich bin dein Systades-Assistent. Wie kann ich dir heute helfen?</p>
<p>Du kannst mir Fragen zu:</p>
<ul>
<li><strong>Gedanken</strong> in der Datenbank</li>
<li><strong>Kategorien</strong> und Wissensgebieten</li>
<li><strong>Mindmaps</strong> und Visualisierungsmöglichkeiten</li>
</ul>
<p>stellen.</p>
</div>
</div>
</div>
<!-- User Message -->
<div class="mb-4 flex justify-end">
<div class="bg-purple-100 dark:bg-purple-900/30 rounded-lg p-3 max-w-[80%]">
<p class="text-gray-800 dark:text-gray-200">
Kann ich mit deiner Hilfe eine Mindmap zum Thema Künstliche Intelligenz erstellen?
</p>
</div>
<div class="w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center text-gray-700 dark:text-gray-300 ml-2 flex-shrink-0">
<i class="fa-solid fa-user text-sm"></i>
</div>
</div>
<!-- Assistant Response -->
<div class="mb-4 flex" id="demo-ai-response">
<div class="w-8 h-8 rounded-full bg-gradient-to-r from-purple-600 to-indigo-600 flex items-center justify-center text-white mr-2 flex-shrink-0">
<i class="fa-solid fa-robot text-sm"></i>
</div>
<div class="bg-gray-100 dark:bg-gray-800 rounded-lg p-3 max-w-[80%]">
<div class="text-gray-700 dark:text-gray-300 markdown-content">
<p>Ja, natürlich! Ich kann dir dabei helfen, eine Mindmap zum Thema <strong>Künstliche Intelligenz</strong> zu erstellen.</p>
<p>Du kannst wie folgt vorgehen:</p>
<ol>
<li>Gehe zur <strong>Mindmap</strong>-Ansicht</li>
<li>Suche nach dem Knoten "Künstliche Intelligenz" unter der Kategorie "Technologie"</li>
<li>Füge diesen Knoten zu deiner persönlichen Mindmap hinzu</li>
<li>Ergänze verwandte Themen wie <em>Machine Learning, Neural Networks oder Data Science</em></li>
</ol>
<p>Soll ich dir noch mehr spezifische Informationen zu KI-Teilgebieten geben?</p>
</div>
</div>
</div>
</div>
<!-- Chat Input -->
<div class="p-4">
<div class="flex">
<input type="text" placeholder="Stelle eine Frage..." class="mystical-input flex-grow" disabled>
<button class="ml-2 bg-gradient-to-r from-purple-600 to-indigo-600 text-white p-2 rounded-lg disabled:opacity-50" disabled>
<i class="fa-solid fa-paper-plane"></i>
</button>
</div>
<!-- Quick Queries -->
<div class="mt-3 flex flex-wrap gap-2">
<span class="text-xs text-gray-500 dark:text-gray-400 mr-1">Beispiele:</span>
<button data-question="Was sind die wichtigsten Grundlagen der Künstlichen Intelligenz?" class="quick-query-btn text-xs px-2 py-1 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 cursor-pointer transition-colors">KI-Grundlagen</button>
<button data-question="Wie kann ich eine Mindmap zum Thema Neuronale Netzwerke erstellen?" class="quick-query-btn text-xs px-2 py-1 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 cursor-pointer transition-colors">Mindmap erstellen</button>
<button data-question="Zeige mir alle verfügbaren Kategorien in der Datenbank" class="quick-query-btn text-xs px-2 py-1 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 cursor-pointer transition-colors">Datenbank durchsuchen</button>
</div>
</div>
</div>
</div>
<!-- Try it Button -->
<div class="text-center mt-10">
<button onclick="window.MindMap && window.MindMap.assistant && window.MindMap.assistant.sendQuestion('Hallo! Ich möchte mehr über die Funktionen der Wissensdatenbank erfahren. Was kann ich hier alles machen?')"
class="mystical-button mystical-button-primary inline-flex items-center">
<i class="fa-solid fa-robot mr-2"></i>
KI-Assistenten ausprobieren
</button>
</div>
</div>
</section>
<!-- Getting Started Section -->
<section class="py-20 relative">
<div class="mystical-line absolute top-0 left-1/2 transform -translate-x-1/2 w-1/3"></div>
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-12">
<h2 class="section-heading mb-4 text-gray-900 dark:text-white">So <span class="gradient-text">funktioniert's</span></h2>
<p class="text-lg text-gray-700 dark:text-gray-300 max-w-3xl mx-auto">
In wenigen einfachen Schritten kannst du mit Systades beginnen, dein Wissen zu organisieren.
</p>
</div>
<!-- Step Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<!-- Step 1 -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm relative overflow-hidden">
<div class="absolute top-4 right-4 w-10 h-10 rounded-full bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center text-purple-600 dark:text-purple-400 font-bold">
1
</div>
<h3 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Konto erstellen</h3>
<p class="text-gray-700 dark:text-gray-300 mb-4">
Registriere dich für ein kostenloses Konto, um deine persönliche Wissenslandschaft zu erstellen.
</p>
{% if not current_user.is_authenticated %}
<a href="{{ url_for('register') }}" class="text-purple-600 dark:text-purple-400 hover:underline">
Jetzt registrieren <i class="fa-solid fa-arrow-right ml-1"></i>
</a>
{% endif %}
</div>
<!-- Step 2 -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm relative overflow-hidden">
<div class="absolute top-4 right-4 w-10 h-10 rounded-full bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center text-purple-600 dark:text-purple-400 font-bold">
2
</div>
<h3 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Mindmap erkunden</h3>
<p class="text-gray-700 dark:text-gray-300 mb-4">
Entdecke die öffentliche Wissensmindmap und füge Knoten zu deiner persönlichen Landschaft hinzu.
</p>
<a href="{{ url_for('mindmap') }}" class="text-purple-600 dark:text-purple-400 hover:underline">
Zur Mindmap <i class="fa-solid fa-arrow-right ml-1"></i>
</a>
</div>
<!-- Step 3 -->
<div class="featured-card rounded-2xl p-6 bg-white/80 dark:bg-gray-800/30 backdrop-blur-sm relative overflow-hidden">
<div class="absolute top-4 right-4 w-10 h-10 rounded-full bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center text-purple-600 dark:text-purple-400 font-bold">
3
</div>
<h3 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Gedanken teilen</h3>
<p class="text-gray-700 dark:text-gray-300 mb-4">
Teile deine eigenen Gedanken, verbinde sie mit vorhandenen Knoten und baue das kollektive Wissen aus.
</p>
{% if current_user.is_authenticated %}
<a href="{{ url_for('profile') }}" class="text-purple-600 dark:text-purple-400 hover:underline">
Zum Profil <i class="fa-solid fa-arrow-right ml-1"></i>
</a>
{% else %}
<a href="{{ url_for('login') }}" class="text-purple-600 dark:text-purple-400 hover:underline">
Jetzt anmelden <i class="fa-solid fa-arrow-right ml-1"></i>
</a>
{% endif %}
</div>
</div>
</div>
</section>
<!-- Call to Action -->
<section class="py-20 relative">
<div class="mystical-line absolute top-0 left-1/2 transform -translate-x-1/2 w-1/3"></div>
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h2 class="section-heading mb-6 text-gray-900 dark:text-white">Bereit, dein <span class="gradient-text">Wissen zu vernetzen</span>?</h2>
<p class="text-lg text-gray-700 dark:text-gray-300 mb-8">
Tritt unserer wachsenden Community bei und entdecke eine neue Art, Wissen zu organisieren und zu teilen.
</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="{{ url_for('mindmap') }}" class="mystical-button mystical-button-primary">
<i class="fa-solid fa-diagram-project mr-2"></i> Mindmap erkunden
</a>
{% if not current_user.is_authenticated %}
<a href="{{ url_for('register') }}" class="mystical-button mystical-button-secondary">
<i class="fa-solid fa-user-plus mr-2"></i> Konto erstellen
</a>
{% endif %}
</div>
</div>
</section>
{% endblock %}
{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function() {
// Expand-Button mit dem echten Assistenten verknüpfen
const openRealAssistantBtn = document.getElementById('open-real-assistant');
if (openRealAssistantBtn) {
openRealAssistantBtn.addEventListener('click', function() {
if (window.MindMap && window.MindMap.assistant) {
window.MindMap.assistant.toggleAssistant(true);
}
});
}
// Auch die Beispiel-Buttons im Demo-Chat klickbar machen
const quickQueryButtons = document.querySelectorAll('.quick-query-btn');
quickQueryButtons.forEach(button => {
button.addEventListener('click', function() {
if (window.MindMap && window.MindMap.assistant) {
const question = button.getAttribute('data-question');
if (question) {
window.MindMap.assistant.sendQuestion(question);
} else {
// Fallback auf den Button-Text, falls kein data-question Attribut gesetzt ist
const queryText = button.textContent.trim();
window.MindMap.assistant.sendQuestion(queryText);
}
}
});
});
// Styling für die markdown-content hinzufügen
const style = document.createElement('style');
style.textContent = `
.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
font-weight: bold;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.markdown-content h1 { font-size: 1.4rem; }
.markdown-content h2 { font-size: 1.3rem; }
.markdown-content h3 { font-size: 1.2rem; }
.markdown-content h4 { font-size: 1.1rem; }
.markdown-content ul, .markdown-content ol {
padding-left: 1.5rem;
margin: 0.5rem 0;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content p { margin: 0.5rem 0; }
.markdown-content code {
font-family: monospace;
background-color: rgba(0, 0, 0, 0.1);
padding: 1px 4px;
border-radius: 3px;
}
.markdown-content pre {
background-color: rgba(0, 0, 0, 0.1);
padding: 0.5rem;
border-radius: 4px;
overflow-x: auto;
margin: 0.5rem 0;
}
.dark .markdown-content code {
background-color: rgba(255, 255, 255, 0.1);
}
.dark .markdown-content pre {
background-color: rgba(255, 255, 255, 0.1);
}
`;
document.head.appendChild(style);
});
</script>
{% endblock %}

11
templates/layout.html Normal file
View File

@@ -0,0 +1,11 @@
<!-- Navigation -->
<header class="w-full">
<nav class="fixed top-0 z-50 w-full bg-dark-900 border-b border-gray-700">
<!-- ... existing code ... -->
</nav>
</header>
<!-- Main Content Container -->
<div class="container mx-auto px-4 pt-20 pb-10">
<!-- ... existing code ... -->
</div>

55
templates/login.html Normal file
View File

@@ -0,0 +1,55 @@
{% extends "base.html" %}
{% block title %}Anmelden{% endblock %}
{% block content %}
<div class="flex justify-center items-center min-h-screen px-4 py-12">
<div class="w-full max-w-md">
<div class="bg-white bg-opacity-20 backdrop-blur-lg rounded-xl shadow-xl overflow-hidden transition-all duration-300 hover:shadow-2xl">
<div class="p-6 sm:p-8">
<h2 class="text-center text-2xl font-bold text-gray-800 mb-6">
<i class="fas fa-sign-in-alt mr-2"></i>
Anmelden
</h2>
<form method="POST" action="{{ url_for('login') }}" class="space-y-6">
<div class="space-y-2">
<label for="username" class="block text-sm font-medium text-gray-700">Benutzername</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user text-gray-400"></i>
</div>
<input type="text" id="username" name="username" required
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
placeholder="Benutzername eingeben">
</div>
</div>
<div class="space-y-2">
<label for="password" class="block text-sm font-medium text-gray-700">Passwort</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-gray-400"></i>
</div>
<input type="password" id="password" name="password" required
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"
placeholder="Passwort eingeben">
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200">
<i class="fas fa-sign-in-alt mr-2"></i> Anmelden
</button>
</div>
<div class="text-center text-sm text-gray-600">
<p>Noch kein Konto? <a href="{{ url_for('register') }}" class="font-medium text-blue-600 hover:text-blue-500 transition-colors">Registrieren</a></p>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

852
templates/mindmap.html Normal file
View File

@@ -0,0 +1,852 @@
{% extends "base.html" %}
{% block title %}Mindmap{% endblock %}
{% block extra_css %}
<style>
/* Full page background */
html, body {
min-height: 100vh;
width: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* Mindmap Container */
#mindmap-container {
position: relative;
min-height: calc(100vh - 160px);
z-index: 1;
}
/* Control Panel */
.control-panel {
position: fixed;
top: 100px;
left: 20px;
z-index: 10;
transition: all 0.3s ease;
border-radius: 1rem;
overflow: hidden;
border: 1px solid;
}
.dark .control-panel {
background-color: rgba(17, 24, 39, 0.8);
border-color: rgba(109, 40, 217, 0.3);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.control-panel {
background-color: rgba(255, 255, 255, 0.85);
border-color: rgba(139, 92, 246, 0.2);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
/* Control Panel Toggle */
.panel-toggle {
position: absolute;
top: 8px;
right: 8px;
z-index: 2;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s ease;
}
.dark .panel-toggle {
background-color: rgba(109, 40, 217, 0.2);
color: rgba(255, 255, 255, 0.8);
}
.panel-toggle {
background-color: rgba(139, 92, 246, 0.1);
color: rgba(30, 41, 59, 0.8);
}
.panel-toggle:hover {
transform: rotate(180deg);
}
/* Category Tree */
.category-tree {
max-height: 70vh;
overflow-y: auto;
}
.category-item {
transition: all 0.3s ease;
border-left: 2px solid transparent;
cursor: pointer;
}
.dark .category-item:hover {
background-color: rgba(109, 40, 217, 0.1);
border-left-color: rgba(139, 92, 246, 0.5);
}
.category-item:hover {
background-color: rgba(139, 92, 246, 0.05);
border-left-color: rgba(139, 92, 246, 0.5);
}
/* Node List */
.node-list {
max-height: 300px;
overflow-y: auto;
}
.node-item {
transition: all 0.3s ease;
border-radius: 0.5rem;
cursor: pointer;
}
.dark .node-item {
background-color: rgba(31, 41, 55, 0.5);
border: 1px solid rgba(55, 65, 81, 0.5);
}
.node-item {
background-color: rgba(255, 255, 255, 0.5);
border: 1px solid rgba(226, 232, 240, 0.5);
}
.dark .node-item:hover {
background-color: rgba(55, 65, 81, 0.7);
border-color: rgba(139, 92, 246, 0.5);
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.node-item:hover {
background-color: rgba(255, 255, 255, 0.8);
border-color: rgba(139, 92, 246, 0.3);
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
/* Node Counter Badge */
.node-counter {
min-width: 20px;
height: 20px;
border-radius: 10px;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 500;
padding: 0 6px;
}
.dark .node-counter {
background-color: rgba(109, 40, 217, 0.3);
color: rgba(255, 255, 255, 0.9);
}
.node-counter {
background-color: rgba(139, 92, 246, 0.1);
color: rgba(109, 40, 217, 0.9);
}
/* Canvas area */
#mindmap-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 1;
}
/* Tooltip */
.tooltip-container {
position: absolute;
pointer-events: none;
z-index: 1000;
max-width: 300px;
opacity: 0;
transition: opacity 0.3s ease;
}
.dark .tooltip-container {
background-color: rgba(17, 24, 39, 0.9);
border: 1px solid rgba(109, 40, 217, 0.3);
color: rgba(255, 255, 255, 0.9);
}
.tooltip-container {
background-color: rgba(255, 255, 255, 0.95);
border: 1px solid rgba(139, 92, 246, 0.2);
color: rgba(30, 41, 59, 0.9);
}
/* Search input */
.search-input {
transition: all 0.3s ease;
width: 100%;
border-radius: 0.5rem;
padding: 0.5rem 0.75rem;
outline: none;
}
.dark .search-input {
background-color: rgba(31, 41, 55, 0.7);
border: 1px solid rgba(55, 65, 81, 0.5);
color: rgba(255, 255, 255, 0.9);
}
.search-input {
background-color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(226, 232, 240, 0.8);
color: rgba(30, 41, 59, 0.9);
}
.dark .search-input:focus {
border-color: rgba(139, 92, 246, 0.5);
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
.search-input:focus {
border-color: rgba(139, 92, 246, 0.3);
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}
/* Mode toggle */
.mode-toggle {
padding: 0.5rem 1rem;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 500;
}
.dark .mode-toggle {
background-color: rgba(31, 41, 55, 0.5);
border: 1px solid rgba(55, 65, 81, 0.5);
color: rgba(255, 255, 255, 0.9);
}
.mode-toggle {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(226, 232, 240, 0.8);
color: rgba(30, 41, 59, 0.9);
}
.dark .mode-toggle.active {
background-color: rgba(109, 40, 217, 0.2);
border-color: rgba(139, 92, 246, 0.4);
color: rgba(255, 255, 255, 1);
}
.mode-toggle.active {
background-color: rgba(139, 92, 246, 0.1);
border-color: rgba(139, 92, 246, 0.3);
color: rgba(109, 40, 217, 1);
}
/* User Mindmaps */
.user-mindmap-section {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 10;
transition: all 0.3s ease;
border-radius: 1rem;
overflow: hidden;
max-width: 350px;
}
.dark .user-mindmap-section {
background-color: rgba(17, 24, 39, 0.85);
border: 1px solid rgba(109, 40, 217, 0.3);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.user-mindmap-section {
background-color: rgba(255, 255, 255, 0.9);
border: 1px solid rgba(139, 92, 246, 0.2);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
/* User Mindmap List */
.user-mindmap-item {
transition: all 0.3s ease;
border-radius: 0.5rem;
cursor: pointer;
}
.dark .user-mindmap-item {
background-color: rgba(31, 41, 55, 0.5);
border: 1px solid rgba(55, 65, 81, 0.5);
}
.user-mindmap-item {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(226, 232, 240, 0.7);
}
.dark .user-mindmap-item:hover {
background-color: rgba(55, 65, 81, 0.7);
border-color: rgba(139, 92, 246, 0.4);
transform: translateY(-2px);
}
.user-mindmap-item:hover {
background-color: rgba(255, 255, 255, 0.9);
border-color: rgba(139, 92, 246, 0.3);
transform: translateY(-2px);
}
/* Zoom Controls */
.zoom-controls {
position: fixed;
bottom: 20px;
left: 20px;
z-index: 10;
display: flex;
gap: 0.5rem;
border-radius: 2rem;
padding: 0.5rem;
transition: all 0.3s ease;
}
.dark .zoom-controls {
background-color: rgba(17, 24, 39, 0.7);
border: 1px solid rgba(55, 65, 81, 0.5);
}
.zoom-controls {
background-color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(226, 232, 240, 0.7);
}
.zoom-btn {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s ease;
}
.dark .zoom-btn {
background-color: rgba(31, 41, 55, 0.7);
color: rgba(255, 255, 255, 0.9);
}
.zoom-btn {
background-color: rgba(255, 255, 255, 0.9);
color: rgba(30, 41, 59, 0.9);
}
.dark .zoom-btn:hover {
background-color: rgba(139, 92, 246, 0.3);
color: rgba(255, 255, 255, 1);
}
.zoom-btn:hover {
background-color: rgba(139, 92, 246, 0.1);
color: rgba(109, 40, 217, 1);
}
/* Loading spinner */
.spinner {
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top: 3px solid;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
}
.dark .spinner {
border-top-color: rgba(139, 92, 246, 0.7);
}
.spinner {
border-top-color: rgba(109, 40, 217, 0.7);
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
{% endblock %}
{% block content %}
<!-- Mindmap Container -->
<div id="mindmap-container">
<!-- Main Canvas -->
<div id="mindmap-canvas"></div>
<!-- Control Panel -->
<div class="control-panel p-4 w-64">
<div class="panel-toggle" @click="isExpanded = !isExpanded">
<i class="fa-solid" :class="isExpanded ? 'fa-chevron-left' : 'fa-chevron-right'"></i>
</div>
<div x-show="isExpanded">
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Wissensbereiche</h2>
<!-- Search Box -->
<div class="mb-4">
<input type="text" id="category-search" class="search-input" placeholder="Bereich suchen...">
</div>
<!-- Category Tree -->
<div class="category-tree" id="category-tree">
<div id="categories-container" class="space-y-1">
<!-- Categories will be loaded dynamically -->
<div class="py-3 text-center text-gray-500 dark:text-gray-400" id="loading-categories">
<div class="spinner mx-auto mb-2"></div>
<p>Kategorien werden geladen...</p>
</div>
</div>
</div>
<!-- View Mode Toggle -->
<div class="mt-4">
<h3 class="text-sm font-medium mb-2 text-gray-700 dark:text-gray-300">Ansicht</h3>
<div class="flex justify-between gap-2">
<button id="view-all" class="mode-toggle text-sm flex-1 active">
<i class="fa-solid fa-diagram-project mr-1"></i> Alles
</button>
<button id="view-focused" class="mode-toggle text-sm flex-1">
<i class="fa-solid fa-bullseye mr-1"></i> Fokus
</button>
</div>
</div>
</div>
</div>
<!-- User Mindmaps Section -->
{% if current_user.is_authenticated %}
<div class="user-mindmap-section p-4 w-64">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Meine Mindmaps</h2>
<button @click="isExpanded = !isExpanded" class="text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200">
<i class="fa-solid" :class="isExpanded ? 'fa-chevron-down' : 'fa-chevron-up'"></i>
</button>
</div>
<div x-show="isExpanded">
<!-- User Mindmap List -->
<div class="space-y-2 max-h-60 overflow-y-auto mb-3">
<!-- Will be populated by JS -->
<div id="user-mindmaps-list" class="space-y-2">
<div class="py-3 text-center text-gray-500 dark:text-gray-400" id="loading-mindmaps">
<div class="spinner mx-auto mb-2"></div>
<p>Mindmaps werden geladen...</p>
</div>
</div>
</div>
<!-- Add New Mindmap Button -->
<a href="{{ url_for('create_mindmap') }}" class="mystical-button mystical-button-primary w-full text-center text-sm">
<i class="fa-solid fa-plus mr-1"></i> Neue Mindmap erstellen
</a>
</div>
</div>
{% endif %}
<!-- Zoom Controls -->
<div class="zoom-controls">
<button id="zoom-in" class="zoom-btn">
<i class="fa-solid fa-plus"></i>
</button>
<button id="zoom-out" class="zoom-btn">
<i class="fa-solid fa-minus"></i>
</button>
<button id="reset-view" class="zoom-btn">
<i class="fa-solid fa-home"></i>
</button>
</div>
<!-- Node Tooltip -->
<div id="node-tooltip" class="tooltip-container rounded-lg p-4 shadow-lg"></div>
</div>
{% endblock %}
{% block extra_js %}
<!-- D3.js for Mindmap Visualization -->
<script src="https://d3js.org/d3.v7.min.js"></script>
<!-- Custom D3 Extensions -->
<script src="{{ url_for('static', filename='d3-extensions.js') }}"></script>
<!-- Mindmap Visualisierungsmodul -->
<script src="{{ url_for('static', filename='js/modules/mindmap.js') }}"></script>
<script>
// Initialize the public mindmap
document.addEventListener('DOMContentLoaded', function() {
console.log('Mindmap-Seite wird initialisiert...');
// Prüfe, ob D3.js geladen ist
if (typeof d3 === 'undefined') {
console.error('D3.js Bibliothek ist nicht geladen!');
document.getElementById('mindmap-container').innerHTML =
'<div class="glass-effect p-6 text-center">' +
'<div class="text-red-500 mb-4">' +
'<i class="fa-solid fa-triangle-exclamation text-4xl"></i>' +
'</div>' +
'<p class="text-xl">D3.js konnte nicht geladen werden. Bitte laden Sie die Seite neu.</p>' +
'</div>';
return;
}
// Prüfe, ob MindMapVisualization geladen ist
if (typeof MindMapVisualization === 'undefined') {
console.error('MindMapVisualization-Klasse ist nicht geladen!');
document.getElementById('mindmap-container').innerHTML =
'<div class="glass-effect p-6 text-center">' +
'<div class="text-red-500 mb-4">' +
'<i class="fa-solid fa-triangle-exclamation text-4xl"></i>' +
'</div>' +
'<p class="text-xl">Die Mindmap-Visualisierung konnte nicht geladen werden. Bitte laden Sie die Seite neu.</p>' +
'</div>';
return;
}
// Set up for dark/light mode changes
const isDarkMode = document.documentElement.classList.contains('dark');
// Initialize the node tooltip
const tooltip = document.getElementById('node-tooltip');
try {
console.log('Erstelle MindMapVisualization...');
// Mindmap-Visualisierung initialisieren
const mindmap = new MindMapVisualization('#mindmap-canvas', {
height: document.getElementById('mindmap-container').clientHeight || 600,
tooltipEnabled: true,
onNodeClick: function(node) {
console.log('Knoten geklickt:', node);
}
});
// Speichere als globale Instanz für Zugriff über Buttons
window.mindmapInstance = mindmap;
// Lade die Mindmap-Daten
mindmap.loadData();
console.log('Mindmap-Visualisierung erfolgreich erstellt');
// View mode toggle
document.getElementById('view-all').addEventListener('click', function() {
this.classList.add('active');
document.getElementById('view-focused').classList.remove('active');
if (window.mindmapInstance && window.mindmapInstance.setViewMode) {
window.mindmapInstance.setViewMode('all');
}
});
document.getElementById('view-focused').addEventListener('click', function() {
this.classList.add('active');
document.getElementById('view-all').classList.remove('active');
if (window.mindmapInstance && window.mindmapInstance.setViewMode) {
window.mindmapInstance.setViewMode('focus');
}
});
// Zoom controls
document.getElementById('zoom-in').addEventListener('click', function() {
if (window.mindmapInstance) {
const svg = d3.select('#mindmap-container svg');
const currentZoom = d3.zoomTransform(svg.node());
const newScale = currentZoom.k * 1.3;
svg.transition().duration(300).call(
d3.zoom().transform,
d3.zoomIdentity.translate(currentZoom.x, currentZoom.y).scale(newScale)
);
}
});
document.getElementById('zoom-out').addEventListener('click', function() {
if (window.mindmapInstance) {
const svg = d3.select('#mindmap-container svg');
const currentZoom = d3.zoomTransform(svg.node());
const newScale = currentZoom.k / 1.3;
svg.transition().duration(300).call(
d3.zoom().transform,
d3.zoomIdentity.translate(currentZoom.x, currentZoom.y).scale(newScale)
);
}
});
document.getElementById('reset-view').addEventListener('click', function() {
if (window.mindmapInstance) {
const svg = d3.select('#mindmap-container svg');
svg.transition().duration(500).call(
d3.zoom().transform,
d3.zoomIdentity.scale(1)
);
}
});
// Handle dark mode toggle
document.addEventListener('darkModeToggled', function(event) {
const isDark = event.detail.isDark;
if (window.mindmapInstance && window.mindmapInstance.updateTheme) {
window.mindmapInstance.updateTheme(isDark);
}
});
// Load categories
loadCategories();
// Search functionality
const searchInput = document.getElementById('category-search');
if (searchInput) {
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
if (window.mindmapInstance && window.mindmapInstance.filterBySearchTerm) {
window.mindmapInstance.filterBySearchTerm(searchTerm);
}
// Filter categories in the sidebar
filterCategoriesInSidebar(searchTerm);
});
}
} catch (error) {
console.error('Fehler bei der Initialisierung der Mindmap:', error);
const errorContainer = document.getElementById('mindmap-container');
errorContainer.innerHTML = '<div class="glass-effect p-6 text-center">' +
'<div class="text-red-500 mb-4">' +
'<i class="fa-solid fa-triangle-exclamation text-4xl"></i>' +
'</div>' +
'<p class="text-xl">Fehler bei der Initialisierung der Mindmap:</p>' +
'<p class="text-md mt-2">' + (error.message || 'Unbekannter Fehler') + '</p>' +
'</div>';
}
});
// Kategorien laden
function loadCategories() {
const categoriesContainer = document.getElementById('categories-container');
const loadingElement = document.getElementById('loading-categories');
fetch('/api/categories')
.then(response => {
if (!response.ok) {
throw new Error('Kategorien konnten nicht geladen werden');
}
return response.json();
})
.then(categories => {
// Loading-Anzeige entfernen
if (loadingElement) {
loadingElement.remove();
}
// Kategorien rendern
renderCategories(categories, categoriesContainer);
})
.catch(error => {
console.error('Fehler beim Laden der Kategorien:', error);
if (loadingElement) {
loadingElement.innerHTML = `
<div class="text-red-500 mb-2">
<i class="fa-solid fa-exclamation-circle"></i>
</div>
<p>Fehler beim Laden der Kategorien</p>
`;
}
});
}
// Kategorien rekursiv rendern
function renderCategories(categories, container, level = 0) {
categories.forEach(category => {
const categoryElement = document.createElement('div');
categoryElement.className = 'category-item pl-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-700';
categoryElement.setAttribute('data-category-id', category.id);
categoryElement.style.marginLeft = level > 0 ? `${level * 12}px` : '0';
const hasChildren = category.children && category.children.length > 0;
const hasNodes = category.nodes && category.nodes.length > 0;
categoryElement.innerHTML = `
<div class="flex items-center justify-between">
<div class="flex items-center">
<i class="fa-solid fa-chevron-right mr-2 text-sm transition-transform ${hasChildren ? '' : 'opacity-0'}"></i>
<span>
<i class="fa-solid ${category.icon || 'fa-folder'} mr-2"></i>
${category.name}
</span>
</div>
<span class="node-counter">${hasNodes ? category.nodes.length : 0}</span>
</div>
`;
container.appendChild(categoryElement);
// Bereich für Knoten und Unterkategorien erstellen
const expandableArea = document.createElement('div');
expandableArea.className = 'hidden mt-2';
expandableArea.setAttribute('data-category-expand', category.id);
container.appendChild(expandableArea);
// Knoten für diese Kategorie anzeigen
if (hasNodes) {
const nodesContainer = document.createElement('div');
nodesContainer.className = 'node-list pl-4';
category.nodes.forEach(node => {
const nodeItem = document.createElement('div');
nodeItem.className = 'node-item p-2 mb-2';
nodeItem.style.borderLeft = `3px solid ${node.color_code || '#9F7AEA'}`;
nodeItem.setAttribute('data-node-id', node.id);
nodeItem.innerHTML = `
<div class="flex items-center justify-between">
<div>${node.name}</div>
<span class="node-counter">${node.thought_count || 0}</span>
</div>
`;
nodeItem.addEventListener('click', function(e) {
e.stopPropagation();
if (window.mindmapInstance && window.mindmapInstance.focusNode) {
window.mindmapInstance.focusNode(node.id);
}
});
nodesContainer.appendChild(nodeItem);
});
expandableArea.appendChild(nodesContainer);
}
// Unterkategorien rekursiv rendern
if (hasChildren) {
const childrenContainer = document.createElement('div');
childrenContainer.className = 'mt-2';
expandableArea.appendChild(childrenContainer);
renderCategories(category.children, childrenContainer, level + 1);
}
// Event-Listener für Aufklappen/Zuklappen
categoryElement.addEventListener('click', function() {
const expandArea = document.querySelector(`[data-category-expand="${category.id}"]`);
const chevron = this.querySelector('.fa-chevron-right');
if (expandArea) {
if (expandArea.classList.contains('hidden')) {
expandArea.classList.remove('hidden');
if (chevron) chevron.style.transform = 'rotate(90deg)';
} else {
expandArea.classList.add('hidden');
if (chevron) chevron.style.transform = 'rotate(0)';
}
}
});
});
}
// Categories filtering
function filterCategoriesInSidebar(searchTerm) {
if (!searchTerm) {
// Show all categories
document.querySelectorAll('.category-item').forEach(el => {
el.style.display = '';
});
return;
}
// Hide/show categories based on search
document.querySelectorAll('.category-item').forEach(el => {
const categoryName = el.querySelector('span').textContent.trim().toLowerCase();
if (categoryName.includes(searchTerm)) {
el.style.display = '';
// Show parent categories
let parent = el.parentElement;
while (parent && !parent.matches('#categories-container')) {
if (parent.hasAttribute('data-category-expand')) {
parent.classList.remove('hidden');
const parentId = parent.getAttribute('data-category-expand');
const parentCategory = document.querySelector(`[data-category-id="${parentId}"]`);
if (parentCategory) {
const chevron = parentCategory.querySelector('.fa-chevron-right');
if (chevron) chevron.style.transform = 'rotate(90deg)';
}
}
parent = parent.parentElement;
}
} else {
el.style.display = 'none';
}
});
}
</script>
{% if current_user.is_authenticated %}
<!-- Script für eingeloggte Benutzer -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Load user mindmaps
const mindmapsList = document.getElementById('user-mindmaps-list');
const loadingMindmaps = document.getElementById('loading-mindmaps');
fetch('/api/mindmap/user')
.then(response => {
if (!response.ok) {
throw new Error('Benutzer-Mindmaps konnten nicht geladen werden');
}
return response.json();
})
.then(data => {
if (!mindmapsList) return;
// Loading-Anzeige entfernen
if (loadingMindmaps) {
loadingMindmaps.remove();
}
if (data.length === 0) {
mindmapsList.innerHTML = '<div class="text-center text-gray-500 dark:text-gray-400 py-2">Keine Mindmaps gefunden</div>';
return;
}
// Mindmaps anzeigen
data.forEach(mindmap => {
const item = document.createElement('div');
item.className = 'user-mindmap-item p-3';
item.innerHTML = `
<div class="font-medium text-gray-800 dark:text-gray-200">${mindmap.name}</div>
<div class="text-xs text-gray-500 dark:text-gray-400 mb-2">${mindmap.description || ''}</div>
<a href="/my-mindmap/${mindmap.id}" class="text-purple-600 dark:text-purple-400 text-xs hover:underline">
<i class="fa-solid fa-arrow-right mr-1"></i> Öffnen
</a>
`;
mindmapsList.appendChild(item);
});
})
.catch(error => {
console.error('Fehler beim Laden der Benutzer-Mindmaps:', error);
if (loadingMindmaps) {
loadingMindmaps.innerHTML = `
<div class="text-red-500 mb-2">
<i class="fa-solid fa-exclamation-circle"></i>
</div>
<p>Fehler beim Laden der Mindmaps</p>
`;
}
});
});
</script>
{% endif %}
{% endblock %}

320
templates/my_account.html Normal file
View File

@@ -0,0 +1,320 @@
{% extends "base.html" %}
{% block title %}Meine Merkliste{% endblock %}
{% block extra_css %}
<style>
/* Hintergrund über die gesamte Seite erstrecken */
html, body {
min-height: 100vh;
width: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
.personal-mindmap-container {
width: 100%;
height: 400px;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 1rem;
position: relative;
overflow: hidden;
}
.dark .personal-mindmap-container {
background-color: rgba(255, 255, 255, 0.05);
}
.bookmark-item {
transition: all 0.3s ease;
}
.bookmark-item:hover {
transform: translateY(-3px);
}
.empty-state {
padding: 2rem;
text-align: center;
background-color: rgba(0, 0, 0, 0.05);
border-radius: 1rem;
}
.dark .empty-state {
background-color: rgba(255, 255, 255, 0.03);
}
</style>
{% endblock %}
{% block content %}
<!-- Hauptbereich -->
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8 pt-8 pb-12">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">
<span class="gradient-text">Meine Merkliste</span>
</h1>
<p class="text-lg text-gray-700 dark:text-gray-300">
Deine persönliche Sammlung gemerkter Wissensbereiche und Beiträge
</p>
</div>
<!-- Persönliche Mindmap -->
<div class="mb-12">
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4 flex items-center">
<i class="fas fa-project-diagram mr-3 text-purple-500"></i>
Meine Mindmap
</h2>
<div id="personal-mindmap" class="personal-mindmap-container glass-morphism">
<div id="empty-mindmap-message" class="absolute inset-0 flex items-center justify-center">
<div class="text-center p-6">
<div class="text-6xl mb-4 opacity-20">
<i class="fas fa-bookmark"></i>
</div>
<h3 class="text-xl font-semibold mb-2 text-gray-700 dark:text-gray-300">Deine persönliche Mindmap ist leer</h3>
<p class="text-gray-600 dark:text-gray-400 max-w-md mx-auto">
Merke dir Wissensbereiche und Gedanken in der Hauptmindmap, um deine persönliche Mindmap zu erstellen.
</p>
<a href="{{ url_for('mindmap') }}" class="mt-4 inline-block px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors">
Zur Mindmap
</a>
</div>
</div>
</div>
</div>
<!-- Gemerkte Inhalte -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
<!-- Wissensbereiche -->
<div>
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4 flex items-center">
<i class="fas fa-folder-open mr-3 text-blue-500"></i>
Gemerkte Wissensbereiche
</h2>
<div id="bookmarked-areas-container" class="space-y-4">
<!-- Ladezustand -->
<div class="animate-pulse space-y-4">
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
</div>
</div>
</div>
<!-- Gedanken -->
<div>
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4 flex items-center">
<i class="fas fa-lightbulb mr-3 text-amber-500"></i>
Gemerkte Gedanken
</h2>
<div id="bookmarked-thoughts-container" class="space-y-4">
<!-- Ladezustand -->
<div class="animate-pulse space-y-4">
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
<div class="h-16 bg-gray-200 dark:bg-gray-700 rounded-lg"></div>
</div>
</div>
</div>
</div>
</div>
<!-- JavaScript für persönliche Mindmap -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Lade gespeicherte Bookmarks aus dem LocalStorage
function loadBookmarkedNodes() {
try {
const bookmarked = localStorage.getItem('bookmarkedNodes');
return bookmarked ? JSON.parse(bookmarked) : [];
} catch (error) {
console.error('Fehler beim Laden der gemerkten Knoten:', error);
return [];
}
}
const bookmarkedNodeIds = loadBookmarkedNodes();
// Prüfe, ob es gemerkte Knoten gibt
if (bookmarkedNodeIds && bookmarkedNodeIds.length > 0) {
// Verstecke die Leer-Nachricht
document.getElementById('empty-mindmap-message').style.display = 'none';
// Initialisiere die persönliche Mindmap
const personalMindmap = new MindMapVisualization('#personal-mindmap', {
width: document.getElementById('personal-mindmap').clientWidth,
height: 400,
nodeRadius: 18,
selectedNodeRadius: 22,
linkDistance: 120,
chargeStrength: -800,
centerForce: 0.1,
tooltipEnabled: true
});
// Lade Daten für die Mindmap - hier müssten wir normalerweise die API nutzen,
// aber als Fallback laden wir die Standarddaten und filtern sie
window.setTimeout(() => {
// Wenn die Hauptmindmap geladen ist, können wir deren Daten verwenden
if (window.mindmapInstance) {
// Filtere nur gemerkte Knoten und ihre Verbindungen
const nodes = window.mindmapInstance.nodes.filter(node =>
bookmarkedNodeIds.includes(node.id)
);
// Finde Verbindungen zwischen den gemerkten Knoten
const links = window.mindmapInstance.links.filter(link =>
bookmarkedNodeIds.includes(link.source.id || link.source) &&
bookmarkedNodeIds.includes(link.target.id || link.target)
);
// Setze Daten und aktualisiere die Visualisierung
personalMindmap.nodes = nodes;
personalMindmap.links = links;
personalMindmap.isLoading = false;
personalMindmap.updateVisualization();
} else {
// Fallback: Leere Mindmap anzeigen
document.getElementById('empty-mindmap-message').style.display = 'flex';
}
}, 800);
// Lade die gemerkten Inhalte
loadBookmarkedContent(bookmarkedNodeIds);
} else {
// Zeige Leerzustand an
const areasContainer = document.getElementById('bookmarked-areas-container');
const thoughtsContainer = document.getElementById('bookmarked-thoughts-container');
areasContainer.innerHTML = `
<div class="empty-state">
<div class="text-4xl mb-2 opacity-20">
<i class="fas fa-folder-open"></i>
</div>
<p class="text-gray-600 dark:text-gray-400">Keine gemerkten Wissensbereiche</p>
</div>
`;
thoughtsContainer.innerHTML = `
<div class="empty-state">
<div class="text-4xl mb-2 opacity-20">
<i class="fas fa-lightbulb"></i>
</div>
<p class="text-gray-600 dark:text-gray-400">Keine gemerkten Gedanken</p>
</div>
`;
}
});
// Funktion zum Laden der gemerkten Inhalte
function loadBookmarkedContent(nodeIds) {
if (!nodeIds || nodeIds.length === 0) return;
// In einer vollständigen Implementierung würden wir hier einen API-Aufruf machen
// Für diese Demo erstellen wir Beispielinhalte
const areasContainer = document.getElementById('bookmarked-areas-container');
const thoughtsContainer = document.getElementById('bookmarked-thoughts-container');
// Verschiedene Beispiel-Farben
const colors = ['purple', 'blue', 'green', 'indigo', 'amber'];
// Leere die Container
areasContainer.innerHTML = '';
thoughtsContainer.innerHTML = '';
// Beispielinhalte für Wissensbereiche
const areaTemplates = [
{ name: 'Philosophie', description: 'Grundlagen philosophischen Denkens', count: 24 },
{ name: 'Wissenschaft', description: 'Wissenschaftliche Methoden und Erkenntnisse', count: 42 },
{ name: 'Technologie', description: 'Zukunftsweisende Technologien', count: 36 },
{ name: 'Kunst', description: 'Künstlerische Ausdrucksformen', count: 18 },
{ name: 'Psychologie', description: 'Menschliches Verhalten verstehen', count: 30 }
];
// Beispielinhalte für Gedanken
const thoughtTemplates = [
{ title: 'Quantenphysik und Bewusstsein', author: 'Maria Schmidt', date: '12.04.2023' },
{ title: 'Ethik in der künstlichen Intelligenz', author: 'Thomas Weber', date: '23.02.2023' },
{ title: 'Die Rolle der Kunst in der Gesellschaft', author: 'Lena Müller', date: '05.06.2023' },
{ title: 'Nachhaltige Entwicklung im 21. Jahrhundert', author: 'Michael Bauer', date: '18.08.2023' },
{ title: 'Kognitive Verzerrungen im Alltag', author: 'Sophie Klein', date: '30.09.2023' }
];
// Zeige nur so viele Elemente wie wir Knoten haben (bis zu 5)
const areaCount = Math.min(nodeIds.length, 5);
if (areaCount > 0) {
// Wissensbereiche hinzufügen
for (let i = 0; i < areaCount; i++) {
const area = areaTemplates[i];
const colorClass = colors[i % colors.length];
areasContainer.innerHTML += `
<a href="{{ url_for('mindmap') }}" class="bookmark-item block p-4 rounded-xl bg-white/80 dark:bg-gray-800/80 shadow-sm hover:shadow-md transition-all">
<div class="flex items-center">
<div class="w-10 h-10 rounded-lg bg-${colorClass}-100 dark:bg-${colorClass}-900/30 flex items-center justify-center mr-3">
<i class="fas fa-bookmark text-${colorClass}-500"></i>
</div>
<div class="flex-grow">
<h3 class="font-semibold text-gray-900 dark:text-white">${area.name}</h3>
<p class="text-sm text-gray-600 dark:text-gray-400">${area.description}</p>
</div>
<div class="text-xs text-gray-500 dark:text-gray-400">
${area.count} Einträge
</div>
</div>
</a>
`;
}
} else {
areasContainer.innerHTML = `
<div class="empty-state">
<div class="text-4xl mb-2 opacity-20">
<i class="fas fa-folder-open"></i>
</div>
<p class="text-gray-600 dark:text-gray-400">Keine gemerkten Wissensbereiche</p>
</div>
`;
}
// Zeige bis zu 5 Gedanken an (oder weniger, falls weniger gemerkt wurden)
const thoughtCount = Math.min(nodeIds.length, 5);
if (thoughtCount > 0) {
// Gedanken hinzufügen
for (let i = 0; i < thoughtCount; i++) {
const thought = thoughtTemplates[i];
const colorClass = colors[(i + 2) % colors.length]; // Andere Farben als für Bereiche
thoughtsContainer.innerHTML += `
<a href="{{ url_for('mindmap') }}" class="bookmark-item block p-4 rounded-xl bg-white/80 dark:bg-gray-800/80 shadow-sm hover:shadow-md transition-all">
<div class="flex items-center">
<div class="w-10 h-10 rounded-lg bg-${colorClass}-100 dark:bg-${colorClass}-900/30 flex items-center justify-center mr-3">
<i class="fas fa-lightbulb text-${colorClass}-500"></i>
</div>
<div class="flex-grow">
<h3 class="font-semibold text-gray-900 dark:text-white">${thought.title}</h3>
<p class="text-sm text-gray-600 dark:text-gray-400">Von ${thought.author}${thought.date}</p>
</div>
</div>
</a>
`;
}
} else {
thoughtsContainer.innerHTML = `
<div class="empty-state">
<div class="text-4xl mb-2 opacity-20">
<i class="fas fa-lightbulb"></i>
</div>
<p class="text-gray-600 dark:text-gray-400">Keine gemerkten Gedanken</p>
</div>
`;
}
}
</script>
{% endblock %}

800
templates/profile.html Normal file
View File

@@ -0,0 +1,800 @@
{% extends "base.html" %}
{% block title %}Profil{% endblock %}
{% block extra_css %}
<style>
/* Grundstile für das Profil mit verbessertem Glasmorphismus */
.profile-container {
background: rgba(24, 28, 45, 0.75);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 24px;
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
padding: 2rem;
margin-bottom: 2rem;
transition: all 0.3s ease;
}
.profile-container:hover {
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
transform: translateY(-3px);
}
/* Verbesserte Profile-Header mit dynamischer User-Anzeige */
.profile-header {
display: flex;
align-items: flex-start;
margin-bottom: 2rem;
gap: 2.5rem;
position: relative;
}
.avatar-container {
width: 180px;
height: 180px;
border-radius: 50%;
background: rgba(32, 36, 55, 0.9);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 3px solid rgba(179, 143, 255, 0.3);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 15px rgba(179, 143, 255, 0.2);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
position: relative;
transition: all 0.3s ease;
flex-shrink: 0;
}
.avatar-container:hover {
transform: scale(1.05);
border: 3px solid rgba(179, 143, 255, 0.5);
box-shadow: 0 12px 45px rgba(0, 0, 0, 0.3), 0 0 25px rgba(179, 143, 255, 0.35);
}
.avatar-container img {
width: 100%;
height: 100%;
object-fit: cover;
transition: filter 0.3s ease;
}
.avatar-container:hover img {
filter: brightness(1.1);
}
.avatar-edit {
position: absolute;
bottom: 0;
right: 0;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
.avatar-edit:hover {
background: rgba(255, 255, 255, 0.3);
}
.user-info {
flex: 1;
padding-top: 0.5rem;
}
.user-info h1 {
font-size: 2.75rem;
font-weight: 800;
margin-bottom: 0.75rem;
background: linear-gradient(135deg, #b38fff, #58a9ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
text-shadow: 0 2px 10px rgba(179, 143, 255, 0.3);
letter-spacing: 0.3px;
line-height: 1.2;
}
.user-bio {
font-size: 1.15rem;
line-height: 1.7;
color: rgba(255, 255, 255, 0.9);
max-width: 650px;
margin-bottom: 1.5rem;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.user-meta {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
color: rgba(255, 255, 255, 0.7);
font-size: 1rem;
align-items: center;
}
.user-meta span {
display: flex;
align-items: center;
gap: 0.5rem;
transition: all 0.25s ease;
}
.user-meta span:hover {
color: rgba(255, 255, 255, 1);
transform: translateY(-2px);
}
.user-meta i {
opacity: 0.8;
}
/* Benutzer-Aktionsbereich */
.profile-actions {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 2rem;
}
.profile-action-btn {
padding: 0.75rem 1.5rem;
border-radius: 16px;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
transition: all 0.3s ease;
background: rgba(32, 36, 55, 0.75);
color: rgba(255, 255, 255, 0.9);
border: 1px solid rgba(255, 255, 255, 0.12);
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.profile-action-btn:hover {
transform: translateY(-3px);
background: rgba(179, 143, 255, 0.25);
border: 1px solid rgba(179, 143, 255, 0.3);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), 0 0 15px rgba(179, 143, 255, 0.2);
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.4);
}
.profile-action-btn.primary {
background: rgba(179, 143, 255, 0.25);
color: #ffffff;
border: 1px solid rgba(179, 143, 255, 0.3);
}
.profile-action-btn.primary:hover {
background: rgba(179, 143, 255, 0.35);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 20px rgba(179, 143, 255, 0.35);
}
/* Verbesserte Profil-Tabs */
.profile-tabs {
display: flex;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 1.5rem;
overflow-x: auto;
scrollbar-width: thin;
scrollbar-color: rgba(179, 143, 255, 0.5) rgba(255, 255, 255, 0.05);
}
.profile-tab {
padding: 1rem 1.5rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.7);
border-bottom: 3px solid transparent;
transition: all 0.3s ease;
cursor: pointer;
white-space: nowrap;
}
.profile-tab:hover {
color: rgba(255, 255, 255, 0.9);
background: rgba(255, 255, 255, 0.05);
}
.profile-tab.active {
color: #b38fff;
border-bottom: 3px solid #b38fff;
background: rgba(179, 143, 255, 0.1);
}
/* Aktivitäten und Beiträge */
.activity-feed {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.activity-card {
background: rgba(32, 36, 55, 0.7);
border-radius: 20px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease;
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
}
.activity-card:hover {
transform: translateY(-3px);
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 15px rgba(179, 143, 255, 0.15);
}
.activity-header {
padding: 1.25rem 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
display: flex;
align-items: center;
justify-content: space-between;
}
.activity-title {
font-size: 1.25rem;
font-weight: 700;
color: rgba(255, 255, 255, 0.95);
}
.activity-date {
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.6);
}
.activity-content {
padding: 1.5rem;
color: rgba(255, 255, 255, 0.85);
font-size: 1.05rem;
line-height: 1.6;
}
.activity-footer {
padding: 1rem 1.5rem;
border-top: 1px solid rgba(255, 255, 255, 0.06);
display: flex;
align-items: center;
justify-content: space-between;
}
.activity-reactions {
display: flex;
gap: 0.75rem;
}
.reaction-button {
display: flex;
align-items: center;
gap: 0.35rem;
padding: 0.5rem 0.75rem;
border-radius: 12px;
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.7);
background: rgba(255, 255, 255, 0.05);
border: none;
transition: all 0.3s ease;
cursor: pointer;
}
.reaction-button:hover {
background: rgba(179, 143, 255, 0.15);
color: rgba(255, 255, 255, 0.95);
transform: translateY(-2px);
}
.reaction-button.active {
background: rgba(179, 143, 255, 0.2);
color: #b38fff;
}
.activity-actions {
display: flex;
gap: 0.75rem;
}
.action-button {
padding: 0.5rem 0.75rem;
border-radius: 12px;
font-size: 0.9rem;
background: rgba(179, 143, 255, 0.1);
color: #b38fff;
border: 1px solid rgba(179, 143, 255, 0.25);
transition: all 0.3s ease;
cursor: pointer;
}
.action-button:hover {
background: rgba(179, 143, 255, 0.2);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 10px rgba(179, 143, 255, 0.2);
}
/* Verbesserte Einstellungskarten */
.settings-card {
background: rgba(32, 36, 55, 0.7);
border-radius: 20px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 1.5rem;
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
transition: all 0.3s ease;
}
.settings-card:hover {
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), 0 0 15px rgba(179, 143, 255, 0.15);
}
.settings-card-header {
padding: 1.25rem 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
font-size: 1.2rem;
font-weight: 700;
color: rgba(255, 255, 255, 0.95);
}
.settings-card-body {
padding: 1.5rem;
}
.settings-group {
margin-bottom: 1.5rem;
}
.settings-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.85);
}
.settings-input {
width: 100%;
padding: 0.75rem 1rem;
background: rgba(24, 28, 45, 0.6);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
color: rgba(255, 255, 255, 0.95);
font-size: 1rem;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.settings-input:focus {
border-color: rgba(179, 143, 255, 0.4);
box-shadow: 0 0 0 3px rgba(179, 143, 255, 0.15);
outline: none;
}
/* Light Mode Anpassungen */
html.light .profile-container,
html.light .profile-tabs,
html.light .activity-card,
html.light .settings-card {
background: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(0, 0, 0, 0.08);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}
html.light .avatar-container {
background: rgba(255, 255, 255, 0.9);
border: 3px solid rgba(126, 63, 242, 0.3);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), 0 0 15px rgba(126, 63, 242, 0.15);
}
html.light .user-info h1 {
background: linear-gradient(135deg, #7e3ff2, #3282f6);
text-shadow: none;
}
html.light .user-bio,
html.light .activity-content {
color: #1a202c;
text-shadow: none;
}
html.light .user-meta span {
color: #4a5568;
}
html.light .stat-item,
html.light .settings-input {
background: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(0, 0, 0, 0.05);
}
html.light .stat-value {
background: linear-gradient(135deg, #7e3ff2, #3282f6);
}
html.light .stat-label {
color: #4a5568;
}
html.light .profile-tab {
color: #4a5568;
}
html.light .profile-tab:hover {
background: rgba(0, 0, 0, 0.03);
color: #1a202c;
}
html.light .profile-tab.active {
color: #7e3ff2;
border-bottom: 3px solid #7e3ff2;
background: rgba(126, 63, 242, 0.08);
}
html.light .activity-title,
html.light .settings-card-header,
html.light .settings-label {
color: #1a202c;
}
html.light .activity-date {
color: #718096;
}
html.light .activity-footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
html.light .reaction-button {
color: #4a5568;
background: rgba(0, 0, 0, 0.03);
}
html.light .reaction-button:hover {
background: rgba(126, 63, 242, 0.1);
color: #7e3ff2;
}
html.light .reaction-button.active {
background: rgba(126, 63, 242, 0.15);
color: #7e3ff2;
}
html.light .action-button {
background: rgba(126, 63, 242, 0.1);
color: #7e3ff2;
border: 1px solid rgba(126, 63, 242, 0.2);
}
html.light .action-button:hover {
background: rgba(126, 63, 242, 0.2);
}
</style>
{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-10">
<!-- Profil-Container -->
<div class="profile-container">
<!-- User Info Section -->
<div class="profile-header">
<div class="avatar-container">
<img src="{{ user.avatar if user.avatar else url_for('static', filename='img/default-avatar.png') }}" alt="Profilbild" class="avatar">
<div class="avatar-edit">
<i class="fas fa-camera"></i>
</div>
</div>
<div class="user-info">
<h1>{{ user.username }}</h1>
<p class="user-bio">{{ user.bio if user.bio else 'Keine Bio vorhanden. Klicke auf bearbeiten, um eine hinzuzufügen.' }}</p>
<div class="user-meta">
<span><i class="fas fa-map-marker-alt"></i> {{ user.location if user.location else 'Kein Standort angegeben' }}</span>
<span><i class="fas fa-calendar-alt"></i> Mitglied seit {{ user.created_at.strftime('%d.%m.%Y') }}</span>
</div>
<button class="edit-profile-btn">Profil bearbeiten</button>
</div>
</div>
<!-- Statistiken -->
<div class="profile-stats">
<!-- Gedanken -->
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-lightbulb"></i>
</div>
<div class="stat-value">{{ stats.thought_count if stats and stats.thought_count else 0 }}</div>
<div class="stat-label">Gedanken</div>
</div>
<!-- Verbindungen -->
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-project-diagram"></i>
</div>
<div class="stat-value">{{ stats.connections_count if stats and stats.connections_count else 0 }}</div>
<div class="stat-label">Verbindungen</div>
</div>
<!-- Follower -->
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-users"></i>
</div>
<div class="stat-value">{{ stats.followers_count if stats and stats.followers_count else 0 }}</div>
<div class="stat-label">Follower</div>
</div>
<!-- Beiträge -->
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-comment-dots"></i>
</div>
<div class="stat-value">{{ stats.contributions_count if stats and stats.contributions_count else 0 }}</div>
<div class="stat-label">Beiträge</div>
</div>
<!-- Bewertung -->
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-star"></i>
</div>
<div class="stat-value">{{ stats.rating if stats and stats.rating else '0.0' }}</div>
<div class="stat-label">Bewertung</div>
</div>
</div>
</div>
<!-- Tabs und Inhaltsbereich -->
<div class="glass-card">
<!-- Profil-Tabs -->
<div class="profile-tabs">
<div class="profile-tab active" data-tab="activity">Aktivitäten</div>
<div class="profile-tab" data-tab="thoughts">Gedanken</div>
<div class="profile-tab" data-tab="collections">Sammlungen</div>
<div class="profile-tab" data-tab="connections">Verbindungen</div>
<div class="profile-tab" data-tab="settings">Einstellungen</div>
</div>
<!-- Tab-Inhalte -->
<div class="p-6">
<!-- Aktivitäts-Tab (Standardmäßig angezeigt) -->
<div class="tab-content" id="activity-tab">
<div class="activity-feed">
{% if activities %}
{% for activity in activities %}
<div class="activity-card">
<div class="activity-header">
<div class="activity-title">{{ activity.title }}</div>
<div class="activity-date">{{ activity.date }}</div>
</div>
<div class="activity-content">
<p>{{ activity.content }}</p>
</div>
<div class="activity-footer">
<div class="activity-reactions">
<button class="reaction-button {% if activity.user_liked %}active{% endif %}">
<i class="fas fa-thumbs-up"></i> <span>{{ activity.likes }}</span>
</button>
<button class="reaction-button">
<i class="fas fa-comment"></i> <span>{{ activity.comments }}</span>
</button>
<button class="reaction-button">
<i class="fas fa-share"></i> <span>{{ activity.shares }}</span>
</button>
</div>
<div class="activity-actions">
<button class="action-button">
Ansehen
</button>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-center py-12">
<i class="fas fa-history text-5xl text-gray-400 mb-4"></i>
<p class="text-gray-500">Noch keine Aktivitäten vorhanden</p>
</div>
{% endif %}
</div>
</div>
<!-- Weitere Tab-Inhalte (werden per JavaScript angezeigt) -->
<div class="tab-content hidden" id="thoughts-tab">
<div id="thoughts-container">
{% if thoughts %}
{% for thought in thoughts %}
<div class="thought-item">
<h3>{{ thought.title }}</h3>
<p>{{ thought.content }}</p>
<div class="thought-meta">
<span>{{ thought.date }}</span>
<span>{{ thought.category }}</span>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-center py-12">
<i class="fas fa-lightbulb text-5xl text-gray-400 mb-4"></i>
<p class="text-gray-500">Noch keine Gedanken erstellt</p>
<a href="{{ url_for('create_thought') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg">Ersten Gedanken erstellen</a>
</div>
{% endif %}
</div>
</div>
<div class="tab-content hidden" id="collections-tab">
<div id="collections-container">
{% if collections %}
{% for collection in collections %}
<div class="collection-item">
<h3>{{ collection.title }}</h3>
<p>{{ collection.description }}</p>
<div class="collection-meta">
<span>{{ collection.thoughts_count }} Gedanken</span>
<span>{{ collection.date }}</span>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-center py-12">
<i class="fas fa-folder-open text-5xl text-gray-400 mb-4"></i>
<p class="text-gray-500">Noch keine Sammlungen erstellt</p>
<a href="{{ url_for('create_collection') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg">Erste Sammlung erstellen</a>
</div>
{% endif %}
</div>
</div>
<div class="tab-content hidden" id="connections-tab">
<div id="connections-container">
{% if connections %}
{% for connection in connections %}
<div class="connection-item">
<div class="connection-nodes">
<div class="connection-node">
<h4>{{ connection.source.title }}</h4>
<p>{{ connection.source.excerpt }}</p>
</div>
<div class="connection-type">
<i class="fas fa-arrow-right"></i>
<span>{{ connection.relation_type }}</span>
</div>
<div class="connection-node">
<h4>{{ connection.target.title }}</h4>
<p>{{ connection.target.excerpt }}</p>
</div>
</div>
<div class="connection-meta">
<span>{{ connection.date }}</span>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-center py-12">
<i class="fas fa-project-diagram text-5xl text-gray-400 mb-4"></i>
<p class="text-gray-500">Noch keine Verbindungen erstellt</p>
<a href="{{ url_for('mindmap') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg">Verbindungen in der Mindmap erstellen</a>
</div>
{% endif %}
</div>
</div>
<div class="tab-content hidden" id="settings-tab">
<!-- Einstellungs-Tab-Inhalt -->
<div class="settings-card">
<div class="settings-card-header">Profilinformationen</div>
<div class="settings-card-body">
<div class="settings-group">
<label class="settings-label" for="name">Name</label>
<input type="text" id="name" class="settings-input" value="{{ user.name }}" />
</div>
<div class="settings-group">
<label class="settings-label" for="bio">Über mich</label>
<textarea id="bio" class="settings-input" rows="4">{{ user.bio }}</textarea>
</div>
<div class="settings-group">
<label class="settings-label" for="location">Standort</label>
<input type="text" id="location" class="settings-input" value="{{ user.location }}" />
</div>
<div class="settings-group">
<label class="settings-label" for="website">Website</label>
<input type="url" id="website" class="settings-input" value="{{ user.website }}" />
</div>
<button class="profile-action-btn primary mt-4">
<i class="fas fa-save mr-1"></i> Speichern
</button>
</div>
</div>
<div class="settings-card">
<div class="settings-card-header">Datenschutz und Sicherheit</div>
<div class="settings-card-body">
<div class="settings-group">
<label class="settings-label" for="email">E-Mail-Adresse</label>
<input type="email" id="email" class="settings-input" value="{{ user.email }}" />
</div>
<div class="settings-group">
<label class="settings-label" for="password">Neues Passwort</label>
<input type="password" id="password" class="settings-input" placeholder="Neues Passwort eingeben" />
</div>
<div class="settings-group">
<label class="settings-label" for="password_confirm">Passwort bestätigen</label>
<input type="password" id="password_confirm" class="settings-input" placeholder="Passwort wiederholen" />
</div>
<button class="profile-action-btn primary mt-4">
<i class="fas fa-lock mr-1"></i> Passwort aktualisieren
</button>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script nonce="{{ csp_nonce }}">
document.addEventListener('DOMContentLoaded', function() {
// Profil-Tab-Funktionalität
const tabs = document.querySelectorAll('.profile-tab');
const tabContents = document.querySelectorAll('.tab-content');
tabs.forEach(tab => {
tab.addEventListener('click', function() {
// Alle Tabs deaktivieren
tabs.forEach(t => t.classList.remove('active'));
// Aktuellen Tab aktivieren
this.classList.add('active');
// Alle Tab-Inhalte ausblenden
tabContents.forEach(content => content.classList.add('hidden'));
// Entsprechenden Tab-Inhalt anzeigen
const tabId = this.getAttribute('data-tab');
document.getElementById(`${tabId}-tab`).classList.remove('hidden');
});
});
// Like-Button-Funktionalität
const reactionButtons = document.querySelectorAll('.reaction-button');
reactionButtons.forEach(button => {
button.addEventListener('click', function() {
// Toggle active-Klasse
this.classList.toggle('active');
// Aktueller Zählerstand
const countElement = this.querySelector('span');
let count = parseInt(countElement.textContent);
// Zähler aktualisieren
if (this.classList.contains('active')) {
count += 1;
} else {
count -= 1;
}
countElement.textContent = count;
});
});
});
</script>
{% endblock %}

115
templates/register.html Normal file
View File

@@ -0,0 +1,115 @@
{% extends "base.html" %}
{% block title %}Registrieren{% endblock %}
{% block content %}
<div class="flex justify-center items-center mt-10 px-4">
<div class="w-full max-w-md">
<div class="bg-white bg-opacity-80 backdrop-blur-lg rounded-lg shadow-md border border-white border-opacity-30 p-6 md:p-8 transition-all duration-300 transform hover:shadow-lg">
<h2 class="text-center mb-6 text-gray-800 font-bold text-2xl flex items-center justify-center">
<i class="fas fa-user-plus mr-2 text-blue-600"></i>
Registrieren
</h2>
<form method="POST" action="{{ url_for('register') }}" class="needs-validation space-y-6" novalidate>
<div class="space-y-2">
<label for="username" class="block text-gray-700 font-medium text-sm">Benutzername</label>
<div class="relative flex items-center">
<span class="absolute left-3 text-blue-600">
<i class="fas fa-user"></i>
</span>
<input type="text" class="pl-10 w-full rounded-md border border-gray-300 py-2 px-4 focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50 transition-all duration-200"
id="username" name="username" placeholder="Dein Benutzername" required>
</div>
<div class="invalid-feedback text-red-600 text-sm hidden">
Bitte gib einen Benutzernamen ein.
</div>
</div>
<div class="space-y-2">
<label for="email" class="block text-gray-700 font-medium text-sm">E-Mail</label>
<div class="relative flex items-center">
<span class="absolute left-3 text-blue-600">
<i class="fas fa-envelope"></i>
</span>
<input type="email" class="pl-10 w-full rounded-md border border-gray-300 py-2 px-4 focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50 transition-all duration-200"
id="email" name="email" placeholder="name@beispiel.de" required>
</div>
<div class="invalid-feedback text-red-600 text-sm hidden">
Bitte gib eine gültige E-Mail-Adresse ein.
</div>
</div>
<div class="space-y-2">
<label for="password" class="block text-gray-700 font-medium text-sm">Passwort</label>
<div class="relative flex items-center">
<span class="absolute left-3 text-blue-600">
<i class="fas fa-lock"></i>
</span>
<input type="password" class="pl-10 w-full rounded-md border border-gray-300 py-2 px-4 focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50 transition-all duration-200"
id="password" name="password" placeholder="Mindestens 8 Zeichen" required>
<button class="absolute right-2 text-gray-500 hover:text-gray-700 focus:outline-none" type="button" id="togglePassword">
<i class="fas fa-eye"></i>
</button>
</div>
<div class="invalid-feedback text-red-600 text-sm hidden">
Bitte gib ein sicheres Passwort ein.
</div>
</div>
<div class="pt-2">
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-md shadow-sm transition-all duration-200 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">
<i class="fas fa-user-plus mr-2"></i> Konto erstellen
</button>
</div>
<div class="text-center mt-4 text-gray-700 text-sm">
<p>Bereits registriert? <a href="{{ url_for('login') }}" class="text-blue-600 hover:text-blue-800 font-medium transition-colors duration-200">Anmelden</a></p>
</div>
</form>
</div>
</div>
</div>
<script>
// Formularvalidierung aktivieren
(function() {
'use strict';
var forms = document.querySelectorAll('.needs-validation');
Array.prototype.slice.call(forms).forEach(function(form) {
form.addEventListener('submit', function(event) {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
// Zeige Fehlermeldungen an
form.querySelectorAll(':invalid').forEach(function(input) {
input.parentNode.nextElementSibling.classList.remove('hidden');
});
}
form.classList.add('was-validated');
}, false);
// Verstecke Fehlermeldungen bei Eingabe
form.querySelectorAll('input').forEach(function(input) {
input.addEventListener('input', function() {
if (this.checkValidity()) {
this.parentNode.nextElementSibling.classList.add('hidden');
}
});
});
});
// Passwort-Sichtbarkeit umschalten
const togglePassword = document.querySelector('#togglePassword');
const password = document.querySelector('#password');
togglePassword.addEventListener('click', function() {
const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
password.setAttribute('type', type);
this.querySelector('i').classList.toggle('fa-eye');
this.querySelector('i').classList.toggle('fa-eye-slash');
});
})();
</script>
{% endblock %}

105
templates/search.html Normal file
View File

@@ -0,0 +1,105 @@
{% extends "base.html" %}
{% block title %}Suche{% endblock %}
{% block content %}
<div class="flex flex-col md:flex-row gap-6">
<!-- Filter-Sidebar -->
<div class="w-full md:w-1/3 lg:w-1/4 mb-6">
<div class="bg-white/10 backdrop-blur-md rounded-xl p-6 shadow-lg">
<h4 class="text-xl font-semibold mb-4">Erweiterte Suche</h4>
<form id="search-form">
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Suchbegriff</label>
<div class="flex items-center border rounded-lg overflow-hidden bg-white/5">
<span class="px-3 py-2 text-gray-400">
<i class="fas fa-search"></i>
</span>
<input type="text" class="w-full bg-transparent border-0 focus:ring-0 py-2 px-1" name="q" placeholder="Suche...">
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Schlagworte</label>
<div class="flex items-center border rounded-lg overflow-hidden bg-white/5">
<span class="px-3 py-2 text-gray-400">
<i class="fas fa-tags"></i>
</span>
<input type="text" class="w-full bg-transparent border-0 focus:ring-0 py-2 px-1" name="keywords" placeholder="Schlagworte (kommagetrennt)">
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Minimale Bewertung</label>
<div class="flex items-center border rounded-lg overflow-hidden bg-white/5">
<span class="px-3 py-2 text-gray-400">
<i class="fas fa-star"></i>
</span>
<select class="w-full bg-transparent border-0 focus:ring-0 py-2 px-1" name="min_rating">
<option value="">Alle</option>
<option value="4">4+ Sterne</option>
<option value="3">3+ Sterne</option>
<option value="2">2+ Sterne</option>
<option value="1">1+ Stern</option>
</select>
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Quellentyp</label>
<div class="flex items-center border rounded-lg overflow-hidden bg-white/5">
<span class="px-3 py-2 text-gray-400">
<i class="fas fa-file-alt"></i>
</span>
<select class="w-full bg-transparent border-0 focus:ring-0 py-2 px-1" name="source_type">
<option value="">Alle</option>
<option value="PDF">PDF</option>
<option value="Markdown">Markdown</option>
<option value="Text">Text</option>
</select>
</div>
</div>
<div class="mb-5">
<label class="block text-sm font-medium mb-1">Beziehungstyp</label>
<div class="flex items-center border rounded-lg overflow-hidden bg-white/5">
<span class="px-3 py-2 text-gray-400">
<i class="fas fa-project-diagram"></i>
</span>
<select class="w-full bg-transparent border-0 focus:ring-0 py-2 px-1" name="relation_type">
<option value="">Alle</option>
<option value="SUPPORTS">Stützt</option>
<option value="CONTRADICTS">Widerspricht</option>
<option value="BUILDS_UPON">Baut auf auf</option>
<option value="GENERALIZES">Verallgemeinert</option>
<option value="SPECIFIES">Spezifiziert</option>
<option value="INSPIRES">Inspiriert</option>
</select>
</div>
</div>
<button type="submit" class="w-full bg-gradient-to-r from-blue-500 to-indigo-600 text-white py-2 px-4 rounded-lg hover:opacity-90 transition-all flex items-center justify-center">
<i class="fas fa-search mr-2"></i> Suchen
</button>
</form>
</div>
</div>
<!-- Suchergebnisse -->
<div class="w-full md:w-2/3 lg:w-3/4">
<div class="bg-white/10 backdrop-blur-md rounded-xl p-6 shadow-lg mb-6">
<h3 class="text-2xl font-semibold mb-2">Suchergebnisse</h3>
<p class="text-gray-300 text-sm">Nutze die Filter links, um deine Suche zu präzisieren.</p>
</div>
<div id="search-results" class="mb-6">
<!-- Suchergebnisse werden hier dynamisch eingefügt -->
<div class="bg-white/10 backdrop-blur-md rounded-xl p-8 shadow-lg text-center">
<i class="fas fa-search text-5xl mb-6 text-blue-400"></i>
<h5 class="text-xl font-medium mb-3">Wissen entdecken</h5>
<p class="text-gray-300">Gib einen Suchbegriff ein, um in der wissenschaftlichen Wissensdatenbank zu suchen.</p>
</div>
</div>
</div>
</div>
{% endblock %}

269
templates/settings.html Normal file
View File

@@ -0,0 +1,269 @@
{% extends "base.html" %}
{% block title %}Einstellungen{% endblock %}
{% block content %}
<div class="relative mb-6" data-page="settings">
<!-- Header Bereich -->
<div class="mb-8 p-6 bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl">
<h1 class="text-4xl md:text-5xl font-bold mb-3">
<span class="gradient-text">Einstellungen</span>
</h1>
<p class="text-lg text-gray-300 max-w-3xl">
Verwalten Sie Ihr Konto und passen Sie Ihre Benutzererfahrung an.
</p>
</div>
<!-- Einstellungen Grid Layout -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Seitennavigation (Desktop) -->
<div class="lg:col-span-1 order-2 lg:order-1">
<div class="sticky top-6 bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl overflow-hidden p-4">
<nav>
<div class="text-xs uppercase text-gray-400 font-semibold tracking-wider mb-3 px-3">Navigation</div>
<ul class="space-y-1">
<li>
<button id="nav-account" class="w-full text-left px-3 py-2 rounded-md flex items-center text-purple-300 bg-purple-900/20 border-l-2 border-purple-500">
<i class="fa-solid fa-user-circle mr-3"></i>
<span>Konto</span>
</button>
</li>
<li>
<button id="nav-appearance" class="w-full text-left px-3 py-2 rounded-md flex items-center text-gray-300 hover:bg-white/5">
<i class="fa-solid fa-palette mr-3"></i>
<span>Erscheinungsbild</span>
</button>
</li>
<li>
<button id="nav-notifications" class="w-full text-left px-3 py-2 rounded-md flex items-center text-gray-300 hover:bg-white/5">
<i class="fa-solid fa-bell mr-3"></i>
<span>Benachrichtigungen</span>
</button>
</li>
<li>
<button id="nav-privacy" class="w-full text-left px-3 py-2 rounded-md flex items-center text-gray-300 hover:bg-white/5">
<i class="fa-solid fa-shield-alt mr-3"></i>
<span>Datenschutz</span>
</button>
</li>
</ul>
</nav>
</div>
</div>
<!-- Hauptinhalt der Einstellungen -->
<div class="lg:col-span-2 order-1 lg:order-2">
<!-- Konto-Einstellungen -->
<div id="section-account" class="bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl p-6 mb-6">
<h2 class="text-2xl font-bold text-white mb-4 flex items-center">
<i class="fa-solid fa-user-circle text-purple-400 mr-3"></i>
Konto-Einstellungen
</h2>
<div class="mb-6 p-4 bg-slate-900/50 rounded-lg">
<div class="flex items-center">
<div class="h-16 w-16 rounded-full bg-gradient-to-r from-purple-500 to-blue-500 flex items-center justify-center text-white text-2xl font-bold">
{{ current_user.username[0] | upper }}
</div>
<div class="ml-4">
<h3 class="text-lg font-medium text-white">{{ current_user.username }}</h3>
<p class="text-gray-400">{{ current_user.email }}</p>
<p class="text-xs text-gray-500 mt-1">
Mitglied seit {{ current_user.id | string }}
</p>
</div>
</div>
</div>
<form method="POST" class="space-y-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="username" class="block text-sm font-medium text-gray-400 mb-1">Benutzername</label>
<input type="text" name="username" id="username" value="{{ current_user.username }}" disabled
class="w-full bg-slate-800/80 border border-slate-700 rounded-md py-2 px-3 text-white focus:ring-1 focus:ring-purple-500">
<p class="mt-1 text-xs text-gray-500">Der Benutzername kann derzeit nicht geändert werden.</p>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-400 mb-1">E-Mail-Adresse</label>
<input type="email" name="email" id="email" value="{{ current_user.email }}" disabled
class="w-full bg-slate-800/80 border border-slate-700 rounded-md py-2 px-3 text-white focus:ring-1 focus:ring-purple-500">
<p class="mt-1 text-xs text-gray-500">Die E-Mail-Adresse kann derzeit nicht geändert werden.</p>
</div>
</div>
<div class="border-t border-slate-700 pt-6">
<h3 class="text-lg font-medium text-white mb-4">Passwort ändern</h3>
<div class="space-y-4">
<div>
<label for="current_password" class="block text-sm font-medium text-gray-400 mb-1">Aktuelles Passwort</label>
<input type="password" name="current_password" id="current_password"
class="w-full bg-slate-800/80 border border-slate-700 rounded-md py-2 px-3 text-white focus:ring-1 focus:ring-purple-500">
</div>
<div>
<label for="new_password" class="block text-sm font-medium text-gray-400 mb-1">Neues Passwort</label>
<input type="password" name="new_password" id="new_password"
class="w-full bg-slate-800/80 border border-slate-700 rounded-md py-2 px-3 text-white focus:ring-1 focus:ring-purple-500">
<p class="mt-1 text-xs text-gray-500">Mindestens 6 Zeichen</p>
</div>
<div>
<label for="confirm_password" class="block text-sm font-medium text-gray-400 mb-1">Passwort bestätigen</label>
<input type="password" name="confirm_password" id="confirm_password"
class="w-full bg-slate-800/80 border border-slate-700 rounded-md py-2 px-3 text-white focus:ring-1 focus:ring-purple-500">
</div>
</div>
</div>
<div class="flex justify-end">
<button type="submit" class="py-2 px-4 rounded-md bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white font-medium transition duration-300 transform hover:-translate-y-0.5">
Änderungen speichern
</button>
</div>
</form>
</div>
<!-- Erscheinungsbild -->
<div id="section-appearance" class="bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl p-6 mb-6 hidden">
<h2 class="text-2xl font-bold text-white mb-4 flex items-center">
<i class="fa-solid fa-palette text-purple-400 mr-3"></i>
Erscheinungsbild
</h2>
<div class="space-y-4">
<div class="p-4 bg-slate-900/50 rounded-lg">
<div class="flex justify-between items-center">
<div>
<h3 class="text-lg font-medium text-white">Dunkles Design</h3>
<p class="text-gray-400">Wechsle zwischen hellem und dunklem Modus</p>
</div>
<div>
<button id="toggle-dark-mode" class="w-14 h-7 flex items-center bg-purple-900/30 rounded-full px-1 transition-all" onclick="toggleDarkMode()">
<div id="dark-mode-indicator" class="bg-purple-500 w-5 h-5 rounded-full shadow-md transform transition-transform duration-300 translate-x-7"></div>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Benachrichtigungen -->
<div id="section-notifications" class="bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl p-6 mb-6 hidden">
<h2 class="text-2xl font-bold text-white mb-4 flex items-center">
<i class="fa-solid fa-bell text-purple-400 mr-3"></i>
Benachrichtigungen
</h2>
<div class="p-4 bg-slate-900/50 rounded-lg">
<div class="flex justify-between items-center">
<div>
<h3 class="text-lg font-medium text-white">E-Mail-Benachrichtigungen</h3>
<p class="text-gray-400">Diese Funktion wird in einer zukünftigen Version verfügbar sein.</p>
</div>
<div>
<span class="px-2 py-1 text-xs rounded-full bg-slate-700 text-gray-300">
Demnächst
</span>
</div>
</div>
</div>
</div>
<!-- Datenschutz -->
<div id="section-privacy" class="bg-gradient-to-br from-slate-900/80 to-slate-800/60 rounded-lg border border-slate-700/20 shadow-xl p-6 mb-6 hidden">
<h2 class="text-2xl font-bold text-white mb-4 flex items-center">
<i class="fa-solid fa-shield-alt text-purple-400 mr-3"></i>
Datenschutz und Sicherheit
</h2>
<div class="p-4 bg-slate-900/50 rounded-lg">
<h3 class="text-lg font-medium text-white mb-2">Datenverarbeitung</h3>
<p class="text-gray-400 mb-3">
Wir verarbeiten Ihre Daten gemäß unserer Datenschutzrichtlinie.
</p>
<a href="{{ url_for('datenschutz') }}" class="text-purple-400 hover:text-purple-300 inline-flex items-center">
<span>Datenschutzerklärung lesen</span>
<i class="fa-solid fa-arrow-right ml-1 text-sm"></i>
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function() {
// Navigation-Buttons
const navButtons = {
'nav-account': 'section-account',
'nav-appearance': 'section-appearance',
'nav-notifications': 'section-notifications',
'nav-privacy': 'section-privacy'
};
// Alle Abschnitte ausblenden außer dem ersten
Object.values(navButtons).forEach(sectionId => {
if (sectionId !== 'section-account') {
document.getElementById(sectionId).classList.add('hidden');
}
});
// Klick-Handler für Navigation
for (const [navId, sectionId] of Object.entries(navButtons)) {
document.getElementById(navId).addEventListener('click', function() {
// Alle Abschnitte ausblenden
Object.values(navButtons).forEach(id => {
document.getElementById(id).classList.add('hidden');
});
// Ausgewählten Abschnitt anzeigen
document.getElementById(sectionId).classList.remove('hidden');
// Aktiven Navigations-Button hervorheben, andere zurücksetzen
for (const btnId of Object.keys(navButtons)) {
const btn = document.getElementById(btnId);
if (btnId === navId) {
btn.classList.add('text-purple-300', 'bg-purple-900/20', 'border-l-2', 'border-purple-500');
btn.classList.remove('text-gray-300', 'hover:bg-white/5');
} else {
btn.classList.remove('text-purple-300', 'bg-purple-900/20', 'border-l-2', 'border-purple-500');
btn.classList.add('text-gray-300', 'hover:bg-white/5');
}
}
});
}
// Dark Mode Toggle aktualisieren
function updateDarkModeToggle() {
const isDarkMode = document.documentElement.classList.contains('dark');
const indicator = document.getElementById('dark-mode-indicator');
if (indicator) {
if (isDarkMode) {
indicator.classList.add('translate-x-7');
indicator.classList.remove('translate-x-0');
} else {
indicator.classList.add('translate-x-0');
indicator.classList.remove('translate-x-7');
}
}
}
updateDarkModeToggle();
// Globale Funktion für Toggle-Button
window.toggleDarkMode = function() {
if (typeof MindMap !== 'undefined' && typeof MindMap.toggleDarkMode === 'function') {
MindMap.toggleDarkMode();
} else {
document.documentElement.classList.toggle('dark');
}
updateDarkModeToggle();
}
});
</script>
{% endblock %}

41
utils/__init__.py Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility functions for the website application.
This package contains various utilities for database management,
user management, and server administration.
"""
# Import utilities that don't depend on app.py first
from .db_check import check_db_connection, initialize_db_if_needed
# Define the list of all available utilities
__all__ = [
# Database utilities
'check_db_connection',
'initialize_db_if_needed',
'fix_database_schema',
'rebuild_database',
'test_database_connection',
'test_models',
'print_database_stats',
'run_all_tests',
# User management
'list_users',
'create_user',
'reset_password',
'delete_user',
'create_admin_user',
# Server management
'run_development_server',
]
# Import remaining modules that might depend on app
from .db_fix import fix_database_schema
from .db_rebuild import rebuild_database
from .db_test import test_database_connection, test_models, print_database_stats, run_all_tests
from .user_manager import list_users, create_user, reset_password, delete_user, create_admin_user
from .server import run_development_server

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

79
utils/db_check.py Normal file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import current_app
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy import text
import time
def check_db_connection(db):
"""
Überprüft die Datenbankverbindung und versucht ggf. die Verbindung wiederherzustellen
Args:
db: SQLAlchemy-Instanz
Returns:
bool: True, wenn die Verbindung erfolgreich ist, sonst False
"""
max_retries = 3
retry_count = 0
while retry_count < max_retries:
try:
# Führe eine einfache Abfrage durch, um die Verbindung zu testen
with current_app.app_context():
db.session.execute(text('SELECT 1'))
return True
except SQLAlchemyError as e:
retry_count += 1
print(f"DB-Verbindungsfehler (Versuch {retry_count}/{max_retries}): {str(e)}")
if retry_count < max_retries:
# Warte vor dem nächsten Versuch
time.sleep(1)
# Versuche die Verbindung zurückzusetzen
try:
db.session.rollback()
except:
pass
return False
def initialize_db_if_needed(db, initialize_function=None):
"""
Initialisiert die Datenbank, falls erforderlich
Args:
db: SQLAlchemy-Instanz
initialize_function: Funktion, die aufgerufen wird, um die Datenbank zu initialisieren
Returns:
bool: True, wenn die Datenbank bereit ist, sonst False
"""
# Prüfe die Verbindung
if not check_db_connection(db):
return False
# Prüfe, ob die Tabellen existieren
try:
with current_app.app_context():
# Führe eine Testabfrage auf einer Tabelle durch
db.session.execute(text('SELECT COUNT(*) FROM user'))
except SQLAlchemyError:
# Tabellen existieren nicht, erstelle sie
try:
with current_app.app_context():
db.create_all()
# Rufe die Initialisierungsfunktion auf, falls vorhanden
if initialize_function and callable(initialize_function):
initialize_function()
return True
except Exception as e:
print(f"Fehler bei DB-Initialisierung: {str(e)}")
return False
return True

78
utils/db_fix.py Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sqlite3
from datetime import datetime
import sys
import importlib.util
# Add the parent directory to path so we can import the app
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from app import app, db_path
from models import db
def ensure_db_dir():
"""Make sure the database directory exists."""
os.makedirs(os.path.dirname(db_path), exist_ok=True)
def fix_database_schema():
"""Fix the database schema by adding missing columns."""
with app.app_context():
# Ensure directory exists
ensure_db_dir()
# Check if database exists, create tables if needed
if not os.path.exists(db_path):
print("Database doesn't exist. Creating all tables from scratch...")
db.create_all()
print("Database tables created successfully!")
return
# Connect to existing database
print(f"Connecting to database: {db_path}")
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Check if User table exists
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='user'")
if not cursor.fetchone():
print("User table doesn't exist. Creating all tables from scratch...")
conn.close()
db.create_all()
print("Database tables created successfully!")
return
# Check existing columns
cursor.execute("PRAGMA table_info(user)")
columns = cursor.fetchall()
column_names = [col[1] for col in columns]
print("Existing columns in User table:", column_names)
# Add missing columns
if 'created_at' not in column_names:
print("Adding 'created_at' column to User table...")
cursor.execute("ALTER TABLE user ADD COLUMN created_at TIMESTAMP")
if 'last_login' not in column_names:
print("Adding 'last_login' column to User table...")
cursor.execute("ALTER TABLE user ADD COLUMN last_login TIMESTAMP")
if 'avatar' not in column_names:
print("Adding 'avatar' column to User table...")
cursor.execute("ALTER TABLE user ADD COLUMN avatar VARCHAR(200)")
if 'bio' not in column_names:
print("Adding 'bio' column to User table...")
cursor.execute("ALTER TABLE user ADD COLUMN bio TEXT")
# Commit the changes
conn.commit()
conn.close()
print("Database schema updated successfully!")
return True
if __name__ == "__main__":
fix_database_schema()

91
utils/db_rebuild.py Executable file
View File

@@ -0,0 +1,91 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sqlite3
from datetime import datetime
import sys
import importlib.util
# Add the parent directory to path so we can import the app
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
# Import models directly to avoid circular import
from models import db, User, Category
def rebuild_database(app_instance=None):
"""Completely rebuilds the database by dropping and recreating all tables."""
if app_instance is None:
# Only import app if it's not provided as a parameter
from app import app as app_instance
from app import db_path
else:
# Get db_path from app_instance config
db_path = app_instance.config['SQLALCHEMY_DATABASE_URI'].replace('sqlite:///', '')
with app_instance.app_context():
print(f"Database path: {db_path}")
# Back up existing database if it exists
if os.path.exists(db_path):
backup_path = db_path + '.backup'
try:
import shutil
shutil.copy2(db_path, backup_path)
print(f"Backed up existing database to {backup_path}")
except Exception as e:
print(f"Warning: Could not create backup - {str(e)}")
# Ensure directory exists
os.makedirs(os.path.dirname(db_path), exist_ok=True)
# Drop all tables and recreate them
print("Dropping all tables...")
db.drop_all()
print("Creating all tables...")
db.create_all()
# Create admin user
print("Creating admin user...")
admin = User(
username='admin',
email='admin@example.com',
is_admin=True,
created_at=datetime.utcnow()
)
admin.set_password('admin')
db.session.add(admin)
# Create regular user
print("Creating regular user...")
user = User(
username='user',
email='user@example.com',
is_admin=False,
created_at=datetime.utcnow()
)
user.set_password('user')
db.session.add(user)
try:
# Commit to generate user IDs
db.session.commit()
print("Users created successfully!")
# Create default categories
print("Creating default categories...")
# Instead of directly importing create_default_categories, call it through app_instance
create_default_categories_func = getattr(sys.modules['app'], 'create_default_categories')
create_default_categories_func()
print("Database rebuild completed successfully!")
return True
except Exception as e:
db.session.rollback()
print(f"Error during database rebuild: {str(e)}")
raise
if __name__ == "__main__":
rebuild_database()

120
utils/db_test.py Executable file
View File

@@ -0,0 +1,120 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import sqlite3
# Add the parent directory to path so we can import the app
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from app import app, db_path
from models import db, User, Thought, MindMapNode, Category
def test_database_connection():
"""Test if the database exists and can be connected to."""
try:
if not os.path.exists(db_path):
print(f"Database file does not exist: {db_path}")
return False
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
cursor.execute("PRAGMA integrity_check")
result = cursor.fetchone()
conn.close()
if result and result[0] == "ok":
print(f"Database integrity check passed: {db_path}")
return True
else:
print(f"Database integrity check failed: {result}")
return False
except Exception as e:
print(f"Error testing database connection: {e}")
return False
def test_models():
"""Test if all models are properly defined and can be queried."""
with app.app_context():
try:
print("\nTesting User model...")
user_count = User.query.count()
print(f" Found {user_count} users")
print("\nTesting Category model...")
category_count = Category.query.count()
print(f" Found {category_count} categories")
print("\nTesting MindMapNode model...")
node_count = MindMapNode.query.count()
print(f" Found {node_count} mindmap nodes")
print("\nTesting Thought model...")
thought_count = Thought.query.count()
print(f" Found {thought_count} thoughts")
if user_count == 0:
print("\nWARNING: No users found in the database. You might need to create an admin user.")
return True
except Exception as e:
print(f"Error testing models: {e}")
return False
def print_database_stats():
"""Print database statistics."""
with app.app_context():
try:
stats = []
stats.append(("Users", User.query.count()))
stats.append(("Categories", Category.query.count()))
stats.append(("Mindmap Nodes", MindMapNode.query.count()))
stats.append(("Thoughts", Thought.query.count()))
print("\nDatabase Statistics:")
print("-" * 40)
for name, count in stats:
print(f"{name:<20} : {count}")
print("-" * 40)
return True
except Exception as e:
print(f"Error generating database statistics: {e}")
return False
def run_all_tests():
"""Run all database tests."""
success = True
print("=" * 60)
print("STARTING DATABASE TESTS")
print("=" * 60)
# Test database connection
print("\n1. Testing database connection...")
if not test_database_connection():
success = False
# Test models
print("\n2. Testing database models...")
if not test_models():
success = False
# Print statistics
print("\n3. Database statistics:")
if not print_database_stats():
success = False
print("\n" + "=" * 60)
if success:
print("All database tests completed successfully!")
else:
print("Some database tests failed. Check the output above for details.")
print("=" * 60)
return success
if __name__ == "__main__":
run_all_tests()

225
utils/download_resources.py Executable file
View File

@@ -0,0 +1,225 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dieses Skript lädt externe Ressourcen wie Font Awesome, Tailwind CSS und Alpine.js herunter
und installiert sie lokal, um die Abhängigkeit von externen CDNs zu vermeiden und
die Content Security Policy zu erfüllen.
"""
import os
import sys
import requests
import zipfile
import io
import shutil
import subprocess
from pathlib import Path
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# URLs für die Ressourcen
RESOURCES = {
'alpine.js': 'https://cdn.jsdelivr.net/npm/alpinejs@3.12.3/dist/cdn.min.js',
'font_awesome': 'https://use.fontawesome.com/releases/v6.4.0/fontawesome-free-6.4.0-web.zip',
'inter_font_300': 'https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2',
'inter_font_400': 'https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2',
'inter_font_500': 'https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2',
'inter_font_600': 'https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2',
'inter_font_700': 'https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2',
'jetbrains_font_400': 'https://fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2',
'jetbrains_font_500': 'https://fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2',
'jetbrains_font_700': 'https://fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2',
}
# Zielverzeichnisse
DIRECTORIES = {
'js': os.path.join(BASE_DIR, 'static', 'js'),
'css': os.path.join(BASE_DIR, 'static', 'css'),
'fonts': os.path.join(BASE_DIR, 'static', 'fonts'),
'webfonts': os.path.join(BASE_DIR, 'static', 'webfonts'),
}
def download_file(url, filepath):
"""Lädt eine Datei von einer URL herunter und speichert sie lokal."""
response = requests.get(url, stream=True)
if response.status_code == 200:
with open(filepath, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"✅ Heruntergeladen: {os.path.basename(filepath)}")
return True
else:
print(f"❌ Fehler beim Herunterladen von {url}: {response.status_code}")
return False
def extract_zip(zip_data, extract_to):
"""Extrahiert eine ZIP-Datei in das angegebene Verzeichnis."""
with zipfile.ZipFile(io.BytesIO(zip_data)) as zip_ref:
zip_ref.extractall(extract_to)
def setup_directories():
"""Erstellt die benötigten Verzeichnisse, falls sie nicht existieren."""
for directory in DIRECTORIES.values():
os.makedirs(directory, exist_ok=True)
print(f"📁 Verzeichnis erstellt/überprüft: {directory}")
def download_alpine():
"""Lädt Alpine.js herunter."""
url = RESOURCES['alpine.js']
filepath = os.path.join(DIRECTORIES['js'], 'alpine.min.js')
download_file(url, filepath)
def download_font_awesome():
"""Lädt Font Awesome herunter und extrahiert die Dateien."""
url = RESOURCES['font_awesome']
response = requests.get(url)
if response.status_code == 200:
# Temporäres Verzeichnis für die Extraktion
temp_dir = os.path.join(BASE_DIR, 'temp_fontawesome')
os.makedirs(temp_dir, exist_ok=True)
# ZIP-Datei extrahieren
extract_zip(response.content, temp_dir)
# CSS-Datei kopieren
fa_dir = os.path.join(temp_dir, 'fontawesome-free-6.4.0-web')
css_source = os.path.join(fa_dir, 'css', 'all.min.css')
css_dest = os.path.join(DIRECTORIES['css'], 'all.min.css')
shutil.copyfile(css_source, css_dest)
print(f"✅ Font Awesome CSS kopiert nach {css_dest}")
# Webfonts-Verzeichnis kopieren
webfonts_source = os.path.join(fa_dir, 'webfonts')
shutil.rmtree(DIRECTORIES['webfonts'], ignore_errors=True)
shutil.copytree(webfonts_source, DIRECTORIES['webfonts'])
print(f"✅ Font Awesome Webfonts kopiert nach {DIRECTORIES['webfonts']}")
# Temporäres Verzeichnis löschen
shutil.rmtree(temp_dir)
return True
else:
print(f"❌ Fehler beim Herunterladen von Font Awesome: {response.status_code}")
return False
def download_google_fonts():
"""Lädt die Google Fonts (Inter und JetBrains Mono) herunter."""
font_files = {
'inter-light.woff2': RESOURCES['inter_font_300'],
'inter-regular.woff2': RESOURCES['inter_font_400'],
'inter-medium.woff2': RESOURCES['inter_font_500'],
'inter-semibold.woff2': RESOURCES['inter_font_600'],
'inter-bold.woff2': RESOURCES['inter_font_700'],
'jetbrainsmono-regular.woff2': RESOURCES['jetbrains_font_400'],
'jetbrainsmono-medium.woff2': RESOURCES['jetbrains_font_500'],
'jetbrainsmono-bold.woff2': RESOURCES['jetbrains_font_700'],
}
for filename, url in font_files.items():
filepath = os.path.join(DIRECTORIES['fonts'], filename)
download_file(url, filepath)
def setup_tailwind():
"""Richtet Tailwind CSS ein."""
# Tailwind-Konfiguration erstellen, falls sie nicht existiert
tailwind_config = os.path.join(BASE_DIR, 'tailwind.config.js')
if not os.path.exists(tailwind_config):
with open(tailwind_config, 'w') as f:
f.write("""/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class',
content: [
"./templates/**/*.html",
"./static/**/*.js",
],
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'ui-sans-serif', 'system-ui', '-apple-system', 'sans-serif'],
mono: ['JetBrains Mono', 'ui-monospace', 'monospace']
},
colors: {
primary: {
50: '#f5f3ff',
100: '#ede9fe',
200: '#ddd6fe',
300: '#c4b5fd',
400: '#a78bfa',
500: '#8b5cf6',
600: '#7c3aed',
700: '#6d28d9',
800: '#5b21b6',
900: '#4c1d95'
},
secondary: {
50: '#ecfdf5',
100: '#d1fae5',
200: '#a7f3d0',
300: '#6ee7b7',
400: '#34d399',
500: '#10b981',
600: '#059669',
700: '#047857',
800: '#065f46',
900: '#064e3b'
},
dark: {
500: '#374151',
600: '#1f2937',
700: '#111827',
800: '#0e1220',
900: '#0a0e19'
}
}
}
},
plugins: [],
}
""")
print(f"✅ Tailwind-Konfiguration erstellt: {tailwind_config}")
# Input-CSS-Datei erstellen
input_css_dir = os.path.join(DIRECTORIES['css'], 'src')
os.makedirs(input_css_dir, exist_ok=True)
input_css = os.path.join(input_css_dir, 'input.css')
if not os.path.exists(input_css):
with open(input_css, 'w') as f:
f.write("""@tailwind base;
@tailwind components;
@tailwind utilities;
""")
print(f"✅ Tailwind Input-CSS erstellt: {input_css}")
# Hinweis zur Kompilierung anzeigen
print("\n📋 Um Tailwind CSS zu kompilieren, führe folgenden Befehl aus:")
print("npm install -D tailwindcss")
print(f"npx tailwindcss -i {input_css} -o {os.path.join(DIRECTORIES['css'], 'tailwind.min.css')} --minify")
def main():
"""Hauptfunktion: Lädt alle benötigten Ressourcen herunter."""
print("🚀 Starte den Download externer Ressourcen...")
setup_directories()
# Alpine.js herunterladen
print("\n📦 Lade Alpine.js herunter...")
download_alpine()
# Font Awesome herunterladen
print("\n📦 Lade Font Awesome herunter...")
download_font_awesome()
# Google Fonts herunterladen
print("\n📦 Lade Google Fonts herunter...")
download_google_fonts()
# Tailwind CSS einrichten
print("\n📦 Richte Tailwind CSS ein...")
setup_tailwind()
print("\n✅ Alle Ressourcen wurden erfolgreich heruntergeladen und eingerichtet!")
print("🔒 Die Webseite sollte nun ohne externe CDNs funktionieren und die Content Security Policy erfüllen.")
if __name__ == "__main__":
main()

34
utils/server.py Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
# Add the parent directory to path so we can import the app
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from app import app
def run_development_server(host='127.0.0.1', port=5000, debug=True):
"""Run the Flask development server."""
try:
print(f"Starting development server on http://{host}:{port}")
print("Press CTRL+C to stop the server")
app.run(host=host, port=port, debug=debug)
return True
except Exception as e:
print(f"Error starting development server: {e}")
return False
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Run the development server')
parser.add_argument('--host', default='127.0.0.1', help='Host to bind to')
parser.add_argument('--port', type=int, default=5000, help='Port to bind to')
parser.add_argument('--debug', action='store_true', default=True, help='Enable debug mode')
args = parser.parse_args()
run_development_server(host=args.host, port=args.port, debug=args.debug)

159
utils/user_manager.py Executable file
View File

@@ -0,0 +1,159 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from datetime import datetime
# Add the parent directory to path so we can import the app
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from app import app
from models import db, User
def list_users():
"""List all users in the database."""
with app.app_context():
try:
users = User.query.all()
if not users:
print("No users found in the database.")
return []
print("Found {} users:".format(len(users)))
print("-" * 60)
print("{:<5} {:<20} {:<30} {:<10}".format("ID", "Username", "Email", "Admin"))
print("-" * 60)
for user in users:
print("{:<5} {:<20} {:<30} {:<10}".format(
user.id, user.username, user.email, "Yes" if user.is_admin else "No"
))
return users
except Exception as e:
print(f"Error listing users: {e}")
return []
def create_user(username, email, password, is_admin=False):
"""Create a new user in the database."""
with app.app_context():
try:
# Check if user already exists
existing_user = User.query.filter_by(username=username).first()
if existing_user:
print(f"User with username '{username}' already exists.")
return False
# Check if email already exists
existing_email = User.query.filter_by(email=email).first()
if existing_email:
print(f"User with email '{email}' already exists.")
return False
# Create new user
user = User(
username=username,
email=email,
is_admin=is_admin,
created_at=datetime.utcnow()
)
user.set_password(password)
db.session.add(user)
db.session.commit()
print(f"User '{username}' created successfully!")
return True
except Exception as e:
db.session.rollback()
print(f"Error creating user: {e}")
return False
def reset_password(username, new_password):
"""Reset password for a user."""
with app.app_context():
try:
user = User.query.filter_by(username=username).first()
if not user:
print(f"User '{username}' not found.")
return False
user.set_password(new_password)
db.session.commit()
print(f"Password for user '{username}' reset successfully!")
return True
except Exception as e:
db.session.rollback()
print(f"Error resetting password: {e}")
return False
def delete_user(username):
"""Delete a user from the database."""
with app.app_context():
try:
user = User.query.filter_by(username=username).first()
if not user:
print(f"User '{username}' not found.")
return False
db.session.delete(user)
db.session.commit()
print(f"User '{username}' deleted successfully!")
return True
except Exception as e:
db.session.rollback()
print(f"Error deleting user: {e}")
return False
def create_admin_user():
"""Create an admin user in the database."""
return create_user('admin', 'admin@example.com', 'admin', is_admin=True)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='User management utility')
subparsers = parser.add_subparsers(dest='command', help='Command to execute')
# List users command
list_parser = subparsers.add_parser('list', help='List all users')
# Create user command
create_parser = subparsers.add_parser('create', help='Create a new user')
create_parser.add_argument('--username', '-u', required=True, help='Username')
create_parser.add_argument('--email', '-e', required=True, help='Email address')
create_parser.add_argument('--password', '-p', required=True, help='Password')
create_parser.add_argument('--admin', '-a', action='store_true', help='Make user an admin')
# Reset password command
reset_parser = subparsers.add_parser('reset-password', help='Reset a user password')
reset_parser.add_argument('--username', '-u', required=True, help='Username')
reset_parser.add_argument('--password', '-p', required=True, help='New password')
# Delete user command
delete_parser = subparsers.add_parser('delete', help='Delete a user')
delete_parser.add_argument('--username', '-u', required=True, help='Username to delete')
# Create admin command (shortcut)
admin_parser = subparsers.add_parser('create-admin', help='Create the default admin user')
args = parser.parse_args()
if args.command == 'list':
list_users()
elif args.command == 'create':
create_user(args.username, args.email, args.password, args.admin)
elif args.command == 'reset-password':
reset_password(args.username, args.password)
elif args.command == 'delete':
delete_user(args.username)
elif args.command == 'create-admin':
create_admin_user()
else:
parser.print_help()

View File

@@ -1,264 +0,0 @@
import os
from datetime import datetime
from flask import Flask, render_template, request, redirect, url_for, flash, jsonify
from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
import json
app = Flask(__name__)
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'default-dev-key')
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///mindmap.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
login_manager = LoginManager(app)
login_manager.login_view = 'login'
# Database Models
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
password_hash = db.Column(db.String(128))
is_admin = db.Column(db.Boolean, default=False)
thoughts = db.relationship('Thought', backref='author', lazy=True)
def set_password(self, password):
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
class Thought(db.Model):
id = db.Column(db.Integer, primary_key=True)
content = db.Column(db.Text, nullable=False)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
branch = db.Column(db.String(100), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
comments = db.relationship('Comment', backref='thought', lazy=True, cascade="all, delete-orphan")
class Comment(db.Model):
id = db.Column(db.Integer, primary_key=True)
content = db.Column(db.Text, nullable=False)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
thought_id = db.Column(db.Integer, db.ForeignKey('thought.id'), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
author = db.relationship('User', backref='comments')
class MindMapNode(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
parent_id = db.Column(db.Integer, db.ForeignKey('mind_map_node.id'), nullable=True)
children = db.relationship('MindMapNode', backref=db.backref('parent', remote_side=[id]))
thoughts = db.relationship('Thought', secondary='node_thought_association', backref='nodes')
# Association table for many-to-many relationship between MindMapNode and Thought
node_thought_association = db.Table('node_thought_association',
db.Column('node_id', db.Integer, db.ForeignKey('mind_map_node.id'), primary_key=True),
db.Column('thought_id', db.Integer, db.ForeignKey('thought.id'), primary_key=True)
)
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
# Routes for authentication
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
username = request.form.get('username')
password = request.form.get('password')
user = User.query.filter_by(username=username).first()
if user and user.check_password(password):
login_user(user)
next_page = request.args.get('next')
return redirect(next_page or url_for('index'))
flash('Ungültiger Benutzername oder Passwort')
return render_template('login.html')
@app.route('/register', methods=['GET', 'POST'])
def register():
if request.method == 'POST':
username = request.form.get('username')
email = request.form.get('email')
password = request.form.get('password')
if User.query.filter_by(username=username).first():
flash('Benutzername existiert bereits')
return redirect(url_for('register'))
if User.query.filter_by(email=email).first():
flash('E-Mail ist bereits registriert')
return redirect(url_for('register'))
user = User(username=username, email=email)
user.set_password(password)
db.session.add(user)
db.session.commit()
login_user(user)
return redirect(url_for('index'))
return render_template('register.html')
@app.route('/logout')
@login_required
def logout():
logout_user()
return redirect(url_for('index'))
# Route for the homepage
@app.route('/')
def index():
return render_template('index.html')
# Route for the mindmap page
@app.route('/mindmap')
def mindmap():
return render_template('mindmap.html')
# Route for user profile
@app.route('/profile')
@login_required
def profile():
thoughts = Thought.query.filter_by(user_id=current_user.id).order_by(Thought.timestamp.desc()).all()
return render_template('profile.html', thoughts=thoughts)
# API routes for mindmap and thoughts
@app.route('/api/mindmap')
def get_mindmap():
root_nodes = MindMapNode.query.filter_by(parent_id=None).all()
def build_tree(node):
return {
'id': node.id,
'name': node.name,
'children': [build_tree(child) for child in node.children]
}
result = [build_tree(node) for node in root_nodes]
return jsonify(result)
@app.route('/api/thoughts/<int:node_id>', methods=['GET'])
def get_thoughts(node_id):
node = MindMapNode.query.get_or_404(node_id)
thoughts = []
for thought in node.thoughts:
thoughts.append({
'id': thought.id,
'content': thought.content,
'author': thought.author.username,
'timestamp': thought.timestamp.strftime('%d.%m.%Y, %H:%M'),
'comments_count': len(thought.comments),
'branch': thought.branch
})
return jsonify(thoughts)
@app.route('/api/thought/<int:thought_id>', methods=['GET'])
def get_thought(thought_id):
thought = Thought.query.get_or_404(thought_id)
return jsonify({
'id': thought.id,
'content': thought.content,
'author': thought.author.username,
'timestamp': thought.timestamp.strftime('%d.%m.%Y, %H:%M'),
'branch': thought.branch,
'comments_count': len(thought.comments)
})
@app.route('/api/thoughts', methods=['POST'])
@login_required
def add_thought():
data = request.json
node_id = data.get('node_id')
content = data.get('content')
if not node_id or not content:
return jsonify({'error': 'Fehlende Daten'}), 400
node = MindMapNode.query.get_or_404(node_id)
thought = Thought(
content=content,
branch=node.name,
user_id=current_user.id
)
db.session.add(thought)
node.thoughts.append(thought)
db.session.commit()
return jsonify({
'id': thought.id,
'content': thought.content,
'author': thought.author.username,
'timestamp': thought.timestamp.strftime('%d.%m.%Y, %H:%M'),
'branch': thought.branch
})
@app.route('/api/comments/<int:thought_id>', methods=['GET'])
def get_comments(thought_id):
thought = Thought.query.get_or_404(thought_id)
comments = [
{
'id': comment.id,
'content': comment.content,
'author': comment.author.username,
'timestamp': comment.timestamp.strftime('%d.%m.%Y, %H:%M')
}
for comment in thought.comments
]
return jsonify(comments)
@app.route('/api/comments', methods=['POST'])
@login_required
def add_comment():
data = request.json
thought_id = data.get('thought_id')
content = data.get('content')
if not thought_id or not content:
return jsonify({'error': 'Fehlende Daten'}), 400
thought = Thought.query.get_or_404(thought_id)
comment = Comment(
content=content,
thought_id=thought_id,
user_id=current_user.id
)
db.session.add(comment)
db.session.commit()
return jsonify({
'id': comment.id,
'content': comment.content,
'author': comment.author.username,
'timestamp': comment.timestamp.strftime('%d.%m.%Y, %H:%M')
})
# Admin routes
@app.route('/admin')
@login_required
def admin():
if not current_user.is_admin:
flash('Zugriff verweigert')
return redirect(url_for('index'))
users = User.query.all()
nodes = MindMapNode.query.all()
thoughts = Thought.query.all()
return render_template('admin.html', users=users, nodes=nodes, thoughts=thoughts)
# Flask starten
if __name__ == '__main__':
with app.app_context():
# Make sure tables exist
db.create_all()
app.run(host="0.0.0.0", debug=True)

View File

@@ -1,88 +0,0 @@
from app import app, db, User, MindMapNode
def init_database():
"""Initialize the database with admin user and mindmap structure."""
with app.app_context():
# Create all tables
db.create_all()
# Check if we already have users
if User.query.first() is None:
print("Creating admin user...")
# Create admin user
admin = User(username='admin', email='admin@example.com', is_admin=True)
admin.set_password('admin123')
db.session.add(admin)
# Create regular test user
test_user = User(username='test', email='test@example.com', is_admin=False)
test_user.set_password('test123')
db.session.add(test_user)
db.session.commit()
print("Admin user created successfully!")
# Check if we already have mindmap nodes
if MindMapNode.query.first() is None:
print("Creating initial mindmap structure...")
# Create initial mindmap structure
root = MindMapNode(name="Wissenschaftliche Mindmap")
db.session.add(root)
# Level 1 nodes
node1 = MindMapNode(name="Naturwissenschaften", parent=root)
node2 = MindMapNode(name="Geisteswissenschaften", parent=root)
node3 = MindMapNode(name="Technologie", parent=root)
node4 = MindMapNode(name="Künste", parent=root)
db.session.add_all([node1, node2, node3, node4])
# Level 2 nodes - Naturwissenschaften
node1_1 = MindMapNode(name="Physik", parent=node1)
node1_2 = MindMapNode(name="Biologie", parent=node1)
node1_3 = MindMapNode(name="Chemie", parent=node1)
node1_4 = MindMapNode(name="Astronomie", parent=node1)
db.session.add_all([node1_1, node1_2, node1_3, node1_4])
# Level 2 nodes - Geisteswissenschaften
node2_1 = MindMapNode(name="Philosophie", parent=node2)
node2_2 = MindMapNode(name="Geschichte", parent=node2)
node2_3 = MindMapNode(name="Psychologie", parent=node2)
node2_4 = MindMapNode(name="Soziologie", parent=node2)
db.session.add_all([node2_1, node2_2, node2_3, node2_4])
# Level 2 nodes - Technologie
node3_1 = MindMapNode(name="Informatik", parent=node3)
node3_2 = MindMapNode(name="Biotechnologie", parent=node3)
node3_3 = MindMapNode(name="Künstliche Intelligenz", parent=node3)
node3_4 = MindMapNode(name="Energietechnik", parent=node3)
db.session.add_all([node3_1, node3_2, node3_3, node3_4])
# Level 2 nodes - Künste
node4_1 = MindMapNode(name="Bildende Kunst", parent=node4)
node4_2 = MindMapNode(name="Musik", parent=node4)
node4_3 = MindMapNode(name="Literatur", parent=node4)
node4_4 = MindMapNode(name="Film", parent=node4)
db.session.add_all([node4_1, node4_2, node4_3, node4_4])
# Level 3 nodes - a few examples
# Physik
MindMapNode(name="Quantenphysik", parent=node1_1)
MindMapNode(name="Relativitätstheorie", parent=node1_1)
# Informatik
MindMapNode(name="Maschinelles Lernen", parent=node3_1)
MindMapNode(name="Softwareentwicklung", parent=node3_1)
MindMapNode(name="Datenbanken", parent=node3_1)
# Commit changes
db.session.commit()
print("Mindmap structure created successfully!")
print("Database initialization complete.")
if __name__ == "__main__":
init_database()
print("You can now run the application with 'python app.py'")
print("Login with:")
print(" Admin: username=admin, password=admin123")
print(" User: username=test, password=test123")

Binary file not shown.

View File

@@ -1,6 +0,0 @@
flask
flask-login
flask-wtf
email-validator
python-dotenv
flask-sqlalchemy

Some files were not shown because too many files have changed in this diff Show More