forked from coracle/flotilla
prevent some defaults
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
import {repository} from "@welshman/app"
|
import {repository} from "@welshman/app"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import Avatar from "@lib/components/Avatar.svelte"
|
import Avatar from "@lib/components/Avatar.svelte"
|
||||||
|
import Button from "@lib/components/Button.svelte"
|
||||||
import Content from "@app/components/Content.svelte"
|
import Content from "@app/components/Content.svelte"
|
||||||
import ProfileDetail from "@app/components/ProfileDetail.svelte"
|
import ProfileDetail from "@app/components/ProfileDetail.svelte"
|
||||||
import ChatMessageEmojiButton from "@app/components/ChatMessageEmojiButton.svelte"
|
import ChatMessageEmojiButton from "@app/components/ChatMessageEmojiButton.svelte"
|
||||||
@@ -52,31 +53,29 @@
|
|||||||
!isPending && !isPublished && findStatus($ps, [PublishStatus.Failure, PublishStatus.Timeout])
|
!isPending && !isPublished && findStatus($ps, [PublishStatus.Failure, PublishStatus.Timeout])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<div
|
||||||
type="button"
|
|
||||||
class="group chat relative flex w-full flex-col gap-1 p-2 text-left"
|
class="group chat relative flex w-full flex-col gap-1 p-2 text-left"
|
||||||
class:chat-start={event.pubkey !== $pubkey}
|
class:chat-start={event.pubkey !== $pubkey}
|
||||||
class:chat-end={event.pubkey === $pubkey}>
|
class:chat-end={event.pubkey === $pubkey}>
|
||||||
<div class="chat-bubble mx-1 max-w-sm">
|
<div class="chat-bubble mx-1 max-w-sm">
|
||||||
<div class="flex items-start gap-2">
|
<div class="flex items-start gap-2">
|
||||||
{#if showPubkey}
|
{#if showPubkey}
|
||||||
<button type="button" on:click|stopPropagation={showProfile}>
|
<Button on:click={showProfile}>
|
||||||
<Avatar
|
<Avatar
|
||||||
src={$profile?.picture}
|
src={$profile?.picture}
|
||||||
class="border border-solid border-base-content"
|
class="border border-solid border-base-content"
|
||||||
size={10} />
|
size={10} />
|
||||||
</button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="-mt-1 flex-grow pr-1">
|
<div class="-mt-1 flex-grow pr-1">
|
||||||
{#if showPubkey}
|
{#if showPubkey}
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
|
||||||
class="text-bold text-sm"
|
class="text-bold text-sm"
|
||||||
style="color: {colorValue}"
|
style="color: {colorValue}"
|
||||||
on:click|stopPropagation={showProfile}>
|
on:click={showProfile}>
|
||||||
{$profileDisplay}
|
{$profileDisplay}
|
||||||
</button>
|
</Button>
|
||||||
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
|
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -118,13 +117,12 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<button
|
<Button
|
||||||
class="join absolute -top-2 right-0 border border-solid border-neutral text-xs opacity-0 transition-all group-hover:opacity-100"
|
class="join absolute -top-2 right-0 border border-solid border-neutral text-xs opacity-0 transition-all group-hover:opacity-100">
|
||||||
on:click|stopPropagation>
|
|
||||||
<ChatMessageEmojiButton {event} {pubkeys} />
|
<ChatMessageEmojiButton {event} {pubkeys} />
|
||||||
<button class="btn join-item btn-xs">
|
<div class="btn join-item btn-xs">
|
||||||
<Icon icon="menu-dots" size={4} />
|
<Icon icon="menu-dots" size={4} />
|
||||||
</button>
|
</div>
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,10 @@
|
|||||||
|
|
||||||
const profile = deriveProfile(value.pubkey)
|
const profile = deriveProfile(value.pubkey)
|
||||||
|
|
||||||
const onClick = () => pushDrawer(ProfileDetail, {pubkey: value.pubkey})
|
const onClick = (e: Event) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
pushDrawer(ProfileDetail, {pubkey: value.pubkey})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button on:click={onClick} class="link-content">
|
<Button on:click={onClick} class="link-content">
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import {nip19} from 'nostr-tools'
|
||||||
import {Address} from "@welshman/util"
|
import {Address} from "@welshman/util"
|
||||||
|
import Link from "@lib/components/Link.svelte"
|
||||||
import Spinner from "@lib/components/Spinner.svelte"
|
import Spinner from "@lib/components/Spinner.svelte"
|
||||||
import NoteCard from "@app/components/NoteCard.svelte"
|
import NoteCard from "@app/components/NoteCard.svelte"
|
||||||
import {deriveEvent} from "@app/state"
|
import {deriveEvent, entityLink} from "@app/state"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
export let depth = 0
|
export let depth = 0
|
||||||
@@ -10,11 +12,10 @@
|
|||||||
const {id, identifier, kind, pubkey, relays} = value
|
const {id, identifier, kind, pubkey, relays} = value
|
||||||
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
|
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
|
||||||
const event = deriveEvent(idOrAddress, relays)
|
const event = deriveEvent(idOrAddress, relays)
|
||||||
|
const nevent = nip19.neventEncode({id, relays})
|
||||||
let element: Element
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button class="my-2 block max-w-full text-left" bind:this={element} on:click|stopPropagation>
|
<Link external href={entityLink(nevent)} class="my-2 block max-w-full text-left">
|
||||||
{#if $event}
|
{#if $event}
|
||||||
<NoteCard event={$event} class="bg-alt rounded-box p-4">
|
<NoteCard event={$event} class="bg-alt rounded-box p-4">
|
||||||
<slot name="note-content" event={$event} {depth} />
|
<slot name="note-content" event={$event} {depth} />
|
||||||
@@ -24,4 +25,4 @@
|
|||||||
<Spinner loading>Loading event...</Spinner>
|
<Spinner loading>Loading event...</Spinner>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</Link>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import {nip19} from 'nostr-tools'
|
||||||
import {onMount} from "svelte"
|
import {onMount} from "svelte"
|
||||||
import {ago, append, first, sortBy, WEEK, ctx} from "@welshman/lib"
|
import {ago, append, first, sortBy, WEEK, ctx} from "@welshman/lib"
|
||||||
import {NOTE, getAncestorTags, getListTags, getPubkeyTagValues} from "@welshman/util"
|
import {NOTE, getAncestorTags, getListTags, getPubkeyTagValues} from "@welshman/util"
|
||||||
@@ -12,12 +13,14 @@
|
|||||||
formatTimestamp,
|
formatTimestamp,
|
||||||
formatTimestampRelative,
|
formatTimestampRelative,
|
||||||
} from "@welshman/app"
|
} from "@welshman/app"
|
||||||
|
import Link from "@lib/components/Link.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
import Profile from "@app/components/Profile.svelte"
|
import Profile from "@app/components/Profile.svelte"
|
||||||
import ProfileInfo from "@app/components/ProfileInfo.svelte"
|
import ProfileInfo from "@app/components/ProfileInfo.svelte"
|
||||||
import Content from "@app/components/Content.svelte"
|
import Content from "@app/components/Content.svelte"
|
||||||
import ProfileDetail from "@app/components/ProfileDetail.svelte"
|
import ProfileDetail from "@app/components/ProfileDetail.svelte"
|
||||||
import {pushDrawer} from "@app/modal"
|
import {pushDrawer} from "@app/modal"
|
||||||
|
import {entityLink} from "@app/state"
|
||||||
|
|
||||||
export let pubkey
|
export let pubkey
|
||||||
|
|
||||||
@@ -40,24 +43,26 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="card2 bg-alt shadow-xl">
|
<Button class="card2 bg-alt shadow-xl" on:click={onClick}>
|
||||||
<Profile {pubkey} />
|
<Profile {pubkey} />
|
||||||
<ProfileInfo {pubkey} />
|
<ProfileInfo {pubkey} />
|
||||||
{#if roots.length > 0}
|
{#if roots.length > 0}
|
||||||
{@const event = first(sortBy(e => -e.created_at, roots))}
|
{@const event = first(sortBy(e => -e.created_at, roots))}
|
||||||
|
{@const relays = ctx.app.router.Event(event).getUrls()}
|
||||||
|
{@const nevent = nip19.neventEncode({id: event.id, relays})}
|
||||||
{@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
|
{@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
|
||||||
<div class="divider" />
|
<div class="divider" />
|
||||||
<Button class="chat chat-start" on:click={onClick}>
|
<Link external href={entityLink(nevent)} class="chat chat-start">
|
||||||
<div class="bg-alt chat-bubble text-left">
|
<div class="bg-alt chat-bubble text-left">
|
||||||
<Content hideMedia={!following} {event} />
|
<Content hideMedia={!following} {event} />
|
||||||
<p class="text-right text-xs">{formatTimestamp(event.created_at)}</p>
|
<p class="text-right text-xs">{formatTimestamp(event.created_at)}</p>
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Link>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<div class="badge badge-neutral">
|
<div class="badge badge-neutral bg-alt border-none">
|
||||||
{roots.length} recent {roots.length === 1 ? "note" : "notes"}
|
{roots.length} recent {roots.length === 1 ? "note" : "notes"}
|
||||||
</div>
|
</div>
|
||||||
<div class="badge badge-neutral">Last posted {formatTimestampRelative(event.created_at)}</div>
|
<div class="badge badge-neutral bg-alt border-none">Last posted {formatTimestampRelative(event.created_at)}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</Button>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<button on:click type="button" {...$$props}>
|
<button on:click|stopPropagation type="button" {...$$props} class="text-left {$$props.class}">
|
||||||
<slot />
|
<slot />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
<a
|
<a
|
||||||
{href}
|
{href}
|
||||||
{...$$props}
|
{...$$props}
|
||||||
|
on:click|stopPropagation
|
||||||
class={cx($$props.class, "cursor-pointer")}
|
class={cx($$props.class, "cursor-pointer")}
|
||||||
rel={external ? "noopener noreferer" : ""}
|
rel={external ? "noopener noreferer" : ""}
|
||||||
target={external ? "_blank" : ""}>
|
target={external ? "_blank" : ""}>
|
||||||
|
|||||||
@@ -62,3 +62,4 @@ export const createScroller = ({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user