Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Sep 10, 2025

This PR:

  • Fixes deleting caps within folders
  • On duplicate you had to refresh page to see the duplicated videos.
  • Minor optimisation for Cap cards rendering.

Summary by CodeRabbit

  • New Features

    • Delete a single video directly from its card when no items are selected.
    • After duplicating a cap, the page now refreshes automatically to show the new copy.
  • Bug Fixes

    • The currently uploading video is hidden from lists to prevent duplication and confusion.
  • UI/UX

    • Bulk delete messages now reflect the exact number of items and proper singular/plural.
    • Clear success/error toasts for single and bulk deletes.
    • Selection and deletion states are accurately reflected across cards and the selection bar.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces memoized filtering to hide the currently uploading video in lists, adjusts deletion to support both bulk and single-item flows with updated mutation wiring, and refreshes the router after duplication. Minor text tweaks and UI checks now use the filtered list. Database file has whitespace-only comment changes.

Changes

Cohort / File(s) Summary
Dashboard video listing components
apps/web/app/(org)/dashboard/caps/Caps.tsx, apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
Add useMemo-based visibleVideos to exclude the uploading item; update rendering to use visibleVideos. FolderVideosSection: refactor bulk delete mutation, add single-item delete via withRpc, propagate combined isDeleting, refresh and clear selection on success, adjust onDelete to choose bulk vs single.
Cap duplication flow
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
After successful duplicateMutation, call router.refresh(); adjust Duplicate button handler to a block-bodied function without returning the toast.promise.
Database schema formatting
packages/database/schema.ts
Whitespace-only reflow in comment lines; no schema or API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as FolderVideosSection
  participant API as RPC
  participant Router

  rect rgba(230,245,255,0.6)
  note over UI: Delete action
  User->>UI: Click Delete
  alt Selected caps exist
    UI->>API: deleteCaps(ids[])
    API-->>UI: Success/Failure
  else Single item
    UI->>API: deleteCap(id)
    API-->>UI: Success/Failure
  end
  opt On success
    UI->>Router: refresh()
  end
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant Card as CapCard
  participant API as RPC
  participant Router

  rect rgba(240,255,240,0.6)
  note over Card: Duplicate action
  User->>Card: Click "Duplicate"
  Card->>API: duplicateMutation(capId)
  API-->>Card: Success/Failure
  opt On success
    Card->>Router: refresh()
  end
  end
Loading
sequenceDiagram
  autonumber
  participant State as State (data, isUploading, uploadingCapId)
  participant Component as Caps/FolderVideosSection

  rect rgba(255,250,230,0.6)
  note over Component: Visible list computation
  State-->>Component: inputs change
  Component->>Component: useMemo filter: exclude uploadingCapId when isUploading
  Component-->>Component: visibleVideos used for render
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A rabbit taps its tiny paws—approve! approve!
We hide the uploading cap from view to smoothly move.
One click duplicates, then pages softly refresh,
Delete one or many—clean, concise, enmesh.
Whitespace whispers in the schema’s quiet grove.
Hippity-hop, the dashboard’s set to groove. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc7023b and 98f5e88.

📒 Files selected for processing (4)
  • apps/web/app/(org)/dashboard/caps/Caps.tsx (4 hunks)
  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (2 hunks)
  • apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx (7 hunks)
  • packages/database/schema.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch minor-dashboard-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants