Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Oct 8, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Share button on Cap cards is now visible only to owners, preventing non-owners from seeing or attempting to share. Functionality for owners remains unchanged.
  • Style
    • Simplified the Cap card UI for non-owners by removing the irrelevant Share option, reducing clutter and potential confusion.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

CapCard.tsx now renders the Share button only when isOwner is true. The previously unconditional Share CapCardButton is wrapped in a conditional block. No changes to the Share action handler or exports.

Changes

Cohort / File(s) Summary
CapCard owner-gated share
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
Wrapped the Share button in a conditional check for isOwner; removed unconditional rendering of the Share CapCardButton. No export/public API changes.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CapCard as CapCard (UI)
    participant Permissions as isOwner flag

    User->>CapCard: Open card
    CapCard->>Permissions: Check isOwner
    alt Owner
        CapCard-->>User: Render Share button
        User->>CapCard: Click Share
        CapCard-->>User: Trigger existing Share action
    else Not owner
        CapCard-->>User: Share button not rendered
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A bunny taps the UI pane,
Hides the share from public lane.
Owners wink—“now you may share,”
Others browse with tidy care.
Little paws commit the guard,
Carrots earned for checks not hard. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately and concisely summarizes the core change of rendering the Share button only for owners in CapCard.tsx, reflecting the main update without unnecessary detail or ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch share-button-owners

📜 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 696a695 and c36b5a0.

📒 Files selected for processing (1)
  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and data fetching in the web app
Web mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData rather than broad invalidations
Client code should use useEffectQuery/useEffectMutation and useRpcClient from apps/web/lib/EffectRuntime.ts; do not create ManagedRuntime inside components

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
apps/web/app/**/*.{tsx,ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Prefer Server Components for initial data in the Next.js App Router and pass initialData to client components

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx,js,jsx,rs}

📄 CodeRabbit inference engine (CLAUDE.md)

Do not add inline, block, or docstring comments in any language; code must be self-explanatory

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use strict TypeScript and avoid any; leverage shared types from packages

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
🧬 Code graph analysis (1)
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (1)
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButton.tsx (1)
  • CapCardButton (18-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (1)

352-362: LGTM! Share button correctly restricted to owners.

The conditional rendering logic is correct and follows the existing pattern in the codebase (similar to the owner-only dropdown at line 422). Non-owners retain access to the "Copy link" button (lines 374-420), ensuring they can still share cap URLs while ownership-specific sharing features remain protected.


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.

@ameer2468 ameer2468 merged commit 2169b42 into main Oct 8, 2025
13 of 15 checks passed
@ameer2468 ameer2468 deleted the share-button-owners branch October 8, 2025 09:32
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