Bugfixes im Dating und im Profil
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled

This commit is contained in:
2026-04-04 15:45:55 +02:00
parent d386f5a7a9
commit b81ad25c9f
427 changed files with 4796 additions and 324 deletions

View File

@@ -74,22 +74,60 @@
.profil-actions {
display: flex;
gap: 0.5rem;
justify-content: center;
flex-wrap: wrap;
align-items: center;
width: 100%;
padding: 0.85rem 0;
border-top: 1px solid var(--color-secondary);
border-bottom: 1px solid var(--color-secondary);
margin: 0.5rem 0 0.25rem;
}
.profil-actions:empty { display: none; }
.profil-actions-spacer { flex: 1; }
/* Aktionen-Dropdown */
.aktionen-wrap { position: relative; }
.aktionen-btn {
background: none; border: 1px solid var(--color-secondary);
color: var(--color-muted); border-radius: 6px;
padding: 0.55rem 1.2rem; cursor: pointer;
display: flex; align-items: center; gap: 0.35rem; margin: 0; width: auto;
}
.aktionen-btn:hover { color: var(--color-text); }
.aktionen-menu {
display: none; position: absolute; right: 0; top: calc(100% + 6px);
background: var(--color-card); border: 1px solid var(--color-secondary);
border-radius: 8px; min-width: 190px; z-index: 200;
box-shadow: 0 6px 24px rgba(0,0,0,0.55); overflow: hidden;
}
.aktionen-menu.open { display: block; }
.aktionen-wrap .aktionen-menu button {
display: block; width: 100%; text-align: left; box-sizing: border-box;
background: none; border: none;
border-bottom: 1px solid var(--color-secondary);
color: var(--color-text); padding: 0.65rem 1rem;
font-size: 0.9rem; cursor: pointer; margin: 0; border-radius: 0;
}
.aktionen-wrap .aktionen-menu button:last-child { border-bottom: none; }
.aktionen-wrap .aktionen-menu button:hover { background: var(--color-secondary); }
.aktionen-wrap .aktionen-menu button.danger { color: #c0392b; }
.aktionen-wrap .aktionen-menu button:disabled { color: var(--color-muted); cursor: default; }
/* Match-Name */
.profil-name.is-match {
border: 2px solid var(--color-primary);
border-radius: 8px; padding: 0.15rem 0.75rem;
}
.profil-actions button,
.profil-actions a.btn {
margin-top: 0;
width: auto;
padding: 0.55rem 1.2rem;
display: inline-flex;
align-items: center;
line-height: 1;
box-sizing: border-box;
font-size: 0.9rem;
}
/* ── Section labels ── */
@@ -104,6 +142,86 @@
padding-top: 1.5rem;
}
/* ── Profil-Dates ── */
#datesList {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 1rem;
}
.date-card {
background: var(--color-card);
border: 1px solid var(--color-secondary);
border-radius: 12px;
overflow: hidden;
cursor: pointer;
transition: border-color 0.15s, box-shadow 0.15s;
display: flex;
flex-direction: column;
}
.date-card:hover { border-color: var(--color-primary); box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
.date-card-img {
width: 100%; aspect-ratio: 16/9;
background: var(--color-secondary);
display: flex; align-items: center; justify-content: center;
font-size: 2.5rem; color: var(--color-muted);
overflow: hidden; flex-shrink: 0;
}
.date-card-img img { width: 100%; height: 100%; object-fit: cover; }
.date-card-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.date-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.date-card-desc {
font-size: 0.78rem; color: var(--color-muted); line-height: 1.4;
overflow: hidden; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.date-card-footer {
display: flex; align-items: center; gap: 0.5rem;
padding: 0.5rem 0.75rem;
border-top: 1px solid var(--color-secondary);
font-size: 0.76rem; flex-shrink: 0;
}
.date-card-meta { color: var(--color-muted); white-space: nowrap; }
.date-card-date { color: var(--color-muted); font-size: 0.73rem; }
/* ── Profil-Date-Dialog (gleiche Optik wie auf der Dates-Seite) ── */
.date-dialog-bg {
display: none; position: fixed; inset: 0;
background: rgba(0,0,0,0.65); z-index: 500;
align-items: center; justify-content: center; padding: 1rem;
}
.date-dialog-bg.open { display: flex; }
.date-dialog {
background: var(--color-card); border-radius: 16px;
width: 100%; max-width: 520px; max-height: 92vh;
overflow-y: auto; position: relative; display: flex; flex-direction: column;
}
.date-dialog-img {
width: 100%; aspect-ratio: 16/9; background: var(--color-secondary);
display: flex; align-items: center; justify-content: center;
font-size: 3rem; color: var(--color-muted);
overflow: hidden; flex-shrink: 0; border-radius: 16px 16px 0 0;
}
.date-dialog-img img { width: 100%; height: 100%; object-fit: cover; }
.date-dialog-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.date-dialog-close {
position: absolute; top: 0.75rem; right: 0.85rem;
background: rgba(0,0,0,0.45); border: none; color: #fff;
width: 2rem; height: 2rem; border-radius: 50%;
font-size: 1rem; cursor: pointer;
display: flex; align-items: center; justify-content: center;
padding: 0; z-index: 1;
}
.date-dialog-close:hover { background: rgba(0,0,0,0.65); }
.date-dialog-title { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.date-dialog-when { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--color-muted); }
.date-dialog-desc {
background: var(--color-secondary); border-radius: 8px;
padding: 0.85rem 1rem; font-size: 0.9rem; line-height: 1.55; white-space: pre-wrap;
}
.date-dialog-stats { font-size: 0.82rem; color: var(--color-muted); }
.date-dialog-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.date-interest-btn { flex: 1; min-width: 120px; }
.date-interest-btn.active { background: var(--color-primary); color: #fff; }
/* ── Gallery Carousel ── */
.gallery-strip {
display: grid;
@@ -183,7 +301,8 @@
align-items: center;
gap: 0.3rem;
cursor: pointer;
flex: 0 0 calc(20% - 0.6rem);
flex: 0 0 76px;
width: 76px;
min-width: 0;
}
@@ -208,7 +327,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 64px;
width: 76px;
}
.friend-thumb:hover span { color: var(--color-primary); }
@@ -397,7 +516,8 @@
/* ── Post / Bild Lightbox ── */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:400; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -410,7 +530,7 @@
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
.lb-img-nav { display:flex; gap:0.75rem; align-items:center; justify-content:center; margin-top:0.75rem; flex-wrap:wrap; }
.compose-action-btn { background:none; border:1px solid var(--color-secondary); color:var(--color-muted); border-radius:6px; padding:0.35rem 0.6rem; font-size:0.95rem; cursor:pointer; margin:0; width:auto; }
@media (max-width:650px) { .lb-layout { flex-direction:column; max-height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
@media (max-width:650px) { .lb-layout { flex-direction:column; height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
</style>
</head>
<body class="app">
@@ -450,15 +570,23 @@
<div id="vorliebenDisplay"></div>
</div>
<!-- Dates -->
<div id="datesSection" style="display:none; margin-top:1rem;">
<div class="section-label">Dates</div>
<div id="datesList"></div>
</div>
<!-- Freunde -->
<div id="friendsSection" style="display:none; margin-top:1rem;">
<div class="section-label">Freunde <span id="friendsCount" style="font-weight:400;color:var(--color-muted);font-size:0.85rem;"></span></div>
<div class="friends-strip" id="friendsStrip"></div>
<div class="gallery-nav" id="friendsNav" style="display:none;">
<button id="friendsPrev" onclick="friendsPage(-1)" disabled>&#8592;</button>
<span class="gallery-pos" id="friendsPos"></span>
<button id="friendsNext" onclick="friendsPage(1)">&#8594;</button>
<div style="display:flex; align-items:center; justify-content:space-between;">
<div class="section-label" style="margin-bottom:0.5rem;">Freunde <span id="friendsCount" style="font-weight:400;color:var(--color-muted);font-size:0.85rem;"></span></div>
<div id="friendsNav" style="display:none; align-items:center; gap:0.3rem; flex-shrink:0;">
<button id="friendsPrev" onclick="friendsPage(-1)" disabled style="padding:0.2rem 0.6rem; font-size:0.85rem;">&#8592;</button>
<span class="gallery-pos" id="friendsPos"></span>
<button id="friendsNext" onclick="friendsPage(1)" style="padding:0.2rem 0.6rem; font-size:0.85rem;">&#8594;</button>
</div>
</div>
<div class="friends-strip" id="friendsStrip"></div>
</div>
<!-- Tabs: Feed | Pinnwand | Spielhistorie | Keyholder-Angebote -->
@@ -536,6 +664,7 @@
let isOwnProfile = false;
let profileData = null;
let avatarSrc = null;
let blockedByMe = false;
let allImages = [];
let galleryOffset = 0;
@@ -575,10 +704,11 @@
async function loadProfile() {
try {
const [me, profile, images] = await Promise.all([
const [me, profile, images, blockStatus] = await Promise.all([
fetch('/login/me').then(r => r.ok ? r.json() : null),
fetch('/social/users/' + targetUserId).then(r => r.ok ? r.json() : null),
fetch('/social/profile-images?userId=' + targetUserId).then(r => r.ok ? r.json() : [])
fetch('/social/profile-images?userId=' + targetUserId).then(r => r.ok ? r.json() : []),
fetch('/social/block/' + targetUserId).then(r => r.ok ? r.json() : { blockedByMe: false })
]);
document.getElementById('loadingHint').style.display = 'none';
@@ -592,6 +722,7 @@
isOwnProfile = !previewMode && me && me.userId === profile.userId;
profileData = profile;
allImages = images;
blockedByMe = blockStatus?.blockedByMe ?? false;
// Profilbesuch tracken (nur fremde Profile, kein Preview-Modus)
if (!isOwnProfile && !previewMode && myUserId) {
@@ -614,6 +745,11 @@
renderGallery();
}
// ── Dates (nur wenn Besucher selbst Dating aktiviert hat und Profil-User auch) ──
if (me && me.datingAktiv && profile.datingAktiv) {
loadProfilDates(profile.userId);
}
// ── Freunde ──
if (canSee(profile.sichtbarkeitFreunde, isFriend, isOwnProfile)) {
loadFriends();
@@ -688,26 +824,91 @@
// eigenes Profil im Preview-Modus keine Aktionsbuttons anzeigen
actions.innerHTML = '';
} else {
let html = '';
if (profile.friendStatus === 'FRIEND') {
html += `<a href="/community/nachrichten.html?userId=${profile.userId}" class="btn">✉ Nachricht</a>`;
} else if (profile.friendStatus === 'PENDING_SENT') {
html += `<button disabled>Anfrage gesendet</button>`;
} else if (profile.friendStatus === 'PENDING_RECEIVED') {
html += `<button id="friendActionBtn" onclick="acceptFriend()">✓ Anfrage annehmen</button>`;
if (!blockedByMe) {
let friendItem = '';
if (profile.friendStatus === 'PENDING_SENT') {
friendItem = `<button disabled>Anfrage gesendet</button>`;
} else if (profile.friendStatus === 'PENDING_RECEIVED') {
friendItem = `<button id="friendActionBtn" onclick="closeAktionen();acceptFriend()">✓ Anfrage annehmen</button>`;
} else if (profile.friendStatus !== 'FRIEND') {
friendItem = `<button id="friendActionBtn" onclick="closeAktionen();addFriend()">+ Freund hinzufügen</button>`;
}
actions.innerHTML = `
<div class="profil-actions-spacer"></div>
<div id="profileActionsCenter" style="display:flex;gap:0.5rem;align-items:center;">
<a href="/community/nachrichten.html?userId=${profile.userId}" class="btn">✉ Nachricht</a>
${friendItem}
<div class="aktionen-wrap">
<button class="aktionen-btn" onclick="toggleAktionen(event)">Aktionen ▾</button>
<div class="aktionen-menu" id="aktionenMenu">
<button onclick="closeAktionen();openMeldungDialog('PROFIL','${profile.userId}')">⚑ Melden</button>
<button class="danger" onclick="closeAktionen();confirmBlock('${profile.userId}','${esc(profile.name)}')">⊘ Blockieren</button>
</div>
</div>
</div>
<div class="profil-actions-spacer"></div>`;
} else {
html += `<button id="friendActionBtn" onclick="addFriend()">+ Freund hinzufügen</button>`;
actions.innerHTML = `<button onclick="unblockUser('${profile.userId}')" style="background:none;border:1px solid var(--color-secondary);color:var(--color-muted);border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">Blockierung aufheben</button>`;
}
html += ` <button onclick="openMeldungDialog('PROFIL','${profile.userId}')" style="background:none;border:1px solid var(--color-secondary);color:var(--color-muted);border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">⚑ Melden</button>`;
actions.innerHTML = html;
// Dating-Like-Button nur anzeigen wenn Ziel-User Dating aktiviert hat
if (profile.datingAktiv) {
// Dating-Like-Button nur anzeigen wenn Ziel-User Dating aktiviert hat und nicht blockiert
if (profile.datingAktiv && !blockedByMe) {
loadDatingLikeButton(profile.userId);
}
// Match-Badge laden
if (!blockedByMe) {
loadMatchBadge(profile.userId, profile.name);
}
}
}
async function loadMatchBadge(userId, userName) {
try {
const res = await fetch('/dating/match/' + userId);
if (!res.ok) return;
const data = await res.json();
if (!data.isMatch) return;
// Wrap name with heart emojis + red border
const nameEl = document.getElementById('profileName');
nameEl.textContent = `💕 ${nameEl.textContent} 💕`;
nameEl.classList.add('is-match');
// Add "Match auflösen" to Aktionen dropdown
const menu = document.getElementById('aktionenMenu');
if (menu) {
const btn = document.createElement('button');
btn.className = 'danger';
btn.textContent = '💔 Match auflösen';
btn.onclick = () => { closeAktionen(); confirmUnmatch(userId, userName); };
menu.appendChild(btn);
}
} catch { /* Dating evtl. nicht aktiv ignorieren */ }
}
async function confirmUnmatch(userId, userName) {
if (!confirm(`Match mit ${userName} wirklich auflösen?\n\nBeide Likes werden entfernt.`)) return;
try {
await fetch('/dating/match/' + userId, { method: 'DELETE' });
// Remove match styling from name
const nameEl = document.getElementById('profileName');
nameEl.textContent = nameEl.textContent.replace(/^💕 /, '').replace(/ 💕$/, '');
nameEl.classList.remove('is-match');
// Remove button from dropdown
document.getElementById('aktionenMenu')?.querySelectorAll('button').forEach(b => {
if (b.textContent.includes('Match auflösen')) b.remove();
});
} catch { alert('Fehler beim Auflösen des Matches.'); }
}
window.toggleAktionen = function(e) {
e.stopPropagation();
document.getElementById('aktionenMenu')?.classList.toggle('open');
};
window.closeAktionen = function() {
document.getElementById('aktionenMenu')?.classList.remove('open');
};
document.addEventListener('click', () => closeAktionen());
// ── Privacy helpers ──
function canSee(sichtbarkeit, isFriend, isOwn) {
if (isOwn || !sichtbarkeit) return true;
@@ -747,6 +948,107 @@
}
// ── Profil-Dates ──
async function loadProfilDates(userId) {
try {
const res = await fetch('/dating/dates/by-user/' + userId);
if (!res.ok) return;
const dates = await res.json();
if (!dates.length) return;
const section = document.getElementById('datesSection');
const list = document.getElementById('datesList');
list.innerHTML = '';
dates.forEach(d => {
const card = document.createElement('div');
card.className = 'date-card';
const thumb = d.imageData
? `<img src="${escV(d.imageData)}" alt="">`
: '📅';
const dateHint = d.scheduledAt
? `<div class="date-card-date">🗓️ ${formatProfilDate(d.scheduledAt)}</div>` : '';
card.innerHTML = `
<div class="date-card-img">${thumb}</div>
<div class="date-card-body">
<div class="date-card-title">${escV(d.title)}</div>
<div class="date-card-desc">${escV(d.description)}</div>
${dateHint}
</div>
<div class="date-card-footer">
<span class="date-card-meta">♥ ${d.interestCount}</span>
</div>`;
card.addEventListener('click', () => openProfilDateDialog(d));
list.appendChild(card);
});
section.style.display = '';
} catch(e) { /* ignorieren */ }
}
function formatProfilDate(iso) {
if (!iso) return '';
try {
const d = new Date(iso);
return d.toLocaleString('de-DE', { day:'2-digit', month:'2-digit', year:'numeric', hour:'2-digit', minute:'2-digit' });
} catch { return iso; }
}
// ── Profil-Date-Dialog ──
let _profilDateCurrent = null;
function openProfilDateDialog(d) {
_profilDateCurrent = d;
document.getElementById('pddImg').innerHTML = d.imageData
? `<img src="${escV(d.imageData)}" alt="">` : '📅';
document.getElementById('pddTitle').textContent = d.title;
const whenEl = document.getElementById('pddWhen');
if (d.scheduledAt) {
whenEl.textContent = '🗓️ ' + formatProfilDate(d.scheduledAt);
whenEl.style.display = '';
} else {
whenEl.style.display = 'none';
}
document.getElementById('pddDesc').textContent = d.description;
document.getElementById('pddStats').textContent =
d.interestCount + ' Person' + (d.interestCount === 1 ? '' : 'en') + ' interessiert';
const btn = document.getElementById('pddInterestBtn');
btn.className = 'btn date-interest-btn' + (d.myInterest ? ' active' : '');
btn.textContent = d.myInterest ? '♥ Interesse bekundet' : '♥ Interesse bekunden';
btn.disabled = false;
document.getElementById('profilDateDialogBg').classList.add('open');
}
window.closeProfilDateDialog = function(e) {
if (e && e.target !== document.getElementById('profilDateDialogBg')) return;
document.getElementById('profilDateDialogBg').classList.remove('open');
};
window.closeProfilDateDialogBtn = function() {
document.getElementById('profilDateDialogBg').classList.remove('open');
};
window.toggleProfilDateInterest = async function() {
if (!_profilDateCurrent) return;
const btn = document.getElementById('pddInterestBtn');
btn.disabled = true;
try {
const res = await fetch('/dating/dates/' + _profilDateCurrent.dateId + '/interest', { method: 'POST' });
if (!res.ok) return;
const data = await res.json();
_profilDateCurrent = { ..._profilDateCurrent, myInterest: data.myInterest, interestCount: data.interestCount };
btn.className = 'btn date-interest-btn' + (data.myInterest ? ' active' : '');
btn.textContent = data.myInterest ? '♥ Interesse bekundet' : '♥ Interesse bekunden';
document.getElementById('pddStats').textContent =
data.interestCount + ' Person' + (data.interestCount === 1 ? '' : 'en') + ' interessiert';
} finally {
btn.disabled = false;
}
};
// ── Vorlieben anzeigen ──
const BEWERTUNG_ORDER = ['UNBEDINGT','MAG_ICH','WILL_AUSPROBIEREN','NEUTRAL','EHER_NICHT','GEHT_GAR_NICHT'];
const BEWERTUNG_LABEL = {
@@ -785,6 +1087,7 @@
if (!grouped[bw]) grouped[bw] = [];
grouped[bw].push(itemNames[itemId] || itemId);
});
Object.values(grouped).forEach(names => names.sort((a, b) => a.localeCompare(b, 'de')));
const visibleGroups = BEWERTUNG_ORDER.filter(bw => grouped[bw]?.length);
if (!visibleGroups.length) {
@@ -912,7 +1215,7 @@
const nav = document.getElementById('friendsNav');
if (allFriends.length > FRIENDS_PAGE) {
nav.style.display = '';
nav.style.display = 'flex';
document.getElementById('friendsPrev').disabled = friendsOffset === 0;
document.getElementById('friendsNext').disabled = friendsOffset + FRIENDS_PAGE >= allFriends.length;
const cur = Math.floor(friendsOffset / FRIENDS_PAGE) + 1;
@@ -952,7 +1255,7 @@
const likeClass = img.likedByMe ? ' active' : '';
document.getElementById('lbPostBody').innerHTML = `
<img src="data:image/jpeg;base64,${img.imageData}" alt=""
style="width:100%;max-height:360px;object-fit:contain;border-radius:8px;display:block;">
style="width:100%;max-height:1024px;object-fit:contain;border-radius:8px;display:block;">
<div class="lb-img-nav">
<button class="post-action-btn" ${prevDisabled} onclick="lbGalleryNav(-1)">← Zurück</button>
${!isOwnProfile ? `<button class="post-action-btn${likeClass}" id="lbImgLikeBtn" onclick="lbToggleImageLike()">
@@ -988,6 +1291,11 @@
// ── Pinnwand ──
async function loadPinnwand() {
// Schreibbereich ausblenden wenn wir die Person blockiert haben oder es das eigene Profil ist
if (blockedByMe || isOwnProfile) {
document.querySelector('.pinnwand-write').style.display = 'none';
}
const res = await fetch('/social/pinnwand?userId=' + targetUserId);
if (!res.ok) return;
const eintraege = await res.json();
@@ -1136,6 +1444,31 @@
body: JSON.stringify({ profilUserId: targetUserId, text })
});
if (res.ok) { ta.value = ''; await loadPinnwand(); }
else if (res.status === 403) {
alert('Du kannst auf dieser Pinnwand keinen Eintrag hinterlassen.');
}
}
// ── Blockieren ──
function confirmBlock(userId, userName) {
if (!confirm(`Möchtest du ${userName} wirklich blockieren?\n\nDer gesamte bisherige Chat wird gelöscht. Die Person kann dich nicht mehr kontaktieren und keine Pinnwand-Einträge hinterlassen.`)) return;
blockUser(userId);
}
async function blockUser(userId) {
const res = await fetch('/social/block/' + userId, { method: 'POST' });
if (res.ok || res.status === 409) {
blockedByMe = true;
location.reload();
}
}
async function unblockUser(userId) {
const res = await fetch('/social/block/' + userId, { method: 'DELETE' });
if (res.ok || res.status === 404) {
blockedByMe = false;
location.reload();
}
}
async function deleteEintrag(eintragId) {
@@ -1436,8 +1769,8 @@
const btn = document.createElement('button');
btn.id = 'datingLikeBtn';
btn.title = liked ? 'Unlike' : 'Like';
btn.style.cssText = 'padding:0.4rem 0.9rem;font-size:0.9rem;' +
(liked ? 'background:var(--color-primary);color:#fff;' : 'background:none;border:1px solid var(--color-primary);color:var(--color-primary);') +
btn.style.cssText = 'padding:0.55rem 1.2rem;font-size:0.9rem;' +
(liked ? 'background:var(--color-primary);color:#fff;border:none;' : 'background:none;border:1px solid var(--color-primary);color:var(--color-primary);') +
'border-radius:6px;cursor:pointer;';
btn.textContent = liked ? '♥ Liked' : '♥ Liken';
btn.addEventListener('click', async () => {
@@ -1467,8 +1800,35 @@
btn.disabled = false;
}
});
document.getElementById('profileActions').appendChild(btn);
const center = document.getElementById('profileActionsCenter');
if (center) {
const aktionenWrap = center.querySelector('.aktionen-wrap');
if (aktionenWrap) {
center.insertBefore(btn, aktionenWrap);
} else {
center.appendChild(btn);
}
} else {
document.getElementById('profileActions').appendChild(btn);
}
}
</script>
<!-- ── Profil-Date-Dialog ── -->
<div id="profilDateDialogBg" class="date-dialog-bg" onclick="closeProfilDateDialog(event)">
<div class="date-dialog">
<button class="date-dialog-close" onclick="closeProfilDateDialogBtn()"></button>
<div class="date-dialog-img" id="pddImg"></div>
<div class="date-dialog-body">
<div class="date-dialog-title" id="pddTitle"></div>
<div class="date-dialog-when" id="pddWhen" style="display:none;"></div>
<div class="date-dialog-desc" id="pddDesc"></div>
<div class="date-dialog-stats" id="pddStats"></div>
<div class="date-dialog-actions">
<button id="pddInterestBtn" class="btn date-interest-btn" onclick="toggleProfilDateInterest()">♥ Interesse bekunden</button>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -71,7 +71,8 @@
/* Lightbox */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:300; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -82,7 +83,7 @@
.lb-comment-compose textarea:focus { border-color:var(--color-primary); }
.lb-comment-compose-actions { display:flex; gap:0.5rem; justify-content:flex-end; }
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
@media (max-width:650px) { .lb-layout { flex-direction:column; max-height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
@media (max-width:650px) { .lb-layout { flex-direction:column; height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
/* Comment + Like-Stile kommen aus shared.js */
</style>

View File

@@ -114,7 +114,8 @@
/* Post lightbox */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:300; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -125,7 +126,7 @@
.lb-comment-compose-actions { display:flex; gap:0.5rem; justify-content:flex-end; }
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
@media (max-width:650px) {
.lb-layout { flex-direction:column; max-height:95vh; }
.lb-layout { flex-direction:column; height:95vh; }
.lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; }
.lb-comments-panel { width:100%; }
}

View File

@@ -529,15 +529,41 @@
if (!text) return;
input.value = '';
try {
await fetch('/social/messages', {
const res = await fetch('/social/messages', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ receiverId: activePartnerId, text })
});
if (res.status === 403) {
let reason = '';
try { const body = await res.json(); reason = body.reason; } catch (_) {}
if (reason === 'FIRST_MESSAGE_RESTRICTED') {
showThreadNotice('Du kannst diese Person nur anschreiben, wenn ihr befreundet seid, ein Match habt oder du ein Pro-Abo hast.');
} else if (reason === 'BLOCKED') {
showThreadNotice('Diese Konversation ist nicht mehr möglich.');
} else {
showThreadNotice('Nachricht konnte nicht gesendet werden.');
}
// Text wieder zurücksetzen, damit der User ihn nicht verliert
input.value = text;
return;
}
await pollNewMessages();
} catch (e) { console.error(e); }
}
function showThreadNotice(msg) {
const existing = document.getElementById('threadNotice');
if (existing) existing.remove();
const notice = document.createElement('div');
notice.id = 'threadNotice';
notice.style.cssText = 'background:rgba(180,0,60,0.12);border:1px solid rgba(180,0,60,0.35);border-radius:8px;padding:0.75rem 1rem;font-size:0.88rem;color:var(--color-text);margin:0.5rem 0;line-height:1.45;';
notice.textContent = msg;
const container = document.getElementById('threadMessages');
container.appendChild(notice);
container.scrollTop = container.scrollHeight;
}
document.getElementById('msgInput').addEventListener('keydown', e => {
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendMsg(); }
});