Skip to content

Conversation

@ibex088
Copy link

@ibex088 ibex088 commented Jan 16, 2026

what does this pr do

This PR adds per-cap management controls directly to the Share page header (/s/[videoId]) for cap owners. Previously, these actions were only available from the dashboard card dropdown. This improves usability by letting owners manage their cap without leaving the share page.

fixes #1526
fixes CAP-607

Greptile Summary

Added per-cap management controls to the Share page header, bringing Settings, Analytics, Download, Duplicate, Password, and Delete actions directly to the /s/[videoId] page for cap owners. Previously these controls were only accessible from the dashboard card dropdown.

Key changes:

  • Created new CapOptionsDropdown component mirroring the dashboard card dropdown functionality
  • Replaced single analytics button in ShareHeader with comprehensive dropdown menu (owner-only)
  • Extended SettingsDialog to work outside dashboard context by accepting optional isPro prop with fallback logic
  • Threaded videoSettings data from page through to header for settings dialog

Implementation details:

  • Follows established patterns from CapCard.tsx dropdown implementation
  • Uses Effect-based RPC client for video operations (download, duplicate, delete)
  • Proper owner validation prevents showing controls to non-owners
  • After delete, redirects user to /dashboard/caps (consistent with dashboard behavior)
  • Integrates existing dialogs: SettingsDialog, PasswordDialog, ConfirmationDialog

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The implementation follows existing patterns from the dashboard card dropdown, reuses established components and utilities, includes proper owner validation and Pro feature gating, and introduces no breaking changes. All new code is well-structured and consistent with the codebase conventions.
  • No files require special attention

Important Files Changed

Filename Overview
apps/web/app/s/[videoId]/_components/CapOptionsDropdown.tsx New component implementing cap management dropdown menu with settings, analytics, download, duplicate, password, and delete actions - clean implementation following existing patterns
apps/web/app/s/[videoId]/_components/ShareHeader.tsx Integrated CapOptionsDropdown into header, replacing single analytics button with comprehensive options menu - proper prop threading and owner validation
apps/web/app/s/[videoId]/page.tsx Added videoSettings prop to ShareHeader - simple one-line passthrough of existing data
apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx Added optional isPro prop with fallback logic to support usage outside dashboard context - maintains backward compatibility

Sequence Diagram

sequenceDiagram
    participant User
    participant ShareHeader
    participant CapOptionsDropdown
    participant SettingsDialog
    participant PasswordDialog
    participant ConfirmationDialog
    participant RPC
    participant Router

    User->>ShareHeader: View cap share page
    ShareHeader->>ShareHeader: Check if user is owner
    alt User is owner
        ShareHeader->>CapOptionsDropdown: Render dropdown with owner controls
        User->>CapOptionsDropdown: Click options button
        CapOptionsDropdown->>User: Show dropdown menu
        
        alt Settings action
            User->>CapOptionsDropdown: Click Settings
            CapOptionsDropdown->>SettingsDialog: Open dialog with isPro flag
            SettingsDialog->>User: Show settings options
            User->>SettingsDialog: Modify settings
            SettingsDialog->>RPC: updateVideoSettings()
            RPC-->>SettingsDialog: Success
            SettingsDialog->>Router: refresh()
        end
        
        alt Analytics action
            User->>CapOptionsDropdown: Click View analytics
            CapOptionsDropdown->>Router: Navigate to analytics page
        end
        
        alt Download action
            User->>CapOptionsDropdown: Click Download
            CapOptionsDropdown->>RPC: VideoGetDownloadInfo()
            RPC-->>CapOptionsDropdown: Download URL
            CapOptionsDropdown->>User: Trigger file download
        end
        
        alt Duplicate action
            User->>CapOptionsDropdown: Click Duplicate
            CapOptionsDropdown->>RPC: VideoDuplicate()
            RPC-->>CapOptionsDropdown: Success
            CapOptionsDropdown->>Router: refresh()
        end
        
        alt Password action
            User->>CapOptionsDropdown: Click Add/Edit password
            alt User is not Pro
                CapOptionsDropdown->>User: Show upgrade modal
            else User is Pro
                CapOptionsDropdown->>PasswordDialog: Open dialog
                PasswordDialog->>User: Manage password
                PasswordDialog->>RPC: Update password
                RPC-->>PasswordDialog: Success
                PasswordDialog->>Router: refresh()
            end
        end
        
        alt Delete action
            User->>CapOptionsDropdown: Click Delete Cap
            CapOptionsDropdown->>ConfirmationDialog: Show confirmation
            User->>ConfirmationDialog: Confirm deletion
            ConfirmationDialog->>RPC: VideoDelete()
            RPC-->>ConfirmationDialog: Success
            ConfirmationDialog->>Router: Navigate to dashboard
        end
    end
Loading

…ctions

Add comprehensive options dropdown to share page header with settings dialog, password protection, analytics, download, duplicate, and delete actions. Pass isPro prop to SettingsDialog to support non-owner pro users viewing owner settings.
@ibex088 ibex088 marked this pull request as ready for review January 18, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Cap Controls menu on Cap view page

1 participant