From 14474c4eab99359220dd5db6e1d1055a31ef253f Mon Sep 17 00:00:00 2001 From: marwin Date: Sat, 26 Apr 2025 18:40:27 +0100 Subject: [PATCH] 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. --- .../static/js/modules/chatgpt-assistant.js | 4 +- website/static/js/modules/mindmap.js | 61 ++++++++++++ website/templates/base.html | 14 +-- website/templates/index.html | 96 +++++++++++-------- 4 files changed, 125 insertions(+), 50 deletions(-) diff --git a/website/static/js/modules/chatgpt-assistant.js b/website/static/js/modules/chatgpt-assistant.js index 4083b15..8f1f9a2 100644 --- a/website/static/js/modules/chatgpt-assistant.js +++ b/website/static/js/modules/chatgpt-assistant.js @@ -24,7 +24,7 @@ class ChatGPTAssistant { this.setupEventListeners(); // Ersten Willkommensnachricht anzeigen - this.addMessage("assistant", "Wie kann ich dir heute helfen?"); + this.addMessage("assistant", "Frage den KI-Assistenten"); } /** @@ -71,7 +71,7 @@ class ChatGPTAssistant { this.inputField = document.createElement('input'); this.inputField.type = 'text'; - this.inputField.placeholder = 'Frage stellen...'; + this.inputField.placeholder = 'Frage den KI-Assistenten'; 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'); diff --git a/website/static/js/modules/mindmap.js b/website/static/js/modules/mindmap.js index b6a2e04..41d93cb 100644 --- a/website/static/js/modules/mindmap.js +++ b/website/static/js/modules/mindmap.js @@ -425,6 +425,9 @@ class MindMapVisualization { // Simulation neu starten this.simulation.restart(); + + // Update connection counts + this.updateConnectionCounts(); } ticked() { @@ -610,6 +613,64 @@ class MindMapVisualization { 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; + } } // Exportiere die Klasse für die Verwendung in anderen Modulen diff --git a/website/templates/base.html b/website/templates/base.html index 2156962..7c552ab 100644 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -3,7 +3,7 @@ - MindMap - {% block title %}{% endblock %} + Systades - {% block title %}{% endblock %} @@ -11,8 +11,8 @@ - - + + @@ -550,7 +550,7 @@
- MindMap + Systades @@ -727,11 +727,11 @@
+ :class="darkMode ? 'bg-gray-900/40 backdrop-blur-md border border-white/10' : 'bg-white/40 backdrop-blur-md border border-gray-200/50'">
- MindMap + Systades

Eine interaktive Plattform zum Visualisieren, Erforschen und Teilen von Wissen.

@@ -775,7 +775,7 @@
- © {{ current_year }} MindMap. Alle Rechte vorbehalten. + © {{ current_year }} Systades. Alle Rechte vorbehalten.
diff --git a/website/templates/index.html b/website/templates/index.html index 446d9a3..c2bacf1 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -121,7 +121,7 @@
@@ -183,7 +183,7 @@
-

Was ist MindMap?

+

Was ist Systades?

Ein modernes Werkzeug zum Visualisieren, Erforschen und Teilen von Wissen in einer intuitiven, interaktiven Umgebung. @@ -294,7 +294,44 @@