Update files

This commit is contained in:
glpshchn 2025-12-08 16:55:11 +03:00
parent 4948b726da
commit a3f9374a6a
1 changed files with 17 additions and 9 deletions

View File

@ -222,15 +222,23 @@ export default function PostCard({ post, currentUser, onUpdate }) {
{/* Теги */}
<div className="post-tags">
{post.tags.map((tag, index) => (
<span
key={index}
className="post-tag"
style={{ backgroundColor: TAG_COLORS[tag] }}
>
{TAG_NAMES[tag]}
</span>
))}
{post.tags.map((tag, index) => {
// Для известных тегов используем цвета и имена из объектов
// Для неизвестных тегов используем дефолтный цвет и само имя тега
const tagColor = TAG_COLORS[tag] || '#A0A0A0' // Дефолтный серый цвет
// Если нет имени в TAG_NAMES, используем сам тег с заглавной первой буквой
const tagName = TAG_NAMES[tag] || (tag.charAt(0).toUpperCase() + tag.slice(1))
return (
<span
key={index}
className="post-tag"
style={{ backgroundColor: tagColor }}
>
{tagName}
</span>
)
})}
{post.isNSFW && (
<span className="nsfw-badge">NSFW</span>
)}