Add ranks and ACP user enhancements

This commit is contained in:
Micha
2026-01-14 00:15:56 +01:00
parent 98094459e3
commit fd29b928d8
21 changed files with 1272 additions and 26 deletions

View File

@@ -45,6 +45,15 @@ export default function ThreadView() {
}
const replyCount = posts.length
const formatDate = (value) => {
if (!value) return '—'
const date = new Date(value)
if (Number.isNaN(date.getTime())) return '—'
const day = String(date.getDate()).padStart(2, '0')
const month = String(date.getMonth() + 1).padStart(2, '0')
const year = String(date.getFullYear())
return `${day}.${month}.${year}`
}
const allPosts = useMemo(() => {
if (!thread) return posts
const rootPost = {
@@ -53,6 +62,12 @@ export default function ThreadView() {
created_at: thread.created_at,
user_name: thread.user_name,
user_avatar_url: thread.user_avatar_url,
user_posts_count: thread.user_posts_count,
user_created_at: thread.user_created_at,
user_rank_name: thread.user_rank_name,
user_rank_badge_type: thread.user_rank_badge_type,
user_rank_badge_text: thread.user_rank_badge_text,
user_rank_badge_url: thread.user_rank_badge_url,
isRoot: true,
}
return [rootPost, ...posts]
@@ -107,11 +122,17 @@ export default function ThreadView() {
</div>
<div className="bb-posts">
{allPosts.map((post) => {
{allPosts.map((post, index) => {
const authorName = post.author?.username
|| post.user_name
|| post.author_name
|| t('thread.anonymous')
const topicLabel = thread?.title
? post.isRoot
? thread.title
: `${t('thread.reply_prefix')} ${thread.title}`
: ''
const postNumber = index + 1
return (
<article className="bb-post-row" key={post.id}>
@@ -124,16 +145,30 @@ export default function ThreadView() {
)}
</div>
<div className="bb-post-author-name">{authorName}</div>
<div className="bb-post-author-role">Operator</div>
<div className="bb-post-author-badge">TEAM-RHF</div>
<div className="bb-post-author-role">
{post.user_rank_name || ''}
</div>
{(post.user_rank_badge_text || post.user_rank_badge_url) && (
<div className="bb-post-author-badge">
{post.user_rank_badge_type === 'image' && post.user_rank_badge_url ? (
<img src={post.user_rank_badge_url} alt="" />
) : (
<span>{post.user_rank_badge_text}</span>
)}
</div>
)}
<div className="bb-post-author-meta">
<div className="bb-post-author-stat">
<span className="bb-post-author-label">Posts:</span>
<span className="bb-post-author-value">63899</span>
<span className="bb-post-author-label">{t('thread.posts')}:</span>
<span className="bb-post-author-value">
{post.user_posts_count ?? 0}
</span>
</div>
<div className="bb-post-author-stat">
<span className="bb-post-author-label">Registered:</span>
<span className="bb-post-author-value">18.08.2004 18:50:03</span>
<span className="bb-post-author-label">{t('thread.registered')}:</span>
<span className="bb-post-author-value">
{formatDate(post.user_created_at)}
</span>
</div>
<div className="bb-post-author-stat">
<span className="bb-post-author-label">Location:</span>
@@ -158,6 +193,11 @@ export default function ThreadView() {
<div className="bb-post-content">
<div className="bb-post-header">
<div className="bb-post-header-meta">
{topicLabel && (
<span className="bb-post-topic">
#{postNumber} {topicLabel}
</span>
)}
<span>{t('thread.by')} {authorName}</span>
{post.created_at && (
<span>{post.created_at.slice(0, 10)}</span>