Save workspace changes
This commit is contained in:
@@ -25,40 +25,39 @@ function formatYear(value) {
|
||||
|
||||
function iconForType(type) {
|
||||
switch (type) {
|
||||
case 'first_upload':
|
||||
return 'fa-solid fa-seedling'
|
||||
case 'first_featured_artwork':
|
||||
return 'fa-solid fa-star'
|
||||
case 'first_group_release':
|
||||
return 'fa-solid fa-people-group'
|
||||
case 'biggest_download_spike':
|
||||
return 'fa-solid fa-bolt'
|
||||
case 'best_performing_work':
|
||||
return 'fa-solid fa-trophy'
|
||||
case 'most_productive_year':
|
||||
return 'fa-solid fa-calendar-check'
|
||||
case 'yearly_recap':
|
||||
return 'fa-solid fa-chart-column'
|
||||
// v2
|
||||
case 'comeback_minor':
|
||||
return 'fa-solid fa-rotate-right'
|
||||
case 'comeback_major':
|
||||
return 'fa-solid fa-person-walking-arrow-right'
|
||||
case 'comeback_legendary':
|
||||
return 'fa-solid fa-fire-flame-curved'
|
||||
case 'first_upload': return 'fa-solid fa-seedling'
|
||||
case 'first_featured_artwork': return 'fa-solid fa-star'
|
||||
case 'first_group_release': return 'fa-solid fa-people-group'
|
||||
case 'biggest_download_spike': return 'fa-solid fa-bolt'
|
||||
case 'best_performing_work': return 'fa-solid fa-trophy'
|
||||
case 'most_productive_year': return 'fa-solid fa-calendar-check'
|
||||
case 'yearly_recap': return 'fa-solid fa-chart-column'
|
||||
case 'comeback_minor': return 'fa-solid fa-rotate-right'
|
||||
case 'comeback_major': return 'fa-solid fa-person-walking-arrow-right'
|
||||
case 'comeback_legendary': return 'fa-solid fa-fire-flame-curved'
|
||||
case 'upload_streak_3':
|
||||
case 'upload_streak_6':
|
||||
case 'upload_streak_12':
|
||||
return 'fa-solid fa-fire'
|
||||
case 'upload_streak_12': return 'fa-solid fa-fire'
|
||||
case 'active_year_streak_3':
|
||||
case 'active_year_streak_5':
|
||||
return 'fa-solid fa-calendar-days'
|
||||
case 'before_now':
|
||||
return 'fa-solid fa-arrows-rotate'
|
||||
case 'era_started':
|
||||
return 'fa-solid fa-flag'
|
||||
default:
|
||||
return 'fa-solid fa-sparkles'
|
||||
case 'active_year_streak_5': return 'fa-solid fa-calendar-days'
|
||||
case 'before_now': return 'fa-solid fa-arrows-rotate'
|
||||
case 'era_started': return 'fa-solid fa-flag'
|
||||
default: return 'fa-solid fa-sparkles'
|
||||
}
|
||||
}
|
||||
|
||||
function colorForType(type) {
|
||||
switch (type) {
|
||||
case 'first_featured_artwork': return { icon: 'text-amber-200', bg: 'bg-amber-400/12', border: 'border-amber-300/20', accent: 'from-amber-400/60' }
|
||||
case 'best_performing_work': return { icon: 'text-amber-200', bg: 'bg-amber-400/12', border: 'border-amber-300/20', accent: 'from-amber-400/60' }
|
||||
case 'biggest_download_spike': return { icon: 'text-sky-200', bg: 'bg-sky-400/12', border: 'border-sky-300/20', accent: 'from-sky-400/60' }
|
||||
case 'first_upload': return { icon: 'text-emerald-200', bg: 'bg-emerald-400/12', border: 'border-emerald-300/20', accent: 'from-emerald-400/60' }
|
||||
case 'first_group_release': return { icon: 'text-violet-200', bg: 'bg-violet-400/12', border: 'border-violet-300/20', accent: 'from-violet-400/60' }
|
||||
case 'comeback_minor':
|
||||
case 'comeback_major':
|
||||
case 'comeback_legendary': return { icon: 'text-orange-200', bg: 'bg-orange-400/12', border: 'border-orange-300/20', accent: 'from-orange-400/60' }
|
||||
case 'most_productive_year': return { icon: 'text-teal-200', bg: 'bg-teal-400/12', border: 'border-teal-300/20', accent: 'from-teal-400/60' }
|
||||
default: return { icon: 'text-sky-200', bg: 'bg-sky-400/12', border: 'border-sky-300/20', accent: 'from-sky-400/60' }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +202,103 @@ function StreaksSection({ streaks }) {
|
||||
)
|
||||
}
|
||||
|
||||
// ── Yearly Productivity Chart ────────────────────────────────────────────────
|
||||
|
||||
const STATUS_BAR_COLOR = {
|
||||
breakout: { bar: 'bg-emerald-400', label: 'bg-emerald-400/12 text-emerald-200 border-emerald-400/20' },
|
||||
steady: { bar: 'bg-sky-400', label: 'bg-sky-400/12 text-sky-200 border-sky-400/20' },
|
||||
experimental: { bar: 'bg-violet-400', label: 'bg-violet-400/12 text-violet-200 border-violet-400/20' },
|
||||
comeback: { bar: 'bg-amber-400', label: 'bg-amber-400/12 text-amber-200 border-amber-400/20' },
|
||||
quiet: { bar: 'bg-slate-500', label: 'bg-slate-700/60 text-slate-400 border-slate-600/30' },
|
||||
}
|
||||
|
||||
function YearlyProductivityChart({ recaps }) {
|
||||
if (!recaps?.length) return null
|
||||
|
||||
// Sort oldest → newest for the chart
|
||||
const sorted = [...recaps]
|
||||
.filter((r) => r.metrics?.year && r.metrics?.uploads_count != null)
|
||||
.sort((a, b) => (a.metrics.year ?? 0) - (b.metrics.year ?? 0))
|
||||
|
||||
if (!sorted.length) return null
|
||||
|
||||
const maxUploads = Math.max(...sorted.map((r) => r.metrics.uploads_count), 1)
|
||||
|
||||
return (
|
||||
<div className="mt-7 rounded-[28px] border border-white/10 bg-white/[0.03] p-5 sm:p-6">
|
||||
<div className="flex flex-wrap items-end justify-between gap-3">
|
||||
<div>
|
||||
<div className="text-xs font-semibold uppercase tracking-[0.24em] text-slate-400">Productivity</div>
|
||||
<div className="mt-1 text-lg font-semibold text-white">Year-by-year upload activity</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-3 text-[11px] text-slate-500">
|
||||
{Object.entries(STATUS_BAR_COLOR)
|
||||
.filter(([key]) => sorted.some((r) => (r.metrics?.year_status ?? 'steady') === key))
|
||||
.map(([key, val]) => (
|
||||
<span key={key} className="flex items-center gap-1.5 capitalize">
|
||||
<span className={`inline-block h-2 w-2 rounded-full ${val.bar}`} />
|
||||
{key}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-5 space-y-2">
|
||||
{sorted.map((item) => {
|
||||
const uploads = item.metrics.uploads_count
|
||||
const pct = Math.max(uploads / maxUploads, uploads > 0 ? 0.018 : 0)
|
||||
const status = item.metrics?.year_status ?? 'steady'
|
||||
const colors = STATUS_BAR_COLOR[status] ?? STATUS_BAR_COLOR.steady
|
||||
const isBest = uploads === maxUploads
|
||||
|
||||
return (
|
||||
<div key={item.metrics.year} className="group grid grid-cols-[3.5rem_minmax(0,1fr)_4rem] items-center gap-3">
|
||||
{/* Year label */}
|
||||
<div className={`text-right text-[13px] font-semibold tabular-nums ${isBest ? 'text-white' : 'text-slate-400'}`}>
|
||||
{item.metrics.year}
|
||||
</div>
|
||||
|
||||
{/* Bar */}
|
||||
<div className="relative h-7 overflow-hidden rounded-full bg-white/[0.04]">
|
||||
<div
|
||||
className={`absolute inset-y-0 left-0 rounded-full ${colors.bar} opacity-80 transition-all duration-500 group-hover:opacity-100`}
|
||||
style={{ width: `${(pct * 100).toFixed(1)}%` }}
|
||||
/>
|
||||
{/* Tooltip on hover */}
|
||||
<div className="absolute inset-y-0 left-0 flex w-full items-center px-3 opacity-0 transition-opacity group-hover:opacity-100">
|
||||
<span className="text-[11px] font-semibold text-white drop-shadow-sm">
|
||||
{uploads} upload{uploads !== 1 ? 's' : ''}
|
||||
{(item.metrics?.views ?? 0) > 0 ? ` · ${Number(item.metrics.views).toLocaleString()} views` : ''}
|
||||
{(item.metrics?.downloads ?? 0) > 0 ? ` · ${Number(item.metrics.downloads).toLocaleString()} dl` : ''}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Upload count + badge */}
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className={`text-[13px] font-bold tabular-nums ${isBest ? 'text-white' : 'text-slate-300'}`}>{uploads}</span>
|
||||
{isBest && <span className="rounded-full border border-amber-400/25 bg-amber-400/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-amber-300">best</span>}
|
||||
{(item.metrics?.featured_count ?? 0) > 0 && !isBest && (
|
||||
<span className="rounded-full border border-sky-400/20 bg-sky-400/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-sky-300">
|
||||
<i className="fa-solid fa-star text-[8px]" /> {item.metrics.featured_count}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Summary footer */}
|
||||
<div className="mt-5 flex flex-wrap gap-4 border-t border-white/5 pt-4 text-[12px] text-slate-400">
|
||||
<span><span className="font-semibold text-white">{sorted.length}</span> active years</span>
|
||||
<span><span className="font-semibold text-white">{sorted.reduce((s, r) => s + r.metrics.uploads_count, 0).toLocaleString()}</span> total uploads</span>
|
||||
<span><span className="font-semibold text-white">{Number(sorted.reduce((s, r) => s + (r.metrics.views ?? 0), 0)).toLocaleString()}</span> total views</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ── v2: Growth & Evolution ───────────────────────────────────────────────────
|
||||
|
||||
const RELATION_LABELS = {
|
||||
@@ -276,6 +372,7 @@ export default function CreatorJourneySection({ journey, username }) {
|
||||
const highlights = Array.isArray(journey?.highlights) ? journey.highlights : []
|
||||
const timeline = Array.isArray(journey?.timeline) ? journey.timeline.slice(0, 6) : []
|
||||
const recaps = Array.isArray(journey?.yearly_recaps) ? journey.yearly_recaps.slice(0, 3) : []
|
||||
const allRecaps = Array.isArray(journey?.yearly_recaps) ? journey.yearly_recaps : []
|
||||
const eras = Array.isArray(journey?.eras) ? journey.eras : []
|
||||
const evolution = Array.isArray(journey?.evolution) ? journey.evolution : []
|
||||
const streaks = journey?.streaks ?? null
|
||||
@@ -333,11 +430,13 @@ export default function CreatorJourneySection({ journey, username }) {
|
||||
return (
|
||||
<article
|
||||
key={item.id}
|
||||
className="rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),rgba(255,255,255,0.02))] p-5"
|
||||
className="relative overflow-hidden rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),rgba(255,255,255,0.02))] p-5 transition-colors hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.09),rgba(255,255,255,0.03))]"
|
||||
>
|
||||
{(() => { const c = colorForType(item.type); return <div className={`absolute inset-x-0 top-0 h-[2px] bg-gradient-to-r ${c.accent} via-transparent to-transparent`} /> })()
|
||||
}
|
||||
<div className="flex items-start justify-between gap-4">
|
||||
<div className="flex min-w-0 items-start gap-3">
|
||||
<div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-sky-400/12 text-sky-200">
|
||||
<div className={`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl ${colorForType(item.type).bg} ${colorForType(item.type).icon}`}>
|
||||
<i className={iconForType(item.type)} />
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
@@ -371,7 +470,7 @@ export default function CreatorJourneySection({ journey, username }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-7 grid gap-6 xl:grid-cols-[minmax(0,1.35fr)_minmax(18rem,0.95fr)]">
|
||||
<div className="mt-7 grid gap-6">
|
||||
<div className="rounded-[28px] border border-white/10 bg-white/[0.03] p-5">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
@@ -387,7 +486,7 @@ export default function CreatorJourneySection({ journey, username }) {
|
||||
return (
|
||||
<div key={item.id} className="grid grid-cols-[2.5rem_minmax(0,1fr)] gap-3">
|
||||
<div className="flex flex-col items-center">
|
||||
<div className="flex h-10 w-10 items-center justify-center rounded-2xl border border-white/10 bg-white/[0.05] text-slate-100">
|
||||
<div className={`flex h-10 w-10 items-center justify-center rounded-2xl border ${colorForType(item.type).border} ${colorForType(item.type).bg} ${colorForType(item.type).icon}`}>
|
||||
<i className={iconForType(item.type)} />
|
||||
</div>
|
||||
{index < timeline.length - 1 && <div className="mt-2 h-full w-px bg-white/10" />}
|
||||
@@ -470,6 +569,9 @@ export default function CreatorJourneySection({ journey, username }) {
|
||||
{/* ── v2: Streaks ── */}
|
||||
<StreaksSection streaks={streaks} />
|
||||
|
||||
{/* ── Yearly productivity chart ── */}
|
||||
<YearlyProductivityChart recaps={allRecaps} />
|
||||
|
||||
{/* ── v2: Growth & Evolution ── */}
|
||||
<EvolutionSection evolution={evolution} />
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user