Update files
This commit is contained in:
parent
4948b726da
commit
a3f9374a6a
|
|
@ -222,15 +222,23 @@ export default function PostCard({ post, currentUser, onUpdate }) {
|
|||
|
||||
{/* Теги */}
|
||||
<div className="post-tags">
|
||||
{post.tags.map((tag, index) => (
|
||||
{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: TAG_COLORS[tag] }}
|
||||
style={{ backgroundColor: tagColor }}
|
||||
>
|
||||
{TAG_NAMES[tag]}
|
||||
{tagName}
|
||||
</span>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
{post.isNSFW && (
|
||||
<span className="nsfw-badge">NSFW</span>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue