|
|
|
@ -45,7 +45,8 @@ |
|
|
|
// Lookup state |
|
|
|
// Lookup state |
|
|
|
let lookupLoading = $state<{ [key: string]: boolean }>({}); |
|
|
|
let lookupLoading = $state<{ [key: string]: boolean }>({}); |
|
|
|
let lookupError = $state<{ [key: string]: string | null }>({}); |
|
|
|
let lookupError = $state<{ [key: string]: string | null }>({}); |
|
|
|
let lookupResults = $state<{ [key: string]: any }>({}); |
|
|
|
type ProfileData = { pubkey: string; npub: string; name?: string; about?: string; picture?: string }; |
|
|
|
|
|
|
|
let lookupResults = $state<{ [key: string]: Array<ProfileData | NostrEvent> | null }>({}); |
|
|
|
|
|
|
|
|
|
|
|
import { DEFAULT_NOSTR_RELAYS, DEFAULT_NOSTR_SEARCH_RELAYS, combineRelays } from '../../lib/config.js'; |
|
|
|
import { DEFAULT_NOSTR_RELAYS, DEFAULT_NOSTR_SEARCH_RELAYS, combineRelays } from '../../lib/config.js'; |
|
|
|
|
|
|
|
|
|
|
|
@ -434,7 +435,13 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
let profileData: any = { |
|
|
|
let profileData: { |
|
|
|
|
|
|
|
pubkey: string; |
|
|
|
|
|
|
|
npub: string; |
|
|
|
|
|
|
|
name?: string; |
|
|
|
|
|
|
|
about?: string; |
|
|
|
|
|
|
|
picture?: string; |
|
|
|
|
|
|
|
} = { |
|
|
|
pubkey, |
|
|
|
pubkey, |
|
|
|
npub: query.startsWith('npub') ? query : nip19.npubEncode(pubkey) |
|
|
|
npub: query.startsWith('npub') ? query : nip19.npubEncode(pubkey) |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -1212,24 +1219,26 @@ |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{#each lookupResults['repo-existingRepoRef'] as result} |
|
|
|
{#each (lookupResults['repo-existingRepoRef'] || []) as result} |
|
|
|
{@const nameTag = result.tags.find((t: string[]) => t[0] === 'name')?.[1]} |
|
|
|
{#if 'tags' in result} |
|
|
|
{@const dTag = result.tags.find((t: string[]) => t[0] === 'd')?.[1]} |
|
|
|
{@const event = result as NostrEvent} |
|
|
|
{@const descTag = result.tags.find((t: string[]) => t[0] === 'description')?.[1]} |
|
|
|
{@const nameTag = event.tags.find((t: string[]) => t[0] === 'name')?.[1]} |
|
|
|
{@const imageTag = result.tags.find((t: string[]) => t[0] === 'image')?.[1]} |
|
|
|
{@const dTag = event.tags.find((t: string[]) => t[0] === 'd')?.[1]} |
|
|
|
{@const ownerNpub = nip19.npubEncode(result.pubkey)} |
|
|
|
{@const descTag = event.tags.find((t: string[]) => t[0] === 'description')?.[1]} |
|
|
|
{@const tags = result.tags.filter((t: string[]) => t[0] === 't' && t[1] && t[1] !== 'private' && t[1] !== 'fork').map((t: string[]) => t[1])} |
|
|
|
{@const imageTag = event.tags.find((t: string[]) => t[0] === 'image')?.[1]} |
|
|
|
<div |
|
|
|
{@const ownerNpub = nip19.npubEncode(event.pubkey)} |
|
|
|
class="lookup-result-item repo-result" |
|
|
|
{@const tags = event.tags.filter((t: string[]) => t[0] === 't' && t[1] && t[1] !== 'private' && t[1] !== 'fork').map((t: string[]) => t[1])} |
|
|
|
role="button" |
|
|
|
<div |
|
|
|
tabindex="0" |
|
|
|
class="lookup-result-item repo-result" |
|
|
|
onclick={() => selectRepoResult(result, 'existingRepoRef')} |
|
|
|
role="button" |
|
|
|
onkeydown={(e) => { |
|
|
|
tabindex="0" |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
onclick={() => selectRepoResult(event, 'existingRepoRef')} |
|
|
|
e.preventDefault(); |
|
|
|
onkeydown={(e) => { |
|
|
|
selectRepoResult(result, 'existingRepoRef'); |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
} |
|
|
|
e.preventDefault(); |
|
|
|
}} |
|
|
|
selectRepoResult(event, 'existingRepoRef'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="result-header"> |
|
|
|
<div class="result-header"> |
|
|
|
{#if imageTag} |
|
|
|
{#if imageTag} |
|
|
|
@ -1245,7 +1254,7 @@ |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
<div class="result-meta"> |
|
|
|
<div class="result-meta"> |
|
|
|
<small>Owner: {ownerNpub.slice(0, 16)}...</small> |
|
|
|
<small>Owner: {ownerNpub.slice(0, 16)}...</small> |
|
|
|
<small>Event: {result.id.slice(0, 16)}...</small> |
|
|
|
<small>Event: {event.id.slice(0, 16)}...</small> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{#if tags.length > 0} |
|
|
|
{#if tags.length > 0} |
|
|
|
<div class="result-tags"> |
|
|
|
<div class="result-tags"> |
|
|
|
@ -1257,6 +1266,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
{/if} |
|
|
|
{/each} |
|
|
|
{/each} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
@ -1435,7 +1445,7 @@ |
|
|
|
{#if lookupResults[`npub-maintainers-${index}`]} |
|
|
|
{#if lookupResults[`npub-maintainers-${index}`]} |
|
|
|
<div class="lookup-results"> |
|
|
|
<div class="lookup-results"> |
|
|
|
<div class="lookup-results-header"> |
|
|
|
<div class="lookup-results-header"> |
|
|
|
<span>Found {lookupResults[`npub-maintainers-${index}`].length} profile(s):</span> |
|
|
|
<span>Found {(lookupResults[`npub-maintainers-${index}`] || []).length} profile(s):</span> |
|
|
|
<button |
|
|
|
<button |
|
|
|
type="button" |
|
|
|
type="button" |
|
|
|
onclick={() => clearLookupResults(`npub-maintainers-${index}`)} |
|
|
|
onclick={() => clearLookupResults(`npub-maintainers-${index}`)} |
|
|
|
@ -1445,36 +1455,39 @@ |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{#each lookupResults[`npub-maintainers-${index}`] as result} |
|
|
|
{#each (lookupResults[`npub-maintainers-${index}`] || []) as result} |
|
|
|
<div |
|
|
|
{#if 'npub' in result} |
|
|
|
class="lookup-result-item profile-result" |
|
|
|
{@const profile = result as ProfileData} |
|
|
|
role="button" |
|
|
|
<div |
|
|
|
tabindex="0" |
|
|
|
class="lookup-result-item profile-result" |
|
|
|
onclick={() => selectNpubResult(result, 'maintainers', index)} |
|
|
|
role="button" |
|
|
|
onkeydown={(e) => { |
|
|
|
tabindex="0" |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
onclick={() => selectNpubResult(profile, 'maintainers', index)} |
|
|
|
e.preventDefault(); |
|
|
|
onkeydown={(e) => { |
|
|
|
selectNpubResult(result, 'maintainers', index); |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
} |
|
|
|
e.preventDefault(); |
|
|
|
}} |
|
|
|
selectNpubResult(profile, 'maintainers', index); |
|
|
|
> |
|
|
|
} |
|
|
|
<div class="result-header"> |
|
|
|
}} |
|
|
|
{#if result.picture} |
|
|
|
> |
|
|
|
<img src={result.picture} alt="" class="result-avatar" /> |
|
|
|
<div class="result-header"> |
|
|
|
{:else} |
|
|
|
{#if profile.picture} |
|
|
|
<div class="result-avatar-placeholder"> |
|
|
|
<img src={profile.picture} alt="" class="result-avatar" /> |
|
|
|
{(result.name || result.npub).slice(0, 2).toUpperCase()} |
|
|
|
{:else} |
|
|
|
</div> |
|
|
|
<div class="result-avatar-placeholder"> |
|
|
|
{/if} |
|
|
|
{(profile.name || profile.npub).slice(0, 2).toUpperCase()} |
|
|
|
<div class="result-info"> |
|
|
|
</div> |
|
|
|
<strong>{result.name || 'Unknown'}</strong> |
|
|
|
|
|
|
|
{#if result.about} |
|
|
|
|
|
|
|
<p class="result-description">{result.about}</p> |
|
|
|
|
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
<small class="npub-display">{result.npub}</small> |
|
|
|
<div class="result-info"> |
|
|
|
|
|
|
|
<strong>{profile.name || 'Unknown'}</strong> |
|
|
|
|
|
|
|
{#if profile.about} |
|
|
|
|
|
|
|
<p class="result-description">{profile.about}</p> |
|
|
|
|
|
|
|
{/if} |
|
|
|
|
|
|
|
<small class="npub-display">{profile.npub}</small> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
{/each} |
|
|
|
{/each} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
@ -1750,24 +1763,26 @@ |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
<img src="/icons/x.svg" alt="Clear" class="icon-small" /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{#each lookupResults['repo-forkOriginalRepo'] as result} |
|
|
|
{#each (lookupResults['repo-forkOriginalRepo'] || []) as result} |
|
|
|
{@const nameTag = result.tags.find((t: string[]) => t[0] === 'name')?.[1]} |
|
|
|
{#if 'tags' in result} |
|
|
|
{@const dTag = result.tags.find((t: string[]) => t[0] === 'd')?.[1]} |
|
|
|
{@const event = result as NostrEvent} |
|
|
|
{@const descTag = result.tags.find((t: string[]) => t[0] === 'description')?.[1]} |
|
|
|
{@const nameTag = event.tags.find((t: string[]) => t[0] === 'name')?.[1]} |
|
|
|
{@const imageTag = result.tags.find((t: string[]) => t[0] === 'image')?.[1]} |
|
|
|
{@const dTag = event.tags.find((t: string[]) => t[0] === 'd')?.[1]} |
|
|
|
{@const ownerNpub = nip19.npubEncode(result.pubkey)} |
|
|
|
{@const descTag = event.tags.find((t: string[]) => t[0] === 'description')?.[1]} |
|
|
|
{@const tags = result.tags.filter((t: string[]) => t[0] === 't' && t[1] && t[1] !== 'private' && t[1] !== 'fork').map((t: string[]) => t[1])} |
|
|
|
{@const imageTag = event.tags.find((t: string[]) => t[0] === 'image')?.[1]} |
|
|
|
<div |
|
|
|
{@const ownerNpub = nip19.npubEncode(event.pubkey)} |
|
|
|
class="lookup-result-item repo-result" |
|
|
|
{@const tags = event.tags.filter((t: string[]) => t[0] === 't' && t[1] && t[1] !== 'private' && t[1] !== 'fork').map((t: string[]) => t[1])} |
|
|
|
role="button" |
|
|
|
<div |
|
|
|
tabindex="0" |
|
|
|
class="lookup-result-item repo-result" |
|
|
|
onclick={() => selectRepoResult(result, 'forkOriginalRepo')} |
|
|
|
role="button" |
|
|
|
onkeydown={(e) => { |
|
|
|
tabindex="0" |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
onclick={() => selectRepoResult(event, 'forkOriginalRepo')} |
|
|
|
e.preventDefault(); |
|
|
|
onkeydown={(e) => { |
|
|
|
selectRepoResult(result, 'forkOriginalRepo'); |
|
|
|
if (e.key === 'Enter' || e.key === ' ') { |
|
|
|
} |
|
|
|
e.preventDefault(); |
|
|
|
}} |
|
|
|
selectRepoResult(event, 'forkOriginalRepo'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="result-header"> |
|
|
|
<div class="result-header"> |
|
|
|
{#if imageTag} |
|
|
|
{#if imageTag} |
|
|
|
@ -1783,7 +1798,7 @@ |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
<div class="result-meta"> |
|
|
|
<div class="result-meta"> |
|
|
|
<small>Owner: {ownerNpub.slice(0, 16)}...</small> |
|
|
|
<small>Owner: {ownerNpub.slice(0, 16)}...</small> |
|
|
|
<small>Event: {result.id.slice(0, 16)}...</small> |
|
|
|
<small>Event: {event.id.slice(0, 16)}...</small> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{#if tags.length > 0} |
|
|
|
{#if tags.length > 0} |
|
|
|
<div class="result-tags"> |
|
|
|
<div class="result-tags"> |
|
|
|
@ -1795,6 +1810,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
{/if} |
|
|
|
{/each} |
|
|
|
{/each} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
|