import React from 'react' import { usePage } from '@inertiajs/react' import StudioLayout from '../../Layouts/StudioLayout' function StatCard({ label, value, icon }) { return (
{label}
{Number(value || 0).toLocaleString()}
) } function ContentCard({ item, fallbackLabel }) { return ( {item.image_url ? {item.title} :
}

{item.title}

{item.status || item.event_type || fallbackLabel}

{item.subtitle || item.description || item.summary || fallbackLabel}

) } function EmptyCard({ title, description }) { return (

{title}

{description}

) } function ActivityCard({ item }) { return (
{item.headline}
{item.is_pinned ? Pinned : null}
{item.summary ?

{item.summary}

: null}
{item.actor?.name || item.actor?.username || 'System'} • {item.occurred_at ? new Date(item.occurred_at).toLocaleString() : 'Recently'}
{item.subject?.url ? Open subject : null}
) } export default function StudioGroupDashboard() { const { props } = usePage() const group = props.studioGroup const members = Array.isArray(props.members) ? props.members : [] const dashboard = props.dashboard || {} const draftsPendingAction = Array.isArray(props.draftsPendingAction) ? props.draftsPendingAction : [] const recentArtworks = Array.isArray(props.recentArtworks) ? props.recentArtworks : [] const recentCollections = Array.isArray(props.recentCollections) ? props.recentCollections : [] const recentPosts = Array.isArray(props.recentPosts) ? props.recentPosts : [] const recentProjects = Array.isArray(props.recentProjects) ? props.recentProjects : [] const recentReleases = Array.isArray(props.recentReleases) ? props.recentReleases : [] const recentChallenges = Array.isArray(props.recentChallenges) ? props.recentChallenges : [] const recentEvents = Array.isArray(props.recentEvents) ? props.recentEvents : [] const recentActivity = Array.isArray(props.recentActivity) ? props.recentActivity : [] const trustSignals = Array.isArray(props.trustSignals) ? props.trustSignals : [] const reputationSummary = props.reputationSummary || {} const pendingJoinRequests = Array.isArray(props.pendingJoinRequests) ? props.pendingJoinRequests : [] const reviewQueuePreview = Array.isArray(props.reviewQueuePreview) ? props.reviewQueuePreview : [] const recruitment = props.recruitment || null const recentHistory = Array.isArray(props.recentHistory) ? props.recentHistory : [] const roleSummary = members.reduce((summary, member) => { const role = String(member.role || 'member') summary[role] = (summary[role] || 0) + 1 return summary }, {}) const quickActions = [ { label: 'Upload artwork', href: group?.urls?.upload, icon: 'fa-solid fa-cloud-arrow-up', tone: 'sky', detail: 'Start a new group-published artwork.' }, { label: 'Invite member', href: group?.urls?.studio_invitations, icon: 'fa-solid fa-user-plus', tone: 'emerald', detail: `Manage invites${Number(dashboard.pending_invites_count || 0) > 0 ? ` (${Number(dashboard.pending_invites_count)})` : ''}.` }, { label: 'Review queue', href: group?.urls?.studio_review, icon: 'fa-solid fa-list-check', tone: 'amber', detail: `${Number(dashboard.pending_reviews_count || 0)} submissions waiting.` }, { label: 'Posts', href: group?.urls?.studio_posts, icon: 'fa-solid fa-bullhorn', tone: 'violet', detail: `${Number(dashboard.published_posts_count || 0)} published posts.` }, { label: 'Projects', href: group?.urls?.studio_projects, icon: 'fa-solid fa-diagram-project', tone: 'sky', detail: `${Number(dashboard.projects_count || 0)} total projects.` }, { label: 'Releases', href: group?.urls?.studio_releases, icon: 'fa-solid fa-rocket', tone: 'amber', detail: `${Number(dashboard.published_releases_count || 0)} published releases.` }, { label: 'Challenges', href: group?.urls?.studio_challenges, icon: 'fa-solid fa-trophy', tone: 'amber', detail: `${Number(dashboard.active_challenges_count || 0)} active or published.` }, { label: 'Events', href: group?.urls?.studio_events, icon: 'fa-solid fa-calendar-day', tone: 'emerald', detail: `${Number(dashboard.events_count || 0)} scheduled or archived.` }, { label: 'Assets', href: group?.urls?.studio_assets, icon: 'fa-solid fa-box-archive', tone: 'violet', detail: `${Number(dashboard.assets_count || 0)} shared files.` }, { label: 'Reputation', href: group?.urls?.studio_reputation, icon: 'fa-solid fa-shield-heart', tone: 'sky', detail: `${Number(reputationSummary?.counts?.contributors || 0)} contributors tracked.` }, { label: 'Activity', href: group?.urls?.studio_activity, icon: 'fa-solid fa-wave-square', tone: 'sky', detail: `${Number(dashboard.activity_count || 0)} feed items recorded.` }, { label: 'Edit profile', href: group?.urls?.studio_settings, icon: 'fa-solid fa-pen-to-square', tone: 'amber', detail: 'Update headline, visuals, and links.' }, { label: 'Recruitment', href: group?.urls?.studio_recruitment, icon: 'fa-solid fa-user-plus', tone: 'emerald', detail: recruitment?.is_recruiting ? 'Recruitment is live.' : 'Configure recruiting status.' }, { label: 'Create collection', href: group?.urls?.collection_create, icon: 'fa-solid fa-layer-group', tone: 'violet', detail: 'Publish a new collection under this group.' }, ].filter((item) => Boolean(item.href)) const toneClasses = { sky: 'border-sky-300/20 bg-sky-300/10 text-sky-100', emerald: 'border-emerald-300/20 bg-emerald-300/10 text-emerald-100', amber: 'border-amber-300/20 bg-amber-300/10 text-amber-100', violet: 'border-violet-300/20 bg-violet-300/10 text-violet-100', } return (

Quick actions

Run the most common group tasks without leaving the dashboard.

{quickActions.map((action) => (
{action.label}
{action.detail}
))}

Pending action

Drafts and scheduled items that still need a publishing decision.

{Number(dashboard?.draft_artworks_count || 0)} drafts
{Number(dashboard?.scheduled_artworks_count || 0)} scheduled
{draftsPendingAction.length > 0 ? draftsPendingAction.map((artwork) => ( )) : }
{pendingJoinRequests.length > 0 ? (

Pending join requests

Applicants waiting for a review decision.

{group?.urls?.studio_join_requests ? Open queue : null}
{pendingJoinRequests.map((item) => (
{item.user?.name || item.user?.username}
{item.desired_role_label || item.desired_role || 'Contributor'} • {item.created_at ? new Date(item.created_at).toLocaleDateString() : 'New'}
))}
) : null}

Members

Manage
{Object.entries(roleSummary).map(([role, count]) => (
{role}
{Number(count)}
))}
{members.slice(0, 6).map((member) => (
{member.user?.avatar_url ? {member.user.name :
}
{member.user?.name || member.user?.username}
{member.role}
))}
Recruitment
{recruitment?.is_recruiting ? (recruitment.headline || 'Recruiting is active') : 'Recruitment is off'}

{recruitment?.description || 'Set open roles, skills, and contact instructions from the recruitment page.'}

Releases

Track featured drops and current release pipelines.

{group?.urls?.studio_releases ? Manage : null}
{recentReleases.length > 0 ? recentReleases.map((release) => ( )) : }

Projects

Recent structured releases and collaboration hubs.

{group?.urls?.studio_projects ? Manage : null}
{recentProjects.length > 0 ? recentProjects.map((project) => ( )) : }

Challenges

Current creative prompts and challenge arcs.

{group?.urls?.studio_challenges ? Manage : null}
{recentChallenges.length > 0 ? recentChallenges.map((challenge) => ( )) : }

Trust summary

Public-facing trust labels and internal contributor health snapshot.

{group?.urls?.studio_reputation ? Open dashboard : null}
{trustSignals.map((signal) => {signal.label})}
Contributors
{Number(reputationSummary?.counts?.contributors || 0)}
Group badges
{Number(reputationSummary?.counts?.group_badges || 0)}

Contributor highlights

Recent high-trust contributors and badge unlocks.

{Array.isArray(reputationSummary?.top_contributors) && reputationSummary.top_contributors.length > 0 ? reputationSummary.top_contributors.slice(0, 4).map((entry) =>
{entry.user?.name || entry.user?.username}
{entry.summary || 'Contributor'}
{entry.counts?.releases || 0} releases • {entry.counts?.credited_artworks || 0} artworks
) : }

Recent artworks

Latest published work released under this group identity.

View all
{recentArtworks.length > 0 ? recentArtworks.map((artwork) => ( )) : }

Events

Upcoming or recently updated moments on the group timeline.

{group?.urls?.studio_events ? Manage : null}
{recentEvents.length > 0 ? recentEvents.map((event) => ( )) : }

Recent collections

Collections most recently updated in this group workspace.

View all
{recentCollections.length > 0 ? recentCollections.map((collection) => ( )) : }

Activity feed

Pinned and recent internal or public timeline items.

{group?.urls?.studio_activity ? Open feed : null}
{recentActivity.length > 0 ? recentActivity.map((item) => ( )) : }

Review queue

Latest artwork submissions waiting for moderation.

{group?.urls?.studio_review ? Open queue : null}
{reviewQueuePreview.length > 0 ? reviewQueuePreview.map((item) => (
{item.title}
{item.group_review_status}
)) : }

Recent posts

Announcements and updates published from the group.

{group?.urls?.studio_posts ? Manage posts : null}
{recentPosts.length > 0 ? recentPosts.map((post) => (
{post.type}
{post.title}

{post.excerpt || 'Open post'}

)) : }

Recent history

{recentHistory.length > 0 ? recentHistory.map((item) => (
{item.summary || item.action_type}
{item.actor?.name || item.actor?.username || 'System'} • {item.created_at ? new Date(item.created_at).toLocaleString() : 'Recently'}
)) : }
) }