import React from 'react'
import { usePage } from '@inertiajs/react'
import StudioLayout from '../../Layouts/StudioLayout'
import StudioContentBrowser from '../../components/Studio/StudioContentBrowser'

function SummaryCard({ label, value, icon }) {
  return (
    <div className="rounded-[24px] border border-white/10 bg-white/[0.03] p-5">
      <div className="flex items-center gap-3 text-slate-300">
        <i className={icon} />
        <span className="text-sm">{label}</span>
      </div>
      <div className="mt-3 text-3xl font-semibold text-white">{Number(value || 0).toLocaleString()}</div>
    </div>
  )
}

export default function StudioArtworks() {
  const { props } = usePage()
  const summary = props.summary || {}

  return (
    <StudioLayout title={props.title} subtitle={props.description}>
      <div className="mb-6 grid gap-4 md:grid-cols-4">
        <SummaryCard label="Artworks" value={summary.count} icon="fa-solid fa-images" />
        <SummaryCard label="Drafts" value={summary.draft_count} icon="fa-solid fa-file-pen" />
        <SummaryCard label="Published" value={summary.published_count} icon="fa-solid fa-rocket" />
        <a href="/upload" className="rounded-[24px] border border-sky-300/20 bg-sky-300/10 p-5 text-sky-100 transition hover:border-sky-300/35 hover:bg-sky-300/15">
          <p className="text-[11px] font-semibold uppercase tracking-[0.2em]">Upload artwork</p>
          <p className="mt-3 text-sm leading-6">Start a new visual upload flow without leaving Creator Studio.</p>
        </a>
      </div>

      <StudioContentBrowser listing={props.listing} quickCreate={props.quickCreate} hideModuleFilter />
    </StudioLayout>
  )
}
