feat: Implementierung von Benachrichtigungen und sozialen Funktionen; Hinzufügen von API-Endpunkten für Benachrichtigungen, Benutzer-Follows und soziale Interaktionen; Verbesserung des Logging-Systems zur besseren Nachverfolgbarkeit von Systemereignissen.

This commit is contained in:
2025-05-28 22:08:56 +02:00
parent 1f4394e9b6
commit f5c2e70a11
31 changed files with 9294 additions and 591 deletions

View File

@@ -411,17 +411,49 @@
<div class="mindmap-container">
<div id="cy"></div>
<!-- Zoom-Toolbar für Hauptmindmap -->
<!-- Toolbar -->
<div class="mindmap-toolbar">
<button id="zoomIn" title="Vergrößern">
<i class="fas fa-plus"></i>
</button>
<button id="zoomOut" title="Verkleinern">
<i class="fas fa-minus"></i>
</button>
<button id="resetView" title="Ansicht zurücksetzen">
<i class="fas fa-expand"></i>
</button>
<div class="toolbar-section">
<button id="add-node-btn" class="toolbar-btn" title="Knoten hinzufügen">
<i class="fas fa-plus"></i>
<span>Knoten</span>
</button>
<button id="add-thought-btn" class="toolbar-btn" title="Gedanken hinzufügen">
<i class="fas fa-lightbulb"></i>
<span>Gedanke</span>
</button>
<button id="collaborate-btn" class="toolbar-btn" title="Kollaboration starten">
<i class="fas fa-users"></i>
<span>Kollaboration</span>
</button>
</div>
<div class="toolbar-section">
<button id="export-btn" class="toolbar-btn" title="Mindmap exportieren">
<i class="fas fa-download"></i>
<span>Export</span>
</button>
<button id="share-btn" class="toolbar-btn" title="Mindmap teilen">
<i class="fas fa-share"></i>
<span>Teilen</span>
</button>
<button id="fullscreen-btn" class="toolbar-btn" title="Vollbild">
<i class="fas fa-expand"></i>
<span>Vollbild</span>
</button>
</div>
<div class="toolbar-section">
<button id="zoom-in-btn" class="toolbar-btn" title="Vergrößern">
<i class="fas fa-search-plus"></i>
</button>
<button id="zoom-out-btn" class="toolbar-btn" title="Verkleinern">
<i class="fas fa-search-minus"></i>
</button>
<button id="reset-view-btn" class="toolbar-btn" title="Ansicht zurücksetzen">
<i class="fas fa-home"></i>
</button>
</div>
</div>
<div class="mindmap-header">
@@ -679,9 +711,9 @@ document.addEventListener('DOMContentLoaded', function() {
}
// Funktionen für Zoom-Buttons und Reset
const zoomInBtn = document.getElementById('zoomIn');
const zoomOutBtn = document.getElementById('zoomOut');
const resetViewBtn = document.getElementById('resetView');
const zoomInBtn = document.getElementById('zoom-in-btn');
const zoomOutBtn = document.getElementById('zoom-out-btn');
const resetViewBtn = document.getElementById('reset-view-btn');
if (zoomInBtn && window.cy) {
zoomInBtn.addEventListener('click', function() {
@@ -700,6 +732,199 @@ document.addEventListener('DOMContentLoaded', function() {
if (window.cy) window.cy.fit();
});
}
// Neue Toolbar-Funktionen
const addNodeBtn = document.getElementById('add-node-btn');
const addThoughtBtn = document.getElementById('add-thought-btn');
const collaborateBtn = document.getElementById('collaborate-btn');
const exportBtn = document.getElementById('export-btn');
const shareBtn = document.getElementById('share-btn');
const fullscreenBtn = document.getElementById('fullscreen-btn');
if (addNodeBtn) {
addNodeBtn.addEventListener('click', function() {
// Öffne Modal zum Hinzufügen eines neuen Knotens
showAddNodeModal();
});
}
if (addThoughtBtn) {
addThoughtBtn.addEventListener('click', function() {
// Öffne Modal zum Hinzufügen eines Gedankens
showAddThoughtModal();
});
}
if (collaborateBtn) {
collaborateBtn.addEventListener('click', function() {
// Starte Kollaborationsmodus
startCollaboration();
});
}
if (exportBtn) {
exportBtn.addEventListener('click', function() {
// Exportiere Mindmap
exportMindmap();
});
}
if (shareBtn) {
shareBtn.addEventListener('click', function() {
// Teile Mindmap
shareMindmap();
});
}
if (fullscreenBtn) {
fullscreenBtn.addEventListener('click', function() {
// Vollbild-Modus
toggleFullscreen();
});
}
// Funktionen implementieren
function showAddNodeModal() {
// Erstelle ein einfaches Modal für neuen Knoten
const nodeName = prompt('Name des neuen Knotens:');
if (nodeName && nodeName.trim()) {
addNewNode(nodeName.trim());
}
}
function showAddThoughtModal() {
// Erstelle ein Modal für neuen Gedanken
const thoughtTitle = prompt('Titel des Gedankens:');
if (thoughtTitle && thoughtTitle.trim()) {
addNewThought(thoughtTitle.trim());
}
}
function addNewNode(name) {
// API-Aufruf zum Hinzufügen eines neuen Knotens
fetch('/api/mindmap/public/add_node', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: name,
description: '',
x_position: Math.random() * 400 + 100,
y_position: Math.random() * 400 + 100
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
// Lade Mindmap neu
location.reload();
} else {
alert('Fehler beim Hinzufügen des Knotens: ' + (data.error || 'Unbekannter Fehler'));
}
})
.catch(error => {
console.error('Fehler:', error);
alert('Ein Fehler ist aufgetreten.');
});
}
function addNewThought(title) {
// API-Aufruf zum Hinzufügen eines neuen Gedankens
fetch('/api/thoughts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: title,
content: 'Neuer Gedanke erstellt über die Mindmap',
branch: 'Allgemein'
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Gedanke erfolgreich erstellt!');
} else {
alert('Fehler beim Erstellen des Gedankens: ' + (data.error || 'Unbekannter Fehler'));
}
})
.catch(error => {
console.error('Fehler:', error);
alert('Ein Fehler ist aufgetreten.');
});
}
function startCollaboration() {
// Kollaborationsmodus starten
alert('Kollaborationsmodus wird bald verfügbar sein!\n\nGeplante Features:\n- Echtzeit-Bearbeitung\n- Live-Cursor anderer Benutzer\n- Chat-Integration\n- Änderungshistorie');
}
function exportMindmap() {
// Mindmap exportieren
const format = prompt('Export-Format wählen:\n1. JSON\n2. PNG (geplant)\n3. PDF (geplant)\n\nGeben Sie 1, 2 oder 3 ein:', '1');
if (format === '1') {
// JSON-Export
if (window.cy) {
const data = window.cy.json();
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'mindmap-export.json';
a.click();
URL.revokeObjectURL(url);
}
} else {
alert('Dieses Format wird bald verfügbar sein!');
}
}
function shareMindmap() {
// Mindmap teilen
if (navigator.share) {
navigator.share({
title: 'SysTades Mindmap',
text: 'Schau dir diese interessante Mindmap an!',
url: window.location.href
});
} else {
// Fallback: URL kopieren
navigator.clipboard.writeText(window.location.href).then(() => {
alert('Mindmap-Link wurde in die Zwischenablage kopiert!');
}).catch(() => {
prompt('Kopiere diesen Link zum Teilen:', window.location.href);
});
}
}
function toggleFullscreen() {
// Vollbild-Modus umschalten
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen().catch(err => {
console.error('Fehler beim Aktivieren des Vollbildmodus:', err);
});
} else {
document.exitFullscreen();
}
}
// Vollbild-Event-Listener
document.addEventListener('fullscreenchange', function() {
const fullscreenBtn = document.getElementById('fullscreen-btn');
if (fullscreenBtn) {
const icon = fullscreenBtn.querySelector('i');
if (document.fullscreenElement) {
icon.className = 'fas fa-compress';
fullscreenBtn.title = 'Vollbild verlassen';
} else {
icon.className = 'fas fa-expand';
fullscreenBtn.title = 'Vollbild';
}
}
});
});
</script>
{% endblock %}