Files
website/templates/profile.html

1052 lines
42 KiB
HTML

{% extends "base.html" %}
{% block title %}Profil{% endblock %}
{% block extra_css %}
<style>
/* Gradient Text Styles */
.text-gradient-purple-blue {
background: linear-gradient(135deg, #b38fff, #58a9ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.text-gradient-blue-cyan {
background: linear-gradient(135deg, #58a9ff, #38bdf8);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.text-gradient-cyan-teal {
background: linear-gradient(135deg, #38bdf8, #14b8a6);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.text-gradient-teal-green {
background: linear-gradient(135deg, #14b8a6, #22c55e);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.text-gradient-green-yellow {
background: linear-gradient(135deg, #22c55e, #eab308);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
/* 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.15);
border-radius: 24px;
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35),
0 8px 16px rgba(179, 143, 255, 0.1);
padding: 2rem;
margin-bottom: 2rem;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.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);
padding: 0.5rem;
background: rgba(24, 28, 45, 0.4);
border-radius: 16px 16px 0 0;
gap: 0.5rem;
}
.profile-tab {
padding: 0.75rem 1.25rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.7);
border-bottom: 3px solid transparent;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
white-space: nowrap;
border-radius: 12px;
position: relative;
overflow: hidden;
}
.profile-tab:hover {
color: rgba(255, 255, 255, 0.9);
background: rgba(255, 255, 255, 0.1);
transform: translateY(-2px);
}
.profile-tab.active {
color: white;
background: rgba(179, 143, 255, 0.2);
border-bottom: 3px solid rgba(179, 143, 255, 0.7);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.profile-tab.active::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
background: linear-gradient(90deg, #8B5CF6, #6366F1);
border-radius: 3px 3px 0 0;
}
/* Animation für Tab-Inhalte */
.tab-content {
transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-content.hidden {
display: none;
opacity: 0;
transform: translateY(10px);
}
/* Statistik-Elemente - verkleinert */
.stat-item {
padding: 0.75rem !important;
}
.stat-icon {
width: 8px !important;
height: 8px !important;
margin-bottom: 0.3rem !important;
}
.stat-value {
font-size: 1.2rem !important;
margin-bottom: 0.2rem !important;
}
.stat-label {
font-size: 0.7rem !important;
}
/* Persönliche Mindmap Container */
.personal-mindmap-container {
width: 100%;
height: 400px;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 1rem;
position: relative;
overflow: hidden;
margin-bottom: 2rem;
}
.dark .personal-mindmap-container {
background-color: rgba(255, 255, 255, 0.05);
}
</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">
{% if user.avatar %}
<img src="{{ user.avatar }}" alt="Profilbild" class="avatar">
{% else %}
<div class="avatar default-avatar">
<svg width="100%" height="100%" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="100" cy="100" r="98" fill="url(#gradient)" stroke="#7C3AED" stroke-width="4"/>
<circle cx="100" cy="80" r="36" fill="white"/>
<path d="M100 140C77.9086 140 60 157.909 60 180H140C140 157.909 122.091 140 100 140Z" fill="white"/>
<defs>
<linearGradient id="gradient" x1="0" y1="0" x2="200" y2="200" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#8B5CF6"/>
<stop offset="1" stop-color="#3B82F6"/>
</linearGradient>
</defs>
</svg>
</div>
{% endif %}
<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 mt-4 bg-purple-600 hover:bg-purple-700 text-white font-semibold py-2 px-4 rounded-lg transition-all duration-300 flex items-center">
<i class="fas fa-user-edit mr-2"></i> Profil bearbeiten
</button>
</div>
</div>
<!-- Statistiken -->
<div class="profile-stats grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4 mt-6">
<!-- Gedanken -->
<div class="stat-item bg-opacity-70 backdrop-blur-md rounded-xl p-4 flex flex-col items-center justify-center transition-all duration-300 hover:transform hover:scale-105">
<div class="stat-icon w-12 h-12 rounded-full flex items-center justify-center bg-gradient-to-br from-purple-500/20 to-blue-500/20 mb-3">
<i class="fas fa-lightbulb text-xl text-gradient-purple-blue"></i>
</div>
<div class="stat-value text-2xl font-bold mb-1 bg-gradient-to-r from-purple-400 to-blue-400 bg-clip-text text-transparent">
{{ stats.thought_count if stats and stats.thought_count else 0 }}
</div>
<div class="stat-label text-sm text-gray-400">Gedanken</div>
</div>
<!-- Verbindungen -->
<div class="stat-item bg-opacity-70 backdrop-blur-md rounded-xl p-4 flex flex-col items-center justify-center transition-all duration-300 hover:transform hover:scale-105">
<div class="stat-icon w-12 h-12 rounded-full flex items-center justify-center bg-gradient-to-br from-blue-500/20 to-cyan-500/20 mb-3">
<i class="fas fa-project-diagram text-xl text-gradient-blue-cyan"></i>
</div>
<div class="stat-value text-2xl font-bold mb-1 bg-gradient-to-r from-blue-400 to-cyan-400 bg-clip-text text-transparent">
{{ stats.connections_count if stats and stats.connections_count else 0 }}
</div>
<div class="stat-label text-sm text-gray-400">Verbindungen</div>
</div>
<!-- Follower -->
<div class="stat-item bg-opacity-70 backdrop-blur-md rounded-xl p-4 flex flex-col items-center justify-center transition-all duration-300 hover:transform hover:scale-105">
<div class="stat-icon w-12 h-12 rounded-full flex items-center justify-center bg-gradient-to-br from-cyan-500/20 to-teal-500/20 mb-3">
<i class="fas fa-users text-xl text-gradient-cyan-teal"></i>
</div>
<div class="stat-value text-2xl font-bold mb-1 bg-gradient-to-r from-cyan-400 to-teal-400 bg-clip-text text-transparent">
{{ stats.followers_count if stats and stats.followers_count else 0 }}
</div>
<div class="stat-label text-sm text-gray-400">Follower</div>
</div>
<!-- Beiträge -->
<div class="stat-item bg-opacity-70 backdrop-blur-md rounded-xl p-4 flex flex-col items-center justify-center transition-all duration-300 hover:transform hover:scale-105">
<div class="stat-icon w-12 h-12 rounded-full flex items-center justify-center bg-gradient-to-br from-teal-500/20 to-green-500/20 mb-3">
<i class="fas fa-comment-dots text-xl text-gradient-teal-green"></i>
</div>
<div class="stat-value text-2xl font-bold mb-1 bg-gradient-to-r from-teal-400 to-green-400 bg-clip-text text-transparent">
{{ stats.contributions_count if stats and stats.contributions_count else 0 }}
</div>
<div class="stat-label text-sm text-gray-400">Beiträge</div>
</div>
<!-- Bewertung -->
<div class="stat-item bg-opacity-70 backdrop-blur-md rounded-xl p-4 flex flex-col items-center justify-center transition-all duration-300 hover:transform hover:scale-105">
<div class="stat-icon w-12 h-12 rounded-full flex items-center justify-center bg-gradient-to-br from-green-500/20 to-yellow-500/20 mb-3">
<i class="fas fa-star text-xl text-gradient-green-yellow"></i>
</div>
<div class="stat-value text-2xl font-bold mb-1 bg-gradient-to-r from-green-400 to-yellow-400 bg-clip-text text-transparent">
{{ stats.rating if stats and stats.rating else '0.0' }}
</div>
<div class="stat-label text-sm text-gray-400">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="mindmaps">Mindmaps</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 %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for thought in thoughts %}
<div class="thought-item bg-opacity-70 rounded-xl overflow-hidden border transition-all duration-300 hover:transform hover:scale-105 hover:shadow-lg"
x-bind:class="darkMode ? 'bg-gray-800/80 border-gray-700/60' : 'bg-white/90 border-gray-200/60'">
<div class="p-5 thought-border" data-color="{{ thought.color_code|default('#B39DDB') }}">
<h3 class="text-xl font-bold mb-2"
x-bind:class="darkMode ? 'text-purple-300' : 'text-purple-700'">{{ thought.title }}</h3>
<p class="mb-4 text-sm"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
{{ thought.abstract or thought.content[:150] ~ '...' }}
</p>
<div class="flex justify-between items-center text-xs"
x-bind:class="darkMode ? 'text-gray-400' : 'text-gray-500'">
<span>{{ thought.created_at.strftime('%d.%m.%Y') }}</span>
<span>{{ thought.branch }}</span>
</div>
</div>
<div class="p-3 border-t flex justify-between items-center"
x-bind:class="darkMode ? 'bg-gray-900/80 border-gray-700/60' : 'bg-gray-50/80 border-gray-200/60'">
<a href="{{ url_for('get_thought', thought_id=thought.id) }}" class="transition-colors"
x-bind:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fas fa-eye mr-1"></i> Ansehen
</a>
<a href="{{ url_for('update_thought', thought_id=thought.id) }}" class="transition-colors"
x-bind:class="darkMode ? 'text-blue-400 hover:text-blue-300' : 'text-blue-600 hover:text-blue-500'">
<i class="fas fa-edit mr-1"></i> Bearbeiten
</a>
</div>
</div>
{% endfor %}
</div>
{% 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('add_thought') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">Ersten Gedanken erstellen</a>
</div>
{% endif %}
</div>
</div>
<!-- Mindmaps-Tab -->
<div class="tab-content hidden" id="mindmaps-tab">
<div id="mindmaps-container">
{% if user_mindmaps %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for mindmap in user_mindmaps %}
<div class="mindmap-item bg-opacity-70 rounded-xl overflow-hidden border transition-all duration-300 hover:transform hover:scale-105 hover:shadow-lg"
x-bind:class="darkMode ? 'bg-gray-800/80 border-gray-700/60' : 'bg-white/90 border-gray-200/60'">
<div class="p-5">
<h3 class="text-xl font-bold mb-2"
x-bind:class="darkMode ? 'text-purple-400' : 'text-purple-700'">{{ mindmap.name }}</h3>
<p class="mb-4 text-sm"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">{{ mindmap.description }}</p>
<div class="flex justify-between items-center text-xs"
x-bind:class="darkMode ? 'text-gray-400' : 'text-gray-500'">
<span>Erstellt: {{ mindmap.created_at.strftime('%d.%m.%Y') }}</span>
<span>Zuletzt bearbeitet: {{ mindmap.last_modified.strftime('%d.%m.%Y') }}</span>
</div>
</div>
<div class="p-3 border-t flex justify-between"
x-bind:class="darkMode ? 'bg-gray-900/80 border-gray-700/60' : 'bg-gray-50/80 border-gray-200/60'">
<a href="{{ url_for('mindmap') }}?id={{ mindmap.id }}" class="transition-colors"
x-bind:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fas fa-eye mr-1"></i> Anzeigen
</a>
<a href="{{ url_for('edit_mindmap', mindmap_id=mindmap.id) }}" class="transition-colors"
x-bind:class="darkMode ? 'text-blue-400 hover:text-blue-300' : 'text-blue-600 hover:text-blue-500'">
<i class="fas fa-edit mr-1"></i> Bearbeiten
</a>
</div>
</div>
{% endfor %}
</div>
{% 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 Mindmaps erstellt</p>
<a href="{{ url_for('create_mindmap') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
Erste Mindmap erstellen
</a>
</div>
{% endif %}
</div>
</div>
<div class="tab-content hidden" id="collections-tab">
<div id="collections-container">
{% if collections %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for collection in collections %}
<div class="collection-item bg-opacity-70 rounded-xl overflow-hidden border border-gray-700/60 bg-gray-800/80 transition-all duration-300 hover:transform hover:scale-105 hover:shadow-lg">
<div class="p-5">
<h3 class="text-xl font-bold mb-2 text-purple-400">{{ collection.title }}</h3>
<p class="mb-4 text-sm text-gray-300">{{ collection.description }}</p>
<div class="flex justify-between items-center text-xs text-gray-400">
<span>{{ collection.thoughts_count }} Gedanken</span>
<span>{{ collection.date }}</span>
</div>
</div>
<div class="p-3 border-t border-gray-700/60 bg-gray-900/80 flex justify-center">
<a href="#" class="text-purple-400 hover:text-purple-300 transition-colors">
<i class="fas fa-eye mr-1"></i> Anzeigen
</a>
</div>
</div>
{% endfor %}
</div>
{% 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('profile') }}" class="mt-4 inline-block px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">Zurück zum Profil</a>
</div>
{% endif %}
</div>
</div>
<div class="tab-content hidden" id="connections-tab">
<div id="connections-container">
{% if connections %}
<div class="grid grid-cols-1 gap-6">
{% for connection in connections %}
<div class="connection-item bg-opacity-70 rounded-xl p-4 border border-gray-700/60 bg-gray-800/80 transition-all duration-300 hover:bg-gray-800/95">
<div class="connection-nodes flex items-stretch">
<div class="connection-node flex-1 p-4 rounded-lg bg-gray-900/80 text-white">
<h4 class="font-semibold mb-1">{{ connection.source.title }}</h4>
<p class="text-sm text-gray-400">{{ connection.source.excerpt }}</p>
</div>
<div class="connection-type flex flex-col items-center justify-center px-4">
<i class="fas fa-arrow-right text-purple-400 mb-1"></i>
<span class="text-xs text-gray-500">{{ connection.relation_type }}</span>
</div>
<div class="connection-node flex-1 p-4 rounded-lg bg-gray-900/80 text-white">
<h4 class="font-semibold mb-1">{{ connection.target.title }}</h4>
<p class="text-sm text-gray-400">{{ connection.target.excerpt }}</p>
</div>
</div>
<div class="connection-meta mt-2 text-right">
<span class="text-xs text-gray-500">{{ connection.date }}</span>
</div>
</div>
{% endfor %}
</div>
{% 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 hover:bg-purple-700 transition-colors">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 bg-white/10 backdrop-blur-md rounded-xl p-6 mb-6 border border-white/10">
<div class="settings-card-header text-xl font-bold mb-4 text-purple-300">Profilinformationen</div>
<div class="settings-card-body">
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="bio">Über mich</label>
<textarea id="bio" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" rows="4">{{ user.bio }}</textarea>
</div>
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="location">Standort</label>
<input type="text" id="location" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" value="{{ user.location }}" />
</div>
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="website">Website</label>
<input type="url" id="website" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" value="{{ user.website }}" />
</div>
<button id="save-profile-btn" class="profile-action-btn primary mt-4">
<i class="fas fa-save mr-1"></i> Speichern
</button>
</div>
</div>
<div class="settings-card bg-white/10 backdrop-blur-md rounded-xl p-6 mb-6 border border-white/10">
<div class="settings-card-header text-xl font-bold mb-4 text-purple-300">Datenschutz und Sicherheit</div>
<div class="settings-card-body">
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="email">E-Mail-Adresse</label>
<input type="email" id="email" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" value="{{ user.email }}" readonly />
<p class="text-xs text-gray-500 mt-1">Die E-Mail-Adresse kann derzeit nicht geändert werden.</p>
</div>
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="password">Neues Passwort</label>
<input type="password" id="password" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" placeholder="Neues Passwort eingeben" />
</div>
<div class="settings-group mb-4">
<label class="settings-label block text-gray-300 mb-2" for="password_confirm">Passwort bestätigen</label>
<input type="password" id="password_confirm" class="settings-input w-full bg-gray-800/60 border border-gray-700/60 text-white rounded-lg p-3 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all" placeholder="Passwort wiederholen" />
</div>
<button id="update-password-btn" 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');
// Standardmäßig den ersten Tab aktivieren
if (tabs.length > 0 && tabContents.length > 0) {
tabs[0].classList.add('active');
tabContents[0].classList.remove('hidden');
}
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');
const tabContent = document.getElementById(`${tabId}-tab`);
if (tabContent) {
tabContent.classList.remove('hidden');
// Animation für Tab-Inhalt
tabContent.style.opacity = '0';
tabContent.style.transform = 'translateY(10px)';
setTimeout(() => {
tabContent.style.transition = 'all 0.3s ease';
tabContent.style.opacity = '1';
tabContent.style.transform = 'translateY(0)';
}, 50);
}
});
});
// 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;
// Hier könnte ein AJAX-Request erfolgen, um die Reaktion zu speichern
});
});
// Profilbearbeitung
const editProfileBtn = document.querySelector('.edit-profile-btn');
if (editProfileBtn) {
editProfileBtn.addEventListener('click', function() {
// Zum Einstellungstab wechseln
const settingsTab = document.querySelector('[data-tab="settings"]');
if (settingsTab) {
settingsTab.click();
}
});
}
// Avatar-Bearbeitung
const avatarEditBtn = document.querySelector('.avatar-edit');
if (avatarEditBtn) {
avatarEditBtn.addEventListener('click', function() {
// Dateiauswahl öffnen
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = 'image/*';
fileInput.style.display = 'none';
document.body.appendChild(fileInput);
fileInput.click();
fileInput.addEventListener('change', function() {
if (this.files && this.files[0]) {
// Anzeigen des gewählten Bildes
const avatarImg = document.querySelector('.avatar') || document.querySelector('.default-avatar');
// FileReader zum Einlesen des Bildes
const reader = new FileReader();
reader.onload = function(e) {
// Vorschau anzeigen
if (avatarImg.tagName.toLowerCase() === 'img') {
avatarImg.src = e.target.result;
} else {
// Falls es ein div mit SVG ist, ersetzen wir es durch ein Image
const imgElement = document.createElement('img');
imgElement.src = e.target.result;
imgElement.classList.add('avatar');
imgElement.alt = "Profilbild";
const avatarContainer = document.querySelector('.avatar-container');
if (avatarContainer) {
avatarContainer.innerHTML = '';
avatarContainer.appendChild(imgElement);
}
}
// Avatar-URL im Einstellungsbereich speichern
const avatarUrlInput = document.createElement('input');
avatarUrlInput.type = 'hidden';
avatarUrlInput.name = 'avatar_url';
avatarUrlInput.id = 'avatar_url';
avatarUrlInput.value = e.target.result;
// Entferne vorhandenes Input, falls vorhanden
const existingInput = document.getElementById('avatar_url');
if (existingInput) {
existingInput.remove();
}
// Zum Formular hinzufügen
const settingsForm = document.querySelector('.settings-card');
if (settingsForm) {
settingsForm.appendChild(avatarUrlInput);
}
// Erfolgsmeldung anzeigen
showNotification('Avatar wurde aktualisiert! Bitte speichere deine Änderungen.', 'success');
};
reader.readAsDataURL(this.files[0]);
}
// Input entfernen
document.body.removeChild(fileInput);
});
});
}
// Profil Speichern-Button
const saveProfileBtn = document.getElementById('save-profile-btn');
if (saveProfileBtn) {
saveProfileBtn.addEventListener('click', function() {
// Sammle Daten aus den Eingabefeldern
const formData = new FormData();
formData.append('action', 'update_profile');
formData.append('bio', document.getElementById('bio').value || '');
formData.append('location', document.getElementById('location').value || '');
formData.append('website', document.getElementById('website').value || '');
// Avatar hinzufügen, falls vorhanden
const avatarUrlInput = document.getElementById('avatar_url');
if (avatarUrlInput) {
formData.append('avatar_url', avatarUrlInput.value);
}
// Visuelle Rückmeldung
const originalText = this.innerHTML;
this.innerHTML = '<i class="fas fa-circle-notch fa-spin mr-1"></i> Speichern...';
this.disabled = true;
// AJAX-Anfrage senden
fetch('{{ url_for("settings") }}', {
method: 'POST',
body: formData
})
.then(response => {
if (!response.ok) {
throw new Error('Fehler beim Speichern');
}
return response.json();
})
.catch(error => {
console.error('Fehler beim Speichern der Profileinstellungen:', error);
return { success: false, message: 'Netzwerkfehler. Bitte versuche es erneut.' };
})
.then(data => {
this.innerHTML = originalText;
this.disabled = false;
if (data && data.success) {
// Erfolgsanimation
showNotification('Profil erfolgreich aktualisiert!', 'success');
// UI aktualisieren ohne Neuladen
const bioElement = document.querySelector('.user-bio');
const locationElement = document.querySelector('.user-meta span:first-child');
if (bioElement) {
bioElement.textContent = document.getElementById('bio').value || 'Keine Bio vorhanden. Klicke auf bearbeiten, um eine hinzuzufügen.';
}
if (locationElement) {
const location = document.getElementById('location').value;
locationElement.innerHTML = `<i class="fas fa-map-marker-alt"></i> ${location || 'Kein Standort angegeben'}`;
}
} else {
showNotification(data?.message || 'Fehler beim Aktualisieren des Profils', 'error');
}
});
});
}
// Passwort Update Button
const updatePasswordBtn = document.getElementById('update-password-btn');
if (updatePasswordBtn) {
updatePasswordBtn.addEventListener('click', function() {
const currentPassword = document.getElementById('password').value;
const newPassword = document.getElementById('password_confirm').value;
if (!currentPassword || !newPassword) {
showNotification('Bitte fülle alle Passwortfelder aus', 'error');
return;
}
if (currentPassword !== newPassword) {
showNotification('Die Passwörter stimmen nicht überein', 'error');
return;
}
// AJAX-Anfrage senden
const formData = new FormData();
formData.append('action', 'update_password');
formData.append('new_password', newPassword);
formData.append('confirm_password', newPassword);
// Visuelle Rückmeldung
const originalText = this.innerHTML;
this.innerHTML = '<i class="fas fa-circle-notch fa-spin mr-1"></i> Aktualisieren...';
this.disabled = true;
fetch('{{ url_for("settings") }}', {
method: 'POST',
body: formData
})
.then(response => response.json())
.catch(error => {
console.error('Fehler beim Aktualisieren des Passworts:', error);
return { success: false, message: 'Netzwerkfehler. Bitte versuche es erneut.' };
})
.then(data => {
this.innerHTML = originalText;
this.disabled = false;
if (data && data.success) {
showNotification('Passwort erfolgreich aktualisiert!', 'success');
document.getElementById('password').value = '';
document.getElementById('password_confirm').value = '';
} else {
showNotification(data?.message || 'Fehler beim Aktualisieren des Passworts', 'error');
}
});
});
}
// Gedanken-Karten mit Hover-Effekten und Border-Farben
const thoughtItems = document.querySelectorAll('.thought-item');
thoughtItems.forEach(item => {
// Hover-Effekte
item.addEventListener('mouseenter', () => {
item.style.transform = 'translateY(-5px)';
item.style.boxShadow = '0 12px 30px rgba(0, 0, 0, 0.15)';
});
item.addEventListener('mouseleave', () => {
item.style.transform = 'translateY(0)';
item.style.boxShadow = 'none';
});
// Border-Farben anwenden
const borderElem = item.querySelector('.thought-border');
if (borderElem && borderElem.dataset.color) {
borderElem.style.borderLeft = `4px solid ${borderElem.dataset.color}`;
}
});
// Mindmap-Karten mit Hover-Effekten
const mindmapItems = document.querySelectorAll('.mindmap-item');
mindmapItems.forEach(item => {
item.addEventListener('mouseenter', () => {
item.style.transform = 'translateY(-5px)';
item.style.boxShadow = '0 12px 30px rgba(0, 0, 0, 0.15)';
});
item.addEventListener('mouseleave', () => {
item.style.transform = 'translateY(0)';
item.style.boxShadow = 'none';
});
});
// Benachrichtigungsfunktion
function showNotification(message, type = 'info') {
// Bestehende Benachrichtigung entfernen
const existingNotification = document.getElementById('notification');
if (existingNotification) {
existingNotification.remove();
}
// Neue Benachrichtigung erstellen
const notification = document.createElement('div');
notification.id = 'notification';
notification.className = `fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 flex items-center transform transition-all duration-300 translate-y-0 opacity-0`;
// Typ-basierte Stile
if (type === 'success') {
notification.classList.add('bg-green-500', 'text-white');
notification.innerHTML = `<i class="fas fa-check-circle mr-2"></i> ${message}`;
} else if (type === 'error') {
notification.classList.add('bg-red-500', 'text-white');
notification.innerHTML = `<i class="fas fa-exclamation-circle mr-2"></i> ${message}`;
} else {
notification.classList.add('bg-blue-500', 'text-white');
notification.innerHTML = `<i class="fas fa-info-circle mr-2"></i> ${message}`;
}
// Close-Button
const closeBtn = document.createElement('button');
closeBtn.className = 'ml-4 text-white opacity-75 hover:opacity-100';
closeBtn.innerHTML = '<i class="fas fa-times"></i>';
closeBtn.addEventListener('click', () => {
notification.classList.add('opacity-0', 'translate-y-[-10px]');
setTimeout(() => notification.remove(), 300);
});
notification.appendChild(closeBtn);
document.body.appendChild(notification);
// Animation starten
setTimeout(() => {
notification.classList.remove('opacity-0');
notification.classList.add('opacity-100');
}, 10);
// Automatisch ausblenden nach 5 Sekunden
setTimeout(() => {
if (document.body.contains(notification)) {
notification.classList.add('opacity-0', 'translate-y-[-10px]');
setTimeout(() => {
if (document.body.contains(notification)) {
notification.remove();
}
}, 300);
}
}, 5000);
}
});
</script>
{% endblock %}