Use thread item for profile detail

This commit is contained in:
Jon Staab
2024-10-24 12:25:54 -07:00
parent ab979fd7a6
commit f7b4b8aa51
3 changed files with 28 additions and 23 deletions
+23 -19
View File
@@ -13,6 +13,7 @@
} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {
session,
repository,
userFollows,
tagPubkey,
@@ -21,6 +22,7 @@
deriveProfile,
displayNip05,
feedLoader,
tracker,
} from "@welshman/app"
import {createScroller} from "@lib/html"
import {fly} from "@lib/transition"
@@ -28,7 +30,7 @@
import Avatar from "@lib/components/Avatar.svelte"
import Spinner from "@lib/components/Spinner.svelte"
import Content from "@app/components/Content.svelte"
import NoteCard from "@app/components/NoteCard.svelte"
import ThreadItem from "@app/components/ThreadItem.svelte"
import {entityLink} from "@app/state"
export let pubkey
@@ -40,6 +42,7 @@
const loader = feedLoader.getLoader(feedFromFilter(filter), {})
const relays = ctx.app.router.FromPubkeys([pubkey]).getUrls()
const nprofile = nip19.nprofileEncode({pubkey, relays})
const isSelf = $session!.pubkey === pubkey
let element: Element
@@ -75,30 +78,31 @@
</div>
</div>
</div>
{#if getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
<button
type="button"
class="btn btn-neutral"
on:click|preventDefault={() => unfollow(pubkey)}>
Unfollow
</button>
{:else}
<button
type="button"
class="btn btn-primary"
on:click|preventDefault={() => follow(tagPubkey(pubkey))}>
Follow
</button>
{#if !isSelf}
{#if getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
<button
type="button"
class="btn btn-neutral"
on:click|preventDefault={() => unfollow(pubkey)}>
Unfollow
</button>
{:else}
<button
type="button"
class="btn btn-primary"
on:click|preventDefault={() => follow(tagPubkey(pubkey))}>
Follow
</button>
{/if}
{/if}
</Link>
<Content event={{content: $profile.about, tags: []}} hideMedia />
<div class="flex flex-col gap-2">
{#each sortBy(e => -e.created_at, $events) as event (event.id)}
{#if flatten(Object.values(getAncestorTags(event.tags))).length === 0}
<div class="card2 bg-alt" in:fly>
<NoteCard hideProfile {event}>
<Content {event} />
</NoteCard>
{@const [url] = Array.from(tracker.getRelays(event.id))}
<div in:fly>
<ThreadItem hideActions {url} {event} />
</div>
{/if}
{:else}
+4 -1
View File
@@ -8,6 +8,7 @@
export let url
export let event
export let hideActions = false
</script>
<Link class="col-2 card2 bg-alt w-full cursor-pointer" href={makeThreadPath(url, event.id)}>
@@ -19,6 +20,8 @@
</div>
<div class="col-4 w-full pl-12">
<Content {event} />
<ThreadActions showActivity {url} {event} />
{#if !hideActions}
<ThreadActions showActivity {url} {event} />
{/if}
</div>
</Link>
@@ -30,8 +30,6 @@
showReply = false
}
const onReplySubmit = (thunk: Thunk) => {}
let showReply = false
onMount(() => {
@@ -79,5 +77,5 @@
</Button>
</div>
{#if showReply}
<ThreadReply {url} event={$event} onClose={closeReply} onSubmit={onReplySubmit} />
<ThreadReply {url} event={$event} onClose={closeReply} onSubmit={closeReply} />
{/if}