365 lines
9.9 KiB
HTML
365 lines
9.9 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Mindmap erstellen{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
/* Spezifische Stile für die Mindmap-Erstellungsseite */
|
|
.form-container {
|
|
background-color: var(--bg-secondary);
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
body.dark .form-container {
|
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
|
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
}
|
|
|
|
body:not(.dark) .form-container {
|
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.form-header {
|
|
padding: 1.5rem;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
}
|
|
|
|
body:not(.dark) .form-header {
|
|
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.form-body {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-input,
|
|
.form-textarea {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border-radius: 0.5rem;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
body.dark .form-input,
|
|
body.dark .form-textarea {
|
|
background-color: rgba(15, 23, 42, 0.6);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
color: #f1f5f9;
|
|
}
|
|
|
|
body:not(.dark) .form-input,
|
|
body:not(.dark) .form-textarea {
|
|
background-color: white;
|
|
border: 1px solid #e2e8f0;
|
|
color: #334155;
|
|
}
|
|
|
|
body.dark .form-input:focus,
|
|
body.dark .form-textarea:focus {
|
|
border-color: #7c3aed;
|
|
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
|
|
outline: none;
|
|
}
|
|
|
|
body:not(.dark) .form-input:focus,
|
|
body:not(.dark) .form-textarea:focus {
|
|
border-color: #7c3aed;
|
|
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
|
|
outline: none;
|
|
}
|
|
|
|
.form-textarea {
|
|
min-height: 120px;
|
|
resize: vertical;
|
|
}
|
|
|
|
.form-switch {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.form-switch input[type="checkbox"] {
|
|
height: 0;
|
|
width: 0;
|
|
visibility: hidden;
|
|
position: absolute;
|
|
}
|
|
|
|
.form-switch label {
|
|
cursor: pointer;
|
|
width: 50px;
|
|
height: 25px;
|
|
background: rgba(100, 116, 139, 0.3);
|
|
display: block;
|
|
border-radius: 25px;
|
|
position: relative;
|
|
margin-right: 10px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.form-switch label:after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 3px;
|
|
left: 3px;
|
|
width: 19px;
|
|
height: 19px;
|
|
background: #fff;
|
|
border-radius: 19px;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
.form-switch input:checked + label {
|
|
background: #7c3aed;
|
|
}
|
|
|
|
.form-switch input:checked + label:after {
|
|
left: calc(100% - 3px);
|
|
transform: translateX(-100%);
|
|
}
|
|
|
|
.btn-submit {
|
|
background-color: #7c3aed;
|
|
color: white;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 0.5rem;
|
|
font-weight: 500;
|
|
transition: all 0.3s ease;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.btn-submit:hover {
|
|
background-color: #6d28d9;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
|
|
}
|
|
|
|
.btn-cancel {
|
|
background-color: transparent;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 0.5rem;
|
|
font-weight: 500;
|
|
transition: all 0.3s ease;
|
|
border: 1px solid;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
body.dark .btn-cancel {
|
|
color: #e2e8f0;
|
|
border-color: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
body:not(.dark) .btn-cancel {
|
|
color: #475569;
|
|
border-color: #e2e8f0;
|
|
}
|
|
|
|
.btn-cancel:hover {
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
body.dark .btn-cancel:hover {
|
|
background-color: rgba(255, 255, 255, 0.05);
|
|
}
|
|
|
|
body:not(.dark) .btn-cancel:hover {
|
|
background-color: rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
/* Animation für den Seiteneintritt */
|
|
@keyframes slideInUp {
|
|
from {
|
|
transform: translateY(20px);
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
transform: translateY(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.form-container {
|
|
animation: slideInUp 0.5s ease forwards;
|
|
}
|
|
|
|
/* Animation für Hover-Effekte */
|
|
.input-animation {
|
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
}
|
|
|
|
.input-animation:focus {
|
|
transform: scale(1.01);
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container mx-auto px-4 py-8 animate-fadeIn">
|
|
<div class="max-w-3xl mx-auto">
|
|
<!-- Titel mit Animation -->
|
|
<div class="text-center mb-8 animate-pulse">
|
|
<h1 class="text-3xl font-bold mb-2 mystical-glow gradient-text">
|
|
Neue Mindmap erstellen
|
|
</h1>
|
|
<p class="opacity-80">Erstelle deine eigene Wissenslandkarte und organisiere deine Gedanken</p>
|
|
</div>
|
|
|
|
<div class="form-container">
|
|
<div class="form-header">
|
|
<h2 class="text-xl font-semibold">Mindmap-Details</h2>
|
|
</div>
|
|
|
|
<div class="form-body">
|
|
<form action="{{ url_for('create_mindmap') }}" method="POST">
|
|
<div class="form-group">
|
|
<label for="name" class="form-label">Name der Mindmap</label>
|
|
<input type="text" id="name" name="name" class="form-input input-animation" required placeholder="z.B. Meine Philosophie-Mindmap">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="description" class="form-label">Beschreibung</label>
|
|
<textarea id="description" name="description" class="form-textarea input-animation" placeholder="Worum geht es in dieser Mindmap?"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="form-switch">
|
|
<input type="checkbox" id="is_private" name="is_private" checked>
|
|
<label for="is_private"></label>
|
|
<span>Private Mindmap (nur für dich sichtbar)</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-between mt-6">
|
|
<a href="{{ url_for('profile') }}" class="btn-cancel">
|
|
<i class="fas fa-arrow-left"></i>
|
|
Zurück
|
|
</a>
|
|
<button type="submit" class="btn-submit">
|
|
<i class="fas fa-save"></i>
|
|
Mindmap erstellen
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Mindmap-Vorschau -->
|
|
<div class="mt-8">
|
|
<h3 class="text-xl font-semibold mb-4">Vorschau</h3>
|
|
<div class="mindmap-container">
|
|
<div id="cy" class="w-full h-[400px] rounded-xl border"
|
|
x-bind:class="darkMode ? 'border-gray-700' : 'border-gray-200'">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tipps-Sektion -->
|
|
<div class="mt-8 p-5 rounded-lg border animate-fadeIn"
|
|
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-lightbulb text-yellow-400 mr-2"></i>Tipps zum Erstellen einer Mindmap
|
|
</h3>
|
|
<div x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
|
|
<ul class="list-disc pl-5 space-y-2">
|
|
<li>Wähle einen prägnanten, aber aussagekräftigen Namen für deine Mindmap</li>
|
|
<li>Beginne mit einem zentralen Konzept und arbeite dich nach außen vor</li>
|
|
<li>Verwende verschiedene Farben für unterschiedliche Kategorien oder Themenbereiche</li>
|
|
<li>Füge Notizen zu Knoten hinzu, um komplexere Ideen zu erklären</li>
|
|
<li>Verknüpfe verwandte Konzepte, um Beziehungen zu visualisieren</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.26.0/cytoscape.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-cose-bilkent/4.1.0/cytoscape-cose-bilkent.min.js"></script>
|
|
<script nonce="{{ csp_nonce }}">
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Einfache Animationen für die Eingabefelder
|
|
const inputs = document.querySelectorAll('.input-animation');
|
|
|
|
inputs.forEach(input => {
|
|
// Subtile Skalierung bei Fokus
|
|
input.addEventListener('focus', function() {
|
|
this.style.transform = 'scale(1.01)';
|
|
this.style.boxShadow = '0 4px 12px rgba(124, 58, 237, 0.15)';
|
|
});
|
|
|
|
input.addEventListener('blur', function() {
|
|
this.style.transform = 'scale(1)';
|
|
this.style.boxShadow = 'none';
|
|
});
|
|
});
|
|
|
|
// Formular-Absenden-Animation
|
|
const form = document.querySelector('form');
|
|
form.addEventListener('submit', function(e) {
|
|
const submitBtn = this.querySelector('.btn-submit');
|
|
submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Wird erstellt...';
|
|
submitBtn.disabled = true;
|
|
});
|
|
|
|
// Mindmap-Vorschau initialisieren
|
|
const mindmap = new MindMap.Visualization('cy', {
|
|
enableEditing: true,
|
|
onNodeClick: function(nodeData) {
|
|
console.log("Knoten ausgewählt:", nodeData);
|
|
}
|
|
});
|
|
|
|
// Formularfelder mit Mindmap verbinden
|
|
const nameInput = document.getElementById('name');
|
|
const descriptionInput = document.getElementById('description');
|
|
|
|
// Aktualisiere Mindmap wenn sich die Eingaben ändern
|
|
nameInput.addEventListener('input', function() {
|
|
if (mindmap.cy) {
|
|
const rootNode = mindmap.cy.$('#root');
|
|
if (rootNode.length > 0) {
|
|
rootNode.data('name', this.value || 'Neue Mindmap');
|
|
}
|
|
}
|
|
});
|
|
|
|
// Initialisiere die Mindmap
|
|
mindmap.initialize().then(() => {
|
|
console.log("Mindmap-Vorschau initialisiert");
|
|
|
|
// Setze initiale Werte
|
|
if (nameInput.value) {
|
|
const rootNode = mindmap.cy.$('#root');
|
|
if (rootNode.length > 0) {
|
|
rootNode.data('name', nameInput.value);
|
|
}
|
|
}
|
|
}).catch(error => {
|
|
console.error("Fehler bei der Initialisierung der Mindmap:", error);
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |