Files
website/templates/mindmap.html

402 lines
13 KiB
HTML

{% extends "base.html" %}
{% block title %}Mindmap{% endblock %}
{% block extra_css %}
<style>
/* Spezifische Stile für die Mindmap-Seite */
#cy {
width: 100%;
height: 750px;
background-color: var(--bg-secondary);
transition: background-color 0.3s ease;
border-radius: 10px;
overflow: hidden;
position: relative;
}
/* Hintergrundraster für wissenschaftliches Aussehen */
#cy::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 20px 20px;
pointer-events: none;
z-index: 1;
}
.dark #cy::before {
background-image:
linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}
/* Verbesserte Mindmap-Container-Stile */
.mindmap-container {
position: relative;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
background-color: var(--bg-secondary);
}
.dark .mindmap-container {
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
background-color: var(--bg-secondary);
}
/* Flüssigere Übergänge für Mindmap-Elemente */
.mindmap-svg {
transition: background-color 0.5s ease;
}
.node {
cursor: pointer;
transition: opacity 0.3s ease, transform 0.3s ease;
}
.node:hover {
transform: scale(1.05);
}
.node circle {
transition: r 0.3s ease, fill 0.3s ease, stroke 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}
.node text {
transition: font-size 0.3s ease, fill 0.3s ease;
user-select: none;
}
.link {
transition: stroke 0.3s ease, stroke-width 0.3s ease, opacity 0.3s ease;
pointer-events: none;
}
/* Panel-Übergänge für Seitenleiste */
[data-sidebar] {
transition: opacity 0.3s ease, transform 0.3s ease, display 0s linear 0.3s;
}
[data-sidebar].active {
transition: opacity 0.3s ease, transform 0.3s ease, display 0s linear;
}
/* Mindmap-Toolbar mit verbessertem Erscheinungsbild */
.mindmap-toolbar {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
padding: 0.75rem;
background-color: var(--bg-secondary);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
transition: background-color 0.3s ease;
position: relative;
z-index: 10;
}
body:not(.dark) .mindmap-toolbar {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
/* Verbesserte Button-Stile für Mindmap-Toolbar */
.mindmap-action-btn {
display: flex;
align-items: center;
gap: 0.35rem;
padding: 0.35rem 0.7rem;
font-size: 0.8rem;
border-radius: 0.25rem;
background-color: rgba(79, 70, 229, 0.1);
color: #4f46e5;
border: 1px solid rgba(79, 70, 229, 0.2);
cursor: pointer;
transition: all 0.2s ease;
}
.dark .mindmap-action-btn {
background-color: rgba(79, 70, 229, 0.15);
border-color: rgba(79, 70, 229, 0.3);
}
.mindmap-action-btn:hover {
background-color: rgba(79, 70, 229, 0.2);
transform: translateY(-1px);
}
.mindmap-action-btn:active {
transform: translateY(0);
}
/* Verbesserte Seitenleisten-Panels mit Animation */
.sidebar-panel {
transition: all 0.3s ease-in-out;
}
.sidebar-panel.hidden {
opacity: 0;
transform: translateY(10px);
}
.sidebar-panel.visible {
opacity: 1;
transform: translateY(0);
}
/* Info-Panel anpassungen */
.mindmap-info-panel {
position: absolute;
right: 1rem;
top: 5rem;
width: 280px;
background-color: rgba(15, 23, 42, 0.85);
border-radius: 8px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
padding: 1rem;
color: #f1f5f9;
opacity: 0;
transform: translateX(20px);
transition: all 0.3s ease;
pointer-events: none;
z-index: 10;
backdrop-filter: blur(4px);
}
.mindmap-info-panel.visible {
opacity: 1;
transform: translateX(0);
pointer-events: auto;
}
.info-panel-title {
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 0.75rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.info-panel-description {
font-size: 0.875rem;
margin-bottom: 1rem;
line-height: 1.5;
}
.node-navigation-title {
font-size: 0.9rem;
font-weight: 500;
margin-bottom: 0.5rem;
}
.node-links {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.node-link {
display: inline-block;
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
border-radius: 4px;
cursor: pointer;
transition: transform 0.2s ease;
color: white;
}
.node-link:hover {
transform: translateY(-2px);
}
/* Zusätzliches Layout */
.mindmap-section {
display: grid;
grid-template-columns: 1fr;
gap: 1.5rem;
}
@media (min-width: 1024px) {
.mindmap-section {
grid-template-columns: 2fr 1fr;
}
}
</style>
{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-8">
<div class="flex flex-col lg:flex-row gap-8">
<!-- Hauptinhalt -->
<div class="w-full lg:w-3/4">
<!-- Mindmap-Titelbereich -->
<div class="mb-6">
<h1 class="text-3xl font-bold mb-2 mystical-glow"
x-bind:class="darkMode ? 'text-white' : 'text-gray-800'">
Wissenslandkarte
</h1>
<p class="opacity-80 text-lg"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
Visualisiere die Verbindungen zwischen Gedanken und Konzepten
</p>
</div>
<!-- Mindmap-Container -->
<div class="mindmap-container">
<!-- Toolbar -->
<div class="mindmap-toolbar">
<button id="fit-btn" class="mindmap-action-btn" title="An Fenstergröße anpassen">
<i class="fa-solid fa-expand"></i>
<span>Anpassen</span>
</button>
<button id="reset-btn" class="mindmap-action-btn" title="Ansicht zurücksetzen">
<i class="fa-solid fa-undo"></i>
<span>Zurücksetzen</span>
</button>
<button id="zoom-in-btn" class="mindmap-action-btn" title="Einzoomen">
<i class="fa-solid fa-magnifying-glass-plus"></i>
<span>Zoom+</span>
</button>
<button id="zoom-out-btn" class="mindmap-action-btn" title="Auszoomen">
<i class="fa-solid fa-magnifying-glass-minus"></i>
<span>Zoom-</span>
</button>
<button id="toggle-labels-btn" class="mindmap-action-btn" title="Labels ein/ausblenden">
<i class="fa-solid fa-tags"></i>
<span>Labels</span>
</button>
<button id="fullscreen-btn" class="mindmap-action-btn" title="Vollbildmodus">
<i class="fa-solid fa-expand"></i>
<span>Vollbild</span>
</button>
</div>
<!-- Hauptvisualisierung -->
<div id="cy"></div>
<!-- Info-Panel -->
<div id="node-info-panel" class="mindmap-info-panel">
<h4 class="info-panel-title">Knoteninfo</h4>
<p id="node-description" class="info-panel-description">Wählen Sie einen Knoten aus...</p>
<div class="node-navigation">
<h5 class="node-navigation-title">Verknüpfte Knoten</h5>
<div id="connected-nodes" class="node-links">
<!-- Wird dynamisch befüllt -->
</div>
</div>
</div>
</div>
</div>
<!-- Seitenleiste -->
<div class="w-full lg:w-1/4 space-y-6">
<!-- Nutzlänge -->
<div class="p-5 rounded-lg overflow-hidden border transition-colors duration-300"
x-bind:class="darkMode ? 'bg-slate-800/40 border-slate-700/50' : 'bg-white border-slate-200'"
data-sidebar="about-mindmap">
<h3 class="text-xl font-semibold mb-3"
x-bind:class="darkMode ? 'text-white' : 'text-gray-800'">
<i class="fa-solid fa-circle-info text-purple-400 mr-2"></i>Über die Mindmap
</h3>
<div x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
<p class="mb-2">Die interaktive Wissenslandkarte zeigt Verbindungen zwischen verschiedenen Gedanken und Konzepten.</p>
<p class="mb-2">Sie können:</p>
<ul class="list-disc pl-5 space-y-1 text-sm">
<li>Knoten auswählen, um Details zu sehen</li>
<li>Zoomen (Mausrad oder Pinch-Geste)</li>
<li>Die Karte verschieben (Drag & Drop)</li>
<li>Die Toolbar nutzen für weitere Aktionen</li>
</ul>
</div>
</div>
<!-- Kategorienlegende -->
<div class="p-5 rounded-lg overflow-hidden border transition-colors duration-300"
x-bind:class="darkMode ? 'bg-slate-800/40 border-slate-700/50' : 'bg-white border-slate-200'"
data-sidebar="categories">
<h3 class="text-xl font-semibold mb-3"
x-bind:class="darkMode ? 'text-white' : 'text-gray-800'">
<i class="fa-solid fa-palette text-purple-400 mr-2"></i>Kategorien
</h3>
<div id="category-legend" class="space-y-2 text-sm"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
<!-- Wird dynamisch befüllt -->
<div class="flex items-center"><span class="w-3 h-3 rounded-full bg-indigo-600 mr-2"></span> Philosophie</div>
<div class="flex items-center"><span class="w-3 h-3 rounded-full bg-emerald-600 mr-2"></span> Wissenschaft</div>
<div class="flex items-center"><span class="w-3 h-3 rounded-full bg-indigo-500 mr-2"></span> Technologie</div>
<div class="flex items-center"><span class="w-3 h-3 rounded-full bg-violet-500 mr-2"></span> Künste</div>
<div class="flex items-center"><span class="w-3 h-3 rounded-full bg-cyan-700 mr-2"></span> Psychologie</div>
</div>
</div>
<!-- Knotenbeschreibung (anfangs ausgeblendet) -->
<div class="p-5 rounded-lg overflow-hidden border transition-colors duration-300 hidden"
x-bind:class="darkMode ? 'bg-slate-800/40 border-slate-700/50' : 'bg-white border-slate-200'"
data-sidebar="node-description">
<h3 class="text-xl font-semibold mb-3"
x-bind:class="darkMode ? 'text-white' : 'text-gray-800'"
data-node-title>Knotenbeschreibung</h3>
<div class="space-y-3" x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
<p class="text-sm leading-relaxed" data-node-description>
Wählen Sie einen Knoten in der Mindmap aus, um dessen Beschreibung hier anzuzeigen.
</p>
<div class="pt-2 mt-2 border-t" x-bind:class="darkMode ? 'border-slate-700/50' : 'border-slate-200'">
<button class="text-xs px-3 py-1.5 rounded bg-indigo-100 text-indigo-700 hover:bg-indigo-200 transition-colors dark:bg-indigo-900/30 dark:text-indigo-300 dark:hover:bg-indigo-800/40"
onclick="window.mindmapInstance && window.mindmapInstance.selectedNode && window.mindmapInstance.centerNodeInView(window.mindmapInstance.selectedNode)">
<i class="fa-solid fa-crosshairs mr-1"></i> Knoten zentrieren
</button>
</div>
</div>
</div>
<!-- Meine Mindmaps -->
{% if current_user.is_authenticated %}
<div class="p-5 rounded-lg overflow-hidden border transition-colors duration-300"
x-bind:class="darkMode ? 'bg-slate-800/40 border-slate-700/50' : 'bg-white border-slate-200'">
<h3 class="text-xl font-semibold mb-3"
x-bind:class="darkMode ? 'text-white' : 'text-gray-800'">
<i class="fa-solid fa-map text-purple-400 mr-2"></i>Meine Mindmaps
</h3>
<div class="mb-3">
<a href="{{ url_for('create_mindmap') }}" class="w-full inline-block py-2 px-4 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-center text-sm font-medium transition-colors">
<i class="fa-solid fa-plus mr-1"></i> Neue Mindmap erstellen
</a>
</div>
<div class="space-y-2 max-h-60 overflow-y-auto"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
{% if user_mindmaps %}
{% for mindmap in user_mindmaps %}
<a href="{{ url_for('user_mindmap', mindmap_id=mindmap.id) }}" class="block p-2 hover:bg-purple-500/20 rounded-lg transition-colors">
<div class="text-sm font-medium">{{ mindmap.name }}</div>
<div class="text-xs opacity-70">{{ mindmap.nodes|length }} Knoten</div>
</a>
{% endfor %}
{% else %}
<p class="text-sm italic">Sie haben noch keine eigenen Mindmaps erstellt.</p>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<!-- Cytoscape -->
<script src="{{ url_for('static', filename='js/cytoscape.min.js') }}"></script>
<!-- Mindmap initialisierung -->
<script src="{{ url_for('static', filename='js/mindmap-init.js') }}"></script>
<!-- Update Mindmap mit wissenschaftlichen Knoten -->
<script src="{{ url_for('static', filename='js/update_mindmap.js') }}"></script>
<!-- Verbesserte Interaktion -->
<script src="{{ url_for('static', filename='js/mindmap-interaction.js') }}"></script>
{% endblock %}