Lint/format, fix message reaction deletion

This commit is contained in:
Jon Staab
2024-10-24 16:33:41 -07:00
parent 81672080f5
commit 9b6eef456f
5 changed files with 7 additions and 11 deletions
@@ -27,7 +27,8 @@
const showEmojiPicker = () => pushModal(EmojiPicker, {onClick: onEmoji}, {replaceState: true}) const showEmojiPicker = () => pushModal(EmojiPicker, {onClick: onEmoji}, {replaceState: true})
const showConversation = () => pushDrawer(ChannelConversation, {url, room, event}, {replaceState: true}) const showConversation = () =>
pushDrawer(ChannelConversation, {url, room, event}, {replaceState: true})
const showInfo = () => pushModal(EventInfo, {event}, {replaceState: true}) const showInfo = () => pushModal(EventInfo, {event}, {replaceState: true})
+4 -7
View File
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {onMount} from 'svelte'
import {type Instance} from "tippy.js" import {type Instance} from "tippy.js"
import {hash} from "@welshman/lib" import {hash} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
@@ -11,7 +10,6 @@
import Tippy from "@lib/components/Tippy.svelte" import Tippy from "@lib/components/Tippy.svelte"
import LongPress from "@lib/components/LongPress.svelte" import LongPress from "@lib/components/LongPress.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 ReplySummary from "@app/components/ReplySummary.svelte" import ReplySummary from "@app/components/ReplySummary.svelte"
import ReactionSummary from "@app/components/ReactionSummary.svelte" import ReactionSummary from "@app/components/ReactionSummary.svelte"
@@ -33,13 +31,12 @@
const onReactionClick = async (content: string, events: TrustedEvent[]) => { const onReactionClick = async (content: string, events: TrustedEvent[]) => {
const reaction = events.find(e => e.pubkey === $pubkey) const reaction = events.find(e => e.pubkey === $pubkey)
const template = reaction ? makeDelete({event}) : makeReaction({event, content}) const template = reaction ? makeDelete({event: reaction}) : makeReaction({event, content})
await sendWrapped({template, pubkeys}) await sendWrapped({template, pubkeys})
} }
const showMobileMenu = () => const showMobileMenu = () => pushModal(ChatMessageMenuMobile, {event, pubkeys})
pushModal(ChatMessageMenuMobile, {event})
const togglePopover = () => { const togglePopover = () => {
if (popoverIsVisible) { if (popoverIsVisible) {
@@ -84,7 +81,7 @@
</button> </button>
</Tippy> </Tippy>
<div class="flex flex-col"> <div class="flex flex-col">
<LongPress class="text-left chat-bubble mx-1 max-w-sm" onLongPress={showMobileMenu}> <LongPress class="chat-bubble mx-1 max-w-sm text-left" onLongPress={showMobileMenu}>
<div class="flex w-full items-start gap-2"> <div class="flex w-full items-start gap-2">
{#if showPubkey} {#if showPubkey}
<Link external href={pubkeyLink(event.pubkey)}> <Link external href={pubkeyLink(event.pubkey)}>
@@ -113,7 +110,7 @@
</div> </div>
</div> </div>
</LongPress> </LongPress>
<div class="row-2 ml-4 -mt-1 z-feature"> <div class="row-2 z-feature -mt-1 ml-4">
<ReplySummary {event} /> <ReplySummary {event} />
<ReactionSummary {event} {onReactionClick} /> <ReactionSummary {event} {onReactionClick} />
</div> </div>
@@ -3,7 +3,6 @@
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import EmojiPicker from "@lib/components/EmojiPicker.svelte" import EmojiPicker from "@lib/components/EmojiPicker.svelte"
import ChatMessageEmojiButton from "@app/components/ChatMessageEmojiButton.svelte"
import EventInfo from "@app/components/EventInfo.svelte" import EventInfo from "@app/components/EventInfo.svelte"
import {makeReaction, sendWrapped} from "@app/commands" import {makeReaction, sendWrapped} from "@app/commands"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 {$$props.class}"> <div class="grid grid-cols-1 gap-2 sm:grid-cols-2 {$$props.class}">
<label class="flex items-center gap-2 font-bold"> <label class="flex items-center gap-2 font-bold">
<slot name="label" /> <slot name="label" />
</label> </label>
-1
View File
@@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import "@src/app.css" import "@src/app.css"
import 'long-press-event'
import {onMount} from "svelte" import {onMount} from "svelte"
import {get} from "svelte/store" import {get} from "svelte/store"
import {dev} from "$app/environment" import {dev} from "$app/environment"