diff --git a/src/components/RepositoryCard.tsx b/src/components/RepositoryCard.tsx index 27a86a3c..87165897 100644 --- a/src/components/RepositoryCard.tsx +++ b/src/components/RepositoryCard.tsx @@ -8,6 +8,7 @@ import { useAuthor } from '@/hooks/useAuthor'; import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar'; import { genUserName } from '@/lib/genUserName'; import { useNavigate } from 'react-router-dom'; +import { nip19 } from 'nostr-tools'; interface RepositoryCardProps { repo: Repository; @@ -20,14 +21,12 @@ export function RepositoryCard({ repo }: RepositoryCardProps) { const displayName = authorData?.metadata?.name || genUserName(repo.pubkey); const profileImage = authorData?.metadata?.picture; - // Get the first clone URL (prefer HTTPS) - const primaryCloneUrl = repo.cloneUrls.find(url => url.startsWith('https://')) || repo.cloneUrls[0]; + // Construct Nostr clone URL + const nostrCloneUrl = `nostr://${nip19.npubEncode(repo.pubkey)}/${repo.repoId}`; const handleClone = () => { - if (primaryCloneUrl) { - // Navigate to clone page with URL parameter - navigate(`/clone?url=${encodeURIComponent(primaryCloneUrl)}`); - } + // Navigate to clone page with Nostr URL parameter + navigate(`/clone?url=${encodeURIComponent(nostrCloneUrl)}`); }; return ( @@ -85,16 +84,14 @@ export function RepositoryCard({ repo }: RepositoryCardProps) { {/* Actions */}
- {primaryCloneUrl && ( - - )} +