Skip to content

feat: share an album from the desktop app - #1473

Merged
rohan-pandeyy merged 9 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/share-frontend
Aug 7, 2026
Merged

feat: share an album from the desktop app#1473
rohan-pandeyy merged 9 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/share-frontend

Conversation

@rohan-pandeyy

@rohan-pandeyy rohan-pandeyy commented Aug 7, 2026

Copy link
Copy Markdown
Member

Part of #1468

Adds the desktop side of album sharing, following the backend in #1469 and the password in #1471. An album can now be shared from its card, and the dialog hands back a QR code and a link to open on another device.

Sharing is offered from the album card's menu, and a shared album is ringed and badged in the grid so what is currently reachable on the network is visible without opening anything. The dialog asks for how long to keep sharing and whether to require a password, then shows the QR code, the link, and the addresses the share can be reached on. Reopening a shared album goes straight to that view, where the share can also be stopped.

Machines with more than one usable address get a picker, and the QR code follows the selection. Which address a phone can actually reach depends on the network rather than on anything the host can detect, so the choice belongs to the person sharing. The backend already ranks the candidates, so the first one is selected by default.

Active shares are read through react-query rather than a Redux slice. They exist only in the backend's memory, so the query is the record of them; a slice would have been a second source of truth for the same data. Redux stays where the rest of the codebase puts it, on UI state.

Not included

The backend counts no views and no downloads, and has no downloads toggle, so none of that is shown. A separate management dashboard is also left out for now: minus those figures it would be a list of shares with copy, QR and stop, which is what this dialog already does per album.

Dependency

One addition, qrcode.react, to render the link as a scannable code. Generating it on the desktop side keeps the backend free of another dependency.

Testing

Eight new tests covering creating a share with and without a password, rejecting a password the backend would refuse, switching addresses, and revoking, with the full suite at 359 passing. The album page's own tests needed the new query mocked.

Summary by CodeRabbit

  • New Features

    • Added local-network album sharing with optional expiration and password protection.
    • Display shareable links and QR codes, with options to copy links, switch network addresses, and revoke access.
    • Album cards now show active sharing status and provide Share or Manage Share actions.
    • Added validation and feedback for invalid settings or unavailable network addresses.
  • Tests

    • Added coverage for creating, managing, switching, and revoking album shares.

The only way to render a scannable link without a network round trip, and QR
generation was deliberately kept off the Python side.
Types mirror the Pydantic models in backend/app/schemas/share.py, which is the
source of truth for the response shape.
Configures expiry and an optional password, then shows the QR code, the link
and every address the share can be reached on. Machines with more than one
interface get a picker, because which address a phone can reach depends on the
network rather than on anything we can detect.
A shared album is ringed and badged, so what is currently reachable on the
network is visible without opening anything.
The single column grew taller than the window, which put the buttons out of
reach. The QR code, link and share details sit left, the address list and
actions right, with the addresses capped and scrolling on their own.
DialogContent also gains a height cap, since nothing bounded it before.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ed861dee-b4e1-47ca-9fe0-ae3a369c44d5

📥 Commits

Reviewing files that changed from the base of the PR and between 4543e45 and d90de1f.

📒 Files selected for processing (4)
  • frontend/src/components/Albums/ShareAlbumDialog.tsx
  • frontend/src/components/Albums/__tests__/ShareAlbumDialog.test.tsx
  • frontend/src/pages/Album/Album.tsx
  • frontend/src/types/Share.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • frontend/src/pages/Album/Album.tsx
  • frontend/src/types/Share.ts
  • frontend/src/components/Albums/ShareAlbumDialog.tsx
  • frontend/src/components/Albums/tests/ShareAlbumDialog.test.tsx

Walkthrough

The frontend adds local-network album sharing. It includes share API wrappers, a QR-enabled share dialog, album-card sharing status, share creation and revocation controls, and tests for the new behavior.

Changes

Album sharing

Layer / File(s) Summary
Share API contracts and routes
frontend/src/types/Share.ts, frontend/src/api/apiEndpoints.ts, frontend/src/api/api-functions/share.ts, frontend/src/api/api-functions/index.ts, frontend/package.json
The frontend defines share data types and adds API routes and wrappers for listing, creating, and revoking shares. It also adds qrcode.react.
Share dialog behavior
frontend/src/components/Albums/ShareAlbumDialog.tsx, frontend/src/components/Albums/__tests__/ShareAlbumDialog.test.tsx
ShareAlbumDialog supports expiry, password validation, QR and link display, network-address selection, clipboard copying, revocation, loading states, and error feedback. Tests cover these flows.
Albums page integration
frontend/src/types/Album.ts, frontend/src/components/Albums/AlbumCard.tsx, frontend/src/pages/Album/Album.tsx, frontend/src/pages/__tests__/Album.test.tsx
Album cards expose sharing actions and status. The Albums page loads active shares, groups multiple shares by album, opens the dialog, and refreshes share state after changes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AlbumPage
  participant ShareAlbumDialog
  participant shareFunctions
  participant Backend
  AlbumPage->>shareFunctions: Load active shares
  shareFunctions->>Backend: Request share list
  Backend-->>shareFunctions: Return shares
  shareFunctions-->>AlbumPage: Provide sharing status
  AlbumPage->>ShareAlbumDialog: Open selected album
  ShareAlbumDialog->>shareFunctions: Create or revoke share
  shareFunctions->>Backend: Update album share
  Backend-->>shareFunctions: Return share result
  shareFunctions-->>ShareAlbumDialog: Update dialog
  ShareAlbumDialog-->>AlbumPage: Notify share change
Loading

Possibly related PRs

Suggested labels: TypeScript/JavaScript

Poem

A rabbit opens albums bright,
And shares them on the local night.
A QR code shows the way,
While passwords guard the display.
Click “Manage Share” to end the stream—
Then close the dialog and dream.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding album sharing to the desktop app.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@socket-security

socket-security Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​qrcode.react@​4.2.010010010080100

View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/components/Albums/AlbumCard.tsx (1)

68-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the redundant comment.

Line 68 only repeats the condition below it. Remove the comment.

As per coding guidelines, “Write short comments that explain why rather than what.” As per path instructions, “Point out redundant obvious comments that do not add clarity to the code.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/components/Albums/AlbumCard.tsx` at line 68, Remove the
redundant “Sharing Badge” comment immediately preceding the sharing badge
condition in AlbumCard; leave the condition and its rendering behavior
unchanged.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/Album/Album.tsx`:
- Around line 117-124: Update the sharesByAlbum handling in Album so multiple
active shares for the same album are preserved rather than reduced to one token.
Pass all shares into the share-management/revocation flow, or make creation
idempotent per album, and add an integration test covering two active shares
that verifies both are revoked and the album is no longer shared.

---

Nitpick comments:
In `@frontend/src/components/Albums/AlbumCard.tsx`:
- Line 68: Remove the redundant “Sharing Badge” comment immediately preceding
the sharing badge condition in AlbumCard; leave the condition and its rendering
behavior unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cb38391-247a-4155-8e45-b7a3e4a64563

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6143d and 4543e45.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • frontend/package.json
  • frontend/src/api/api-functions/index.ts
  • frontend/src/api/api-functions/share.ts
  • frontend/src/api/apiEndpoints.ts
  • frontend/src/components/Albums/AlbumCard.tsx
  • frontend/src/components/Albums/ShareAlbumDialog.tsx
  • frontend/src/components/Albums/__tests__/ShareAlbumDialog.test.tsx
  • frontend/src/pages/Album/Album.tsx
  • frontend/src/pages/__tests__/Album.test.tsx
  • frontend/src/types/Album.ts
  • frontend/src/types/Share.ts

Comment thread frontend/src/pages/Album/Album.tsx Outdated
Creating a share leaves earlier ones valid, so the page kept one token per
album and dropped the rest. Stopping then reported the album was off the
network while another token still served it.
@rohan-pandeyy
rohan-pandeyy merged commit 126ae17 into AOSSIE-Org:main Aug 7, 2026
12 checks passed
@rohan-pandeyy rohan-pandeyy linked an issue Aug 7, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Share an album over the local network

1 participant