Build world campaigns rewards and recaps
This commit is contained in:
28
resources/js/components/worlds/WorldCampaignMeta.jsx
Normal file
28
resources/js/components/worlds/WorldCampaignMeta.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react'
|
||||
|
||||
function metaItems(world) {
|
||||
return [
|
||||
world?.promotion_window_label || world?.timeframe_label,
|
||||
Number(world?.live_submission_count || 0) > 0 ? `${Number(world.live_submission_count)} live submissions` : null,
|
||||
Number(world?.relation_count || 0) > 0 ? `${Number(world.relation_count)} curated links` : null,
|
||||
world?.theme?.label || world?.type || null,
|
||||
].filter(Boolean)
|
||||
}
|
||||
|
||||
export default function WorldCampaignMeta({ world, className = '' }) {
|
||||
const items = metaItems(world)
|
||||
|
||||
if (items.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`flex flex-wrap gap-2 text-xs text-slate-200/75 ${className}`.trim()}>
|
||||
{items.map((item) => (
|
||||
<span key={item} className="rounded-full border border-white/12 bg-black/25 px-3 py-1.5">
|
||||
{item}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user