Unify portal thread rows and add summary API

This commit is contained in:
Micha
2026-01-16 02:44:04 +01:00
parent f9de433545
commit 24c16ed0dd
12 changed files with 380 additions and 188 deletions

View File

@@ -28,6 +28,18 @@ export default function ThreadView() {
.finally(() => setLoading(false))
}, [id])
useEffect(() => {
if (!thread && posts.length === 0) return
const hash = window.location.hash
if (!hash) return
const targetId = hash.replace('#', '')
if (!targetId) return
const target = document.getElementById(targetId)
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
}, [thread, posts])
const handleSubmit = async (event) => {
event.preventDefault()
setSaving(true)
@@ -136,7 +148,7 @@ export default function ThreadView() {
const postNumber = index + 1
return (
<article className="bb-post-row" key={post.id}>
<article className="bb-post-row" key={post.id} id={`post-${post.id}`}>
<aside className="bb-post-author">
<div className="bb-post-avatar">
{post.user_avatar_url ? (
@@ -222,6 +234,9 @@ export default function ThreadView() {
<button type="button" className="bb-post-action" aria-label="Quote post">
<i className="bi bi-quote" aria-hidden="true" />
</button>
<a href="/" className="bb-post-action" aria-label={t('portal.portal')}>
<i className="bi bi-house-door" aria-hidden="true" />
</a>
</div>
</div>
<div className="bb-post-body">{post.body}</div>