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