Improve profile search

This commit is contained in:
Jon Staab
2024-09-24 16:30:32 -07:00
parent 605273d7c7
commit cb702976ee
13 changed files with 50 additions and 36 deletions
+5 -4
View File
@@ -20,6 +20,7 @@
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import Content from "@app/components/Content.svelte"
import {REPLY, deriveEvent, displayReaction} from "@app/state"
export let event: TrustedEvent
@@ -90,7 +91,7 @@
{:else}
<div class="w-10 min-w-10 max-w-10" />
{/if}
<div class="-mt-1">
<div class="-mt-1 flex-grow pr-1">
{#if showPubkey}
<div class="flex items-center gap-2">
<strong class="text-sm" style="color: {colorValue}" data-color={colorName}
@@ -98,8 +99,8 @@
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
</div>
{/if}
<p class="text-sm">
{event.content}
<div class="text-sm">
<Content {event} />
{#if isPending}
<span class="flex-inline ml-1 gap-1">
<span class="loading loading-spinner mx-1 h-3 w-3 translate-y-px" />
@@ -113,7 +114,7 @@
<span class="opacity-50">Failed to send!</span>
</span>
{/if}
</p>
</div>
</div>
</div>
{#if $reactions.length > 0 || $zaps.length > 0}
+2 -2
View File
@@ -26,7 +26,7 @@
import ContentQuote from '@app/components/ContentQuote.svelte'
import ContentTopic from '@app/components/ContentTopic.svelte'
import ContentMention from '@app/components/ContentMention.svelte'
import {nostr} from '@app/state'
import {entityLink} from '@app/state'
export let event
export let minLength = 500
@@ -108,7 +108,7 @@
<Link
external
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={nostr(parsed.raw)}>
href={entityLink(parsed.raw)}>
{fromNostrURI(parsed.raw).slice(0, 16) + "…"}
</Link>
{/if}
+9 -3
View File
@@ -34,7 +34,9 @@
class="object-cover object-center max-h-96" />
{:else}
{#await loadPreview()}
<span class="loading loading-spinner" />
<div class="center my-12 w-full">
<span class="loading loading-spinner" />
</div>
{:then preview}
{#if preview.image}
<img
@@ -42,13 +44,17 @@
src={imgproxy(preview.image)}
class="max-h-96 object-contain object-center" />
{/if}
<div class="h-px bg-neutral-600" />
<div class="h-px" />
{#if preview.title}
<div class="flex flex-col bg-white px-4 py-2 text-black">
<div class="flex flex-col px-4 py-2">
<strong class="overflow-hidden text-ellipsis whitespace-nowrap">{preview.title}</strong>
<small>{ellipsize(preview.description, 140)}</small>
</div>
{/if}
{:catch}
<p class="mb-1 p-12 text-center">
Unable to load a preview for {url}
</p>
{/await}
{/if}
</Link>
+2 -2
View File
@@ -3,7 +3,7 @@
import {displayProfile} from "@welshman/util"
import {deriveProfile} from "@welshman/app"
import Link from "@lib/components/Link.svelte"
import {nostr} from '@app/state'
import {entityLink} from '@app/state'
export let value
@@ -11,6 +11,6 @@
const nprofile = nip19.nprofileEncode(value)
</script>
<Link external href={nostr(nprofile)} class="link-content">
<Link external href={entityLink(nprofile)} class="link-content">
@{displayProfile($profile)}
</Link>
+10 -5
View File
@@ -1,20 +1,25 @@
<script lang="ts">
import {displayPubkey} from "@welshman/util"
import {deriveProfile, deriveProfileDisplay, formatTimestamp} from "@welshman/app"
import {deriveProfile, deriveHandleForPubkey, displayHandle, deriveProfileDisplay, formatTimestamp} from "@welshman/app"
import Avatar from "@lib/components/Avatar.svelte"
export let pubkey
const profile = deriveProfile(pubkey)
const profileDisplay = deriveProfileDisplay(pubkey)
const handle = deriveHandleForPubkey(pubkey)
</script>
<div class="flex gap-2">
<div class="flex gap-2 max-w-full">
<div class="py-1">
<Avatar src={$profile?.picture} size={10} />
</div>
<div class="flex flex-col">
<div class="text-bold">{$profileDisplay}</div>
<div class="text-sm opacity-75">{displayPubkey(pubkey)}</div>
<div class="flex flex-col min-w-0">
<div class="text-bold text-ellipsis overflow-hidden">
{$profileDisplay}
</div>
<div class="text-sm opacity-75 text-ellipsis overflow-hidden">
{$handle ? displayHandle($handle) : displayPubkey(pubkey)}
</div>
</div>
</div>