project-standalo-sonic-cloud/.workflow/versions/v004/contexts/page_share.yml

171 lines
4.9 KiB
YAML

task_id: task_create_page_share
entity_id: page_share
generated_at: '2025-12-18T18:15:12.911716'
workflow_version: v004
target:
type: page
definition:
id: page_share
path: /s/[token]
name: SharePage
description: Public landing page for shared music content
layout: minimal
auth:
required: false
description: Publicly accessible share page
data_needs:
- api_id: api_resolve_share
purpose: Load shared content details
on_load: true
description: Fetch content details when page loads
- api_id: api_track_share_click
purpose: Track analytics
on_load: true
description: Track that user clicked on share link
components:
- component_share_content_display
seo:
dynamic_title: true
description: Dynamic based on shared content
og_image: true
twitter_card: true
ui_states:
- state: loading
description: Fetching shared content
- state: content_loaded
description: Display shared content with CTA
- state: not_found
description: Share token invalid or content no longer available
- state: private_content
description: Content is now private
related:
models: []
apis:
- id: api_track_share_click
definition: &id002
id: api_track_share_click
method: POST
path: /api/share/[token]/click
description: Increment share click count for analytics
auth:
required: false
request_params:
- name: token
type: string
location: path
required: true
description: Share token to track click for
request_body: []
responses:
- status: 200
description: Click tracked successfully
schema:
success: boolean
clickCount: integer
- status: 404
description: Share not found
schema:
error: string
business_logic:
- Find Share record by token
- Increment clickCount by 1
- Return new click count
depends_on_models:
- model_share
- id: api_resolve_share
definition: &id003
id: api_resolve_share
method: GET
path: /api/share/[token]
description: Resolve share token and get content details
auth:
required: false
request_params:
- name: token
type: string
location: path
required: true
description: Share token to resolve
responses:
- status: 200
description: Share resolved successfully
schema:
type: string
targetId: string
content: object
shareUrl: string
- status: 404
description: Share not found or content no longer available
schema:
error: string
business_logic:
- Lookup Share record by token
- Fetch associated content based on type (Song/Playlist/Album)
- Include artist information for songs/albums
- Include song list for playlists
- Verify content is still public and available
- Return content details for display
depends_on_models:
- model_share
components:
- id: component_share_content_display
definition: &id001
id: component_share_content_display
name: SharedContentDisplay
description: Displays shared song/playlist/album with call-to-action
file_path: components/SharedContentDisplay.tsx
props:
- name: type
type: '''song'' | ''playlist'' | ''album'''
required: true
description: Type of shared content
- name: content
type: object
required: true
description: Content data (song/playlist/album with artist info)
state:
- name: isPlaying
type: boolean
description: Audio playback state (for songs)
uses_components: []
uses_apis:
- api_track_share_click
business_logic:
- Display cover art, title, artist name
- For songs: show waveform, duration, play button
- For playlists: show track count, curator
- For albums: show release date, track count
- 'Call-to-action button: "Listen on Sonic Cloud" or "Sign up to create playlists"'
styling:
- Large cover art
- Prominent title and artist
- Clean, minimal design focused on content
- Branded CTA button
- Preview player for songs (if implemented)
dependencies:
entity_ids:
- component_share_content_display
- api_track_share_click
- api_resolve_share
definitions:
- id: component_share_content_display
type: component
definition: *id001
- id: api_track_share_click
type: api
definition: *id002
- id: api_resolve_share
type: api
definition: *id003
files:
to_create:
- app/s/[token]/page.tsx
reference: []
acceptance:
- criterion: Page renders at /s/[token]
verification: Navigate to /s/[token]
- criterion: Data fetching works
verification: Check network tab
- criterion: Components render correctly
verification: Visual inspection