Karten-Ausbau (OSM), Forum-Erweiterung, UI-Komponenten, Refactor Tagebuch/Gassi (DRY), Landing/SEO — APP_VER 1155
This commit is contained in:
parent
2d907f6370
commit
10e39ed135
18 changed files with 871 additions and 405 deletions
|
|
@ -640,6 +640,17 @@ function _fmtDate(iso) {
|
|||
} catch (err) { UI.toast.error(err.message); }
|
||||
});
|
||||
|
||||
// Liker-Liste anzeigen (Klick auf die Zahl)
|
||||
const _thLikeCount = document.getElementById('thread-like-count');
|
||||
if (_thLikeCount) {
|
||||
_thLikeCount.style.cursor = 'pointer';
|
||||
_thLikeCount.title = 'Wer hat geliked?';
|
||||
_thLikeCount.addEventListener('click', e => {
|
||||
e.stopPropagation();
|
||||
if ((thread.likes || 0) > 0) _showLikers('thread', thread.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Report thread
|
||||
document.getElementById('thread-report-btn')?.addEventListener('click', () => {
|
||||
_showReportForm('thread', thread.id);
|
||||
|
|
@ -812,9 +823,9 @@ function _fmtDate(iso) {
|
|||
// Like
|
||||
container.querySelectorAll('.forum-post-like:not([data-bound])').forEach(btn => {
|
||||
btn.dataset.bound = '1';
|
||||
const postId = parseInt(btn.dataset.postId);
|
||||
btn.addEventListener('click', async () => {
|
||||
if (!uid) { UI.toast.info('Bitte erst anmelden.'); return; }
|
||||
const postId = parseInt(btn.dataset.postId);
|
||||
try {
|
||||
const res = await API.forum.like('post', postId);
|
||||
btn.classList.toggle('active', res.liked);
|
||||
|
|
@ -822,6 +833,16 @@ function _fmtDate(iso) {
|
|||
if (countEl) countEl.textContent = res.count;
|
||||
} catch (err) { UI.toast.error(err.message); }
|
||||
});
|
||||
// Klick auf die Zahl → Liker-Liste
|
||||
const countEl = btn.querySelector('.forum-post-like-count');
|
||||
if (countEl) {
|
||||
countEl.style.cursor = 'pointer';
|
||||
countEl.title = 'Wer hat geliked?';
|
||||
countEl.addEventListener('click', e => {
|
||||
e.stopPropagation();
|
||||
if (parseInt(countEl.textContent) > 0) _showLikers('post', postId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Report
|
||||
|
|
@ -874,6 +895,28 @@ function _fmtDate(iso) {
|
|||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Liker-Liste — wer hat geliked?
|
||||
// ----------------------------------------------------------
|
||||
async function _showLikers(targetType, targetId) {
|
||||
try {
|
||||
const likers = await API.forum.likers(targetType, targetId);
|
||||
if (!likers.length) { UI.toast.info('Noch keine Likes.'); return; }
|
||||
const rows = likers.map(l => `
|
||||
<div style="display:flex;align-items:center;gap:var(--space-2);padding:var(--space-2) 0;border-bottom:1px solid var(--c-border-light)">
|
||||
<div class="forum-avatar forum-avatar--sm">${UI.escape(_initial(l.name))}</div>
|
||||
<span style="font-size:0.9rem">${UI.escape(l.name || 'Unbekannt')}</span>
|
||||
${l.founder_number ? `<span style="font-size:10px;font-weight:700;background:#7c3aed;color:#fff;padding:1px 5px;border-radius:4px;margin-left:auto">Gründer #${l.founder_number}</span>` : ''}
|
||||
</div>`).join('');
|
||||
UI.modal.open({
|
||||
title: `${UI.icon('heart')} ${likers.length} ${likers.length === 1 ? 'Like' : 'Likes'}`,
|
||||
body: `<div style="max-height:50vh;overflow-y:auto">${rows}</div>`,
|
||||
footer: `<button type="button" class="btn btn-secondary w-full" id="likers-close">Schließen</button>`,
|
||||
});
|
||||
document.getElementById('likers-close')?.addEventListener('click', UI.modal.close);
|
||||
} catch (err) { UI.toast.error(err.message); }
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Report-Formular
|
||||
// ----------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue