243 lines
6.7 KiB
YAML
243 lines
6.7 KiB
YAML
task_id: task_create_component_share_button
|
|
entity_id: component_share_button
|
|
generated_at: '2025-12-18T18:15:12.913944'
|
|
workflow_version: v004
|
|
target:
|
|
type: component
|
|
definition:
|
|
id: component_share_button
|
|
name: ShareButton
|
|
description: Button component to trigger share modal
|
|
file_path: components/ShareButton.tsx
|
|
props:
|
|
- name: type
|
|
type: '''song'' | ''playlist'' | ''album'''
|
|
required: true
|
|
description: Type of content to share
|
|
- name: targetId
|
|
type: string
|
|
required: true
|
|
description: ID of the content to share
|
|
- name: title
|
|
type: string
|
|
required: true
|
|
description: Title to display in share modal
|
|
- name: className
|
|
type: string
|
|
required: false
|
|
description: Additional CSS classes
|
|
state:
|
|
- name: isModalOpen
|
|
type: boolean
|
|
description: Controls share modal visibility
|
|
- name: shareUrl
|
|
type: string | null
|
|
description: Generated share URL after creation
|
|
- name: isLoading
|
|
type: boolean
|
|
description: Share link generation in progress
|
|
events:
|
|
- name: onShare
|
|
payload: '{ shareUrl: string, token: string }'
|
|
description: Fired when share link is successfully generated
|
|
uses_components:
|
|
- component_share_modal
|
|
uses_apis:
|
|
- api_create_song_share
|
|
- api_create_playlist_share
|
|
- api_create_album_share
|
|
styling:
|
|
- Accessible button with share icon
|
|
- Loading state during share generation
|
|
- Error state if share creation fails
|
|
related:
|
|
models: []
|
|
apis:
|
|
- id: api_create_playlist_share
|
|
definition: &id001
|
|
id: api_create_playlist_share
|
|
method: POST
|
|
path: /api/share/playlist/[id]
|
|
description: Generate share link for a playlist
|
|
auth:
|
|
required: false
|
|
request_params:
|
|
- name: id
|
|
type: string
|
|
location: path
|
|
required: true
|
|
description: Playlist ID to generate share link for
|
|
request_body:
|
|
- name: platform
|
|
type: string
|
|
required: false
|
|
description: Platform being shared to
|
|
responses:
|
|
- status: 200
|
|
description: Share link created successfully
|
|
schema:
|
|
shareUrl: string
|
|
token: string
|
|
type: string
|
|
- status: 404
|
|
description: Playlist not found
|
|
schema:
|
|
error: string
|
|
business_logic:
|
|
- Verify playlist exists and is public
|
|
- Generate unique token
|
|
- Create Share record with type=PLAYLIST
|
|
- Return full share URL
|
|
depends_on_models:
|
|
- model_share
|
|
- id: api_create_album_share
|
|
definition: &id003
|
|
id: api_create_album_share
|
|
method: POST
|
|
path: /api/share/album/[id]
|
|
description: Generate share link for an album
|
|
auth:
|
|
required: false
|
|
request_params:
|
|
- name: id
|
|
type: string
|
|
location: path
|
|
required: true
|
|
description: Album ID to generate share link for
|
|
request_body:
|
|
- name: platform
|
|
type: string
|
|
required: false
|
|
description: Platform being shared to
|
|
responses:
|
|
- status: 200
|
|
description: Share link created successfully
|
|
schema:
|
|
shareUrl: string
|
|
token: string
|
|
type: string
|
|
- status: 404
|
|
description: Album not found
|
|
schema:
|
|
error: string
|
|
business_logic:
|
|
- Verify album exists
|
|
- Generate unique token
|
|
- Create Share record with type=ALBUM
|
|
- Return full share URL
|
|
depends_on_models:
|
|
- model_share
|
|
- id: api_create_song_share
|
|
definition: &id004
|
|
id: api_create_song_share
|
|
method: POST
|
|
path: /api/share/song/[id]
|
|
description: Generate share link for a song
|
|
auth:
|
|
required: false
|
|
description: No authentication required to share content
|
|
request_params:
|
|
- name: id
|
|
type: string
|
|
location: path
|
|
required: true
|
|
description: Song ID to generate share link for
|
|
request_body:
|
|
- name: platform
|
|
type: string
|
|
required: false
|
|
description: Platform being shared to (twitter, facebook, etc)
|
|
responses:
|
|
- status: 200
|
|
description: Share link created successfully
|
|
schema:
|
|
shareUrl: string
|
|
token: string
|
|
type: string
|
|
- status: 404
|
|
description: Song not found
|
|
schema:
|
|
error: string
|
|
business_logic:
|
|
- Verify song exists and is public
|
|
- Generate unique 10-character alphanumeric token
|
|
- Create Share record with type=SONG
|
|
- Return full share URL (https://domain.com/s/[token])
|
|
depends_on_models:
|
|
- model_share
|
|
components:
|
|
- id: component_share_modal
|
|
definition: &id002
|
|
id: component_share_modal
|
|
name: ShareModal
|
|
description: Modal displaying share options and social buttons
|
|
file_path: components/ShareModal.tsx
|
|
props:
|
|
- name: isOpen
|
|
type: boolean
|
|
required: true
|
|
description: Controls modal visibility
|
|
- name: onClose
|
|
type: () => void
|
|
required: true
|
|
description: Callback to close modal
|
|
- name: shareUrl
|
|
type: string
|
|
required: true
|
|
description: The share URL to display and copy
|
|
- name: title
|
|
type: string
|
|
required: true
|
|
description: Title of content being shared
|
|
- name: type
|
|
type: '''song'' | ''playlist'' | ''album'''
|
|
required: true
|
|
description: Type of content for display context
|
|
state:
|
|
- name: copied
|
|
type: boolean
|
|
description: Shows copied confirmation after clipboard copy
|
|
events:
|
|
- name: onCopy
|
|
payload: null
|
|
description: Fired when user copies link to clipboard
|
|
uses_components:
|
|
- component_social_share_buttons
|
|
uses_apis: []
|
|
styling:
|
|
- Centered modal with backdrop
|
|
- Copy to clipboard button with icon
|
|
- Success message after copy
|
|
- Close button
|
|
- Responsive design for mobile
|
|
dependencies:
|
|
entity_ids:
|
|
- api_create_playlist_share
|
|
- component_share_modal
|
|
- api_create_album_share
|
|
- api_create_song_share
|
|
definitions:
|
|
- id: api_create_playlist_share
|
|
type: api
|
|
definition: *id001
|
|
- id: component_share_modal
|
|
type: component
|
|
definition: *id002
|
|
- id: api_create_album_share
|
|
type: api
|
|
definition: *id003
|
|
- id: api_create_song_share
|
|
type: api
|
|
definition: *id004
|
|
files:
|
|
to_create:
|
|
- app/components/ShareButton.tsx
|
|
reference: []
|
|
acceptance:
|
|
- criterion: Component renders without errors
|
|
verification: Import and render in test
|
|
- criterion: Props are typed correctly
|
|
verification: TypeScript compilation
|
|
- criterion: Events fire correctly
|
|
verification: Test event handlers
|