tweak chat message layout

This commit is contained in:
Jon Staab
2024-10-15 13:12:38 -07:00
parent 6f4fe1f674
commit c3cd4db270
2 changed files with 13 additions and 14 deletions

View File

@@ -104,21 +104,20 @@
<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}
<div class="text-sm col-1"> <div class="text-sm">
<Content {event} /> <Content {event} />
{#if isPending} {#if isPending}
<div class="flex gap-1 justify-end items-center" transition:slideAndFade> <span class="flex-inline ml-1 gap-1">
<span class="loading loading-spinner mx-1 h-3 w-3" /> <span class="loading loading-spinner mx-1 h-3 w-3 translate-y-px" />
<span class="opacity-50">Sending...</span> <span class="opacity-50">Sending...</span>
</div> </span>
{:else if failure} {:else if failure}
<div <span
class="flex tooltip cursor-pointer gap-1 justify-end items-center" class="flex-inline tooltip ml-1 cursor-pointer gap-1"
data-tip="{failure.message} ({displayRelayUrl(failure.url)})" data-tip="{failure.message} ({displayRelayUrl(failure.url)})">
transition:slideAndFade> <Icon icon="danger" class="translate-y-px" size={3} />
<Icon icon="danger" size={3} />
<span class="opacity-50">Failed to send!</span> <span class="opacity-50">Failed to send!</span>
</div> </span>
{/if} {/if}
</div> </div>
</div> </div>

View File

@@ -2,7 +2,7 @@
import {derived} from "svelte/store" import {derived} from "svelte/store"
import {hash, uniqBy, groupBy, now} from "@welshman/lib" import {hash, uniqBy, groupBy, now} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {deriveEvents} from "@welshman/store" import {deriveEvents, throttled} from "@welshman/store"
import {PublishStatus} from "@welshman/net" import {PublishStatus} from "@welshman/net"
import { import {
publishStatusData, publishStatusData,
@@ -33,7 +33,7 @@
const reactions = deriveEvents(repository, {filters: [{kinds: [REACTION], "#e": [event.id]}]}) const reactions = deriveEvents(repository, {filters: [{kinds: [REACTION], "#e": [event.id]}]})
const zaps = deriveEvents(repository, {filters: [{kinds: [ZAP_RESPONSE], "#e": [event.id]}]}) const zaps = deriveEvents(repository, {filters: [{kinds: [ZAP_RESPONSE], "#e": [event.id]}]})
const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length] const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const ps = derived(publishStatusData, $m => Object.values($m[event.id] || {})) const ps = throttled(300, derived(publishStatusData, $m => Object.values($m[event.wrap!.id] || {})))
const showProfile = () => pushDrawer(ProfileDetail, {pubkey: event.pubkey}) const showProfile = () => pushDrawer(ProfileDetail, {pubkey: event.pubkey})
@@ -58,7 +58,7 @@
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 w-full">
{#if showPubkey} {#if showPubkey}
<Button on:click={showProfile}> <Button on:click={showProfile}>
<Avatar <Avatar
@@ -115,7 +115,7 @@
</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 -bottom-5 right-0 border border-solid border-neutral text-xs">
<ChatMessageEmojiButton {event} {pubkeys} /> <ChatMessageEmojiButton {event} {pubkeys} />
<div 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} />