From 8b7ed4107e6b3b40eb8fa3d3fb82547ebefa7e25 Mon Sep 17 00:00:00 2001 From: dame Date: Tue, 23 Jun 2026 10:50:05 -0400 Subject: [PATCH] Offer the Edit button to logged-out collection visitors (#38) Previously the bulk-edit affordance was hidden unless you were signed in as the repo owner. Show the Edit button to logged-out visitors too: pressing it reveals a sign-in prompt prefilled with this repo's handle (reusing SignInPanel, the same flow the record page uses), so the owner can sign in and start managing their records in two clicks. It stays hidden for anyone signed in as a different account, since they can't delete records here anyway. Claude-Session: https://claude.ai/code/session_01CChtUyq4nnHgTAS7BqKWxV Co-authored-by: Claude --- src/components/explore/CollectionExplorer.tsx | 65 +++++++++++++++---- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/src/components/explore/CollectionExplorer.tsx b/src/components/explore/CollectionExplorer.tsx index 80ad498..1bcbec6 100644 --- a/src/components/explore/CollectionExplorer.tsx +++ b/src/components/explore/CollectionExplorer.tsx @@ -16,6 +16,7 @@ import { import AppearIn from './AppearIn'; import Breadcrumb from './Breadcrumb'; import NotFoundPanel from '@/components/NotFoundPanel'; +import SignInPanel from './SignInPanel'; import { useAtprotoSession } from '@/components/AtprotoSessionProvider'; type Props = { @@ -91,23 +92,30 @@ function CollectionList({ collection: string; }) { const router = useRouter(); - const { agent, did: signedInDid } = useAtprotoSession(); + const { agent, did: signedInDid, session, loading: sessionLoading } = useAtprotoSession(); const [records, setRecords] = useState([]); const [cursor, setCursor] = useState(undefined); const [done, setDone] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [live, setLive] = useState(false); - - // Selection / bulk-delete mode. Records can only be deleted from your own - // repository, so the whole affordance is gated on the signed-in user owning - // this repo — mirrors how the single-record view gates its "Edit record". - const canEdit = Boolean(agent && signedInDid && signedInDid === identity.did); const [editing, setEditing] = useState(false); const [selected, setSelected] = useState>(new Set()); const [confirmingDelete, setConfirmingDelete] = useState(false); const [deleting, setDeleting] = useState(false); const [deleteError, setDeleteError] = useState(null); + const [signInOpen, setSignInOpen] = useState(false); + + // Records can only be deleted from your own repository, so selection mode is + // gated on the signed-in user owning this repo. The Edit button itself is + // also offered to logged-out visitors though: pressing it reveals a sign-in + // prompt prefilled with this repo's handle (mirrors the record page) so the + // owner can sign in and start managing in two clicks. We hide it only from + // someone signed in as a *different* account — they can't edit here. + const canEdit = Boolean(agent && signedInDid && signedInDid === identity.did); + const loggedOut = !session && !sessionLoading; + const showEditButton = canEdit || loggedOut; + const editActive = editing || signInOpen; const loadPage = useCallback( async (after: string | undefined) => { @@ -271,23 +279,37 @@ function CollectionList({
- {canEdit && ( + {showEditButton && (
)} + {signInOpen && !session && ( +
+

+ Sign in as{' '} + {identity.handle ? `@${identity.handle}` : identity.did} to + select and delete your own records. +

+ +
+ )} {editing && deleteError && (

{deleteError} -- 2.51.2