Long press channel messages
This commit is contained in:
parent
9912191d6c
commit
c88b6da23f
5 changed files with 59 additions and 62 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
import type {Thunk} from "@welshman/app"
|
import type {Thunk} from "@welshman/app"
|
||||||
import {isMobile} from "@lib/html"
|
import {isMobile} from "@lib/html"
|
||||||
import {slideAndFade, conditionalTransition} from "@lib/transition"
|
import {slideAndFade, conditionalTransition} from "@lib/transition"
|
||||||
import Delay from "@lib/components/Delay.svelte"
|
import LongPress from "@lib/components/LongPress.svelte"
|
||||||
import Avatar from "@lib/components/Avatar.svelte"
|
import Avatar from "@lib/components/Avatar.svelte"
|
||||||
import Link from "@lib/components/Link.svelte"
|
import Link from "@lib/components/Link.svelte"
|
||||||
import Content from "@app/components/Content.svelte"
|
import Content from "@app/components/Content.svelte"
|
||||||
|
|
@ -39,18 +39,13 @@
|
||||||
const transition = conditionalTransition(thunk, slideAndFade)
|
const transition = conditionalTransition(thunk, slideAndFade)
|
||||||
|
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
if (inert) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMobile) {
|
|
||||||
pushModal(ChannelMessageMenuMobile, {url, event})
|
|
||||||
} else {
|
|
||||||
const root = $rootEvent || event
|
const root = $rootEvent || event
|
||||||
|
|
||||||
pushDrawer(ChannelConversation, {url, room, event: root})
|
pushDrawer(ChannelConversation, {url, room, event: root})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
const onLongPress = () =>
|
||||||
|
pushModal(ChannelMessageMenuMobile, {url, event})
|
||||||
|
|
||||||
const onReactionClick = (content: string, events: TrustedEvent[]) => {
|
const onReactionClick = (content: string, events: TrustedEvent[]) => {
|
||||||
const reaction = events.find(e => e.pubkey === $pubkey)
|
const reaction = events.find(e => e.pubkey === $pubkey)
|
||||||
|
|
@ -68,13 +63,10 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Delay>
|
<LongPress
|
||||||
<button
|
on:click={isMobile || inert ? null : onClick}
|
||||||
type="button"
|
onLongPress={inert ? null : onLongPress}
|
||||||
in:transition
|
class="group relative flex w-full flex-col gap-1 p-2 text-left transition-colors {inert ? 'hover:bg-base-300' : ''}">
|
||||||
on:click={onClick}
|
|
||||||
class="group relative flex w-full flex-col gap-1 p-2 text-left transition-colors"
|
|
||||||
class:hover:bg-base-300={!inert}>
|
|
||||||
<div class="flex w-full gap-3">
|
<div class="flex w-full gap-3">
|
||||||
{#if showPubkey}
|
{#if showPubkey}
|
||||||
<Link external href={pubkeyLink(event.pubkey)} class="flex items-start">
|
<Link external href={pubkeyLink(event.pubkey)} class="flex items-start">
|
||||||
|
|
@ -120,5 +112,4 @@
|
||||||
<ChannelMessageEmojiButton {url} {room} {event} />
|
<ChannelMessageEmojiButton {url} {room} {event} />
|
||||||
<ChannelMessageMenuButton {url} {event} />
|
<ChannelMessageMenuButton {url} {event} />
|
||||||
</button>
|
</button>
|
||||||
</button>
|
</LongPress>
|
||||||
</Delay>
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
<Avatar icon="letter" class="!h-10 !w-10" />
|
<Avatar icon="letter" class="!h-10 !w-10" />
|
||||||
</PrimaryNavItem>
|
</PrimaryNavItem>
|
||||||
<PrimaryNavItem title="Spaces" on:click={showSpacesMenu}>
|
<PrimaryNavItem title="Spaces" on:click={showSpacesMenu}>
|
||||||
<Avatar icon="add-circle" class="!h-10 !w-10" />
|
<Avatar icon="settings-minimalistic" class="!h-10 !w-10" />
|
||||||
</PrimaryNavItem>
|
</PrimaryNavItem>
|
||||||
</div>
|
</div>
|
||||||
<PrimaryNavItem title="Settings" on:click={showSettingsMenu}>
|
<PrimaryNavItem title="Settings" on:click={showSettingsMenu}>
|
||||||
|
|
|
||||||
4
src/assets/icons/Settings Minimalistic.svg
Normal file
4
src/assets/icons/Settings Minimalistic.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M7.84308 3.80211C9.8718 2.6007 10.8862 2 12 2C13.1138 2 14.1282 2.6007 16.1569 3.80211L16.8431 4.20846C18.8718 5.40987 19.8862 6.01057 20.4431 7C21 7.98943 21 9.19084 21 11.5937V12.4063C21 14.8092 21 16.0106 20.4431 17C19.8862 17.9894 18.8718 18.5901 16.8431 19.7915L16.1569 20.1979C14.1282 21.3993 13.1138 22 12 22C10.8862 22 9.8718 21.3993 7.84308 20.1979L7.15692 19.7915C5.1282 18.5901 4.11384 17.9894 3.55692 17C3 16.0106 3 14.8092 3 12.4063V11.5937C3 9.19084 3 7.98943 3.55692 7C4.11384 6.01057 5.1282 5.40987 7.15692 4.20846L7.84308 3.80211Z" stroke="#1C274C" stroke-width="1.5"/>
|
||||||
|
<circle cx="12" cy="12" r="3" stroke="#1C274C" stroke-width="1.5"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 767 B |
|
|
@ -64,6 +64,7 @@
|
||||||
import Reply from "@assets/icons/Reply.svg?dataurl"
|
import Reply from "@assets/icons/Reply.svg?dataurl"
|
||||||
import Server from "@assets/icons/Server.svg?dataurl"
|
import Server from "@assets/icons/Server.svg?dataurl"
|
||||||
import Settings from "@assets/icons/Settings.svg?dataurl"
|
import Settings from "@assets/icons/Settings.svg?dataurl"
|
||||||
|
import SettingsMinimalistic from "@assets/icons/Settings Minimalistic.svg?dataurl"
|
||||||
import TagHorizontal from "@assets/icons/Tag Horizontal.svg?dataurl"
|
import TagHorizontal from "@assets/icons/Tag Horizontal.svg?dataurl"
|
||||||
import ShareCircle from "@assets/icons/Share Circle.svg?dataurl"
|
import ShareCircle from "@assets/icons/Share Circle.svg?dataurl"
|
||||||
import ShopMinimalistic from "@assets/icons/Shop Minimalistic.svg?dataurl"
|
import ShopMinimalistic from "@assets/icons/Shop Minimalistic.svg?dataurl"
|
||||||
|
|
@ -143,6 +144,7 @@
|
||||||
"smile-circle": SmileCircle,
|
"smile-circle": SmileCircle,
|
||||||
server: Server,
|
server: Server,
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
|
'settings-minimalistic': SettingsMinimalistic,
|
||||||
"tag-horizontal": TagHorizontal,
|
"tag-horizontal": TagHorizontal,
|
||||||
"trash-bin-2": TrashBin2,
|
"trash-bin-2": TrashBin2,
|
||||||
"ufo-3": UFO3,
|
"ufo-3": UFO3,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@
|
||||||
let timeout: number
|
let timeout: number
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div on:touchstart={onTouchStart} on:touchend={onTouchEnd} {...$$props}>
|
<div role="button" tabindex="0" on:click on:touchstart={onTouchStart} on:touchend={onTouchEnd} {...$$props}>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue