Commit workspace changes
This commit is contained in:
@@ -15,8 +15,32 @@ import ArtworkRecommendationsRails from '../components/artwork/ArtworkRecommenda
|
||||
import ArtworkNavigator from '../components/viewer/ArtworkNavigator'
|
||||
import ArtworkViewer from '../components/viewer/ArtworkViewer'
|
||||
import ReactionBar from '../components/comments/ReactionBar'
|
||||
import GroupSummaryPanel from '../components/groups/GroupSummaryPanel'
|
||||
|
||||
function ArtworkPage({ artwork: initialArtwork, related: initialRelated, presentMd: initialMd, presentLg: initialLg, presentXl: initialXl, presentSq: initialSq, canonicalUrl: initialCanonical, isAuthenticated = false, comments: initialComments = [] }) {
|
||||
function publisherToGroupSummary(publisher) {
|
||||
if (!publisher || publisher.type !== 'group') return null
|
||||
|
||||
return {
|
||||
id: publisher.id,
|
||||
name: publisher.name,
|
||||
slug: publisher.slug,
|
||||
headline: publisher.headline,
|
||||
avatar_url: publisher.avatar_url,
|
||||
counts: {
|
||||
followers: publisher.followers_count || 0,
|
||||
artworks: 0,
|
||||
members: 0,
|
||||
},
|
||||
trust_signals: [],
|
||||
urls: {
|
||||
public: publisher.profile_url,
|
||||
follow: publisher.follow_url,
|
||||
unfollow: publisher.unfollow_url,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function ArtworkPage({ artwork: initialArtwork, related: initialRelated, presentMd: initialMd, presentLg: initialLg, presentXl: initialXl, presentSq: initialSq, canonicalUrl: initialCanonical, isAuthenticated = false, comments: initialComments = [], groupSummary: initialGroupSummary = null }) {
|
||||
const [viewerOpen, setViewerOpen] = useState(false)
|
||||
const openViewer = useCallback(() => setViewerOpen(true), [])
|
||||
const closeViewer = useCallback(() => setViewerOpen(false), [])
|
||||
@@ -41,6 +65,7 @@ function ArtworkPage({ artwork: initialArtwork, related: initialRelated, present
|
||||
const [related, setRelated] = useState(initialRelated)
|
||||
const [comments, setComments] = useState(initialComments)
|
||||
const [canonicalUrl, setCanonicalUrl] = useState(initialCanonical)
|
||||
const [groupSummary, setGroupSummary] = useState(initialGroupSummary || publisherToGroupSummary(initialArtwork?.publisher))
|
||||
const [selectedMediaId, setSelectedMediaId] = useState('cover')
|
||||
|
||||
// Nav arrow state — populated by ArtworkNavigator once neighbors resolve
|
||||
@@ -70,6 +95,7 @@ function ArtworkPage({ artwork: initialArtwork, related: initialRelated, present
|
||||
setRelated([]) // cleared on navigation; user can scroll down for related
|
||||
setComments([]) // cleared; per-page server data
|
||||
setCanonicalUrl(data.canonical_url ?? window.location.href)
|
||||
setGroupSummary(data.group_summary ?? publisherToGroupSummary(data.publisher))
|
||||
setSelectedMediaId('cover')
|
||||
setViewerOpen(false) // close viewer when navigating away
|
||||
}, [])
|
||||
@@ -201,6 +227,8 @@ function ArtworkPage({ artwork: initialArtwork, related: initialRelated, present
|
||||
{/* Creator card */}
|
||||
<CreatorSpotlight artwork={artwork} presentSq={presentSq} related={related} />
|
||||
|
||||
{groupSummary ? <GroupSummaryPanel group={groupSummary} artwork={artwork} /> : null}
|
||||
|
||||
{/* Details (collapsible) */}
|
||||
<ArtworkDetailsPanel artwork={artwork} stats={liveStats} />
|
||||
|
||||
@@ -258,6 +286,7 @@ if (el) {
|
||||
presentSq={parse('presentSq')}
|
||||
canonicalUrl={parse('canonical', '')}
|
||||
isAuthenticated={parse('isAuthenticated', false)}
|
||||
groupSummary={parse('groupSummary')}
|
||||
comments={parse('comments', [])}
|
||||
/>,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user