mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 03:17:02 +00:00
Add minimal style for quotes of chat messages
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
* Remove room tag from threads/calendars
|
* Remove room tag from threads/calendars
|
||||||
* Show pubkey on profile detail
|
* Show pubkey on profile detail
|
||||||
* Support pasting pubkey into chat start dialog
|
* Support pasting pubkey into chat start dialog
|
||||||
|
* Add minimal style for quoted messages
|
||||||
|
|
||||||
# 1.0.4
|
# 1.0.4
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
<Content {event} {url} />
|
<Content minimalQuote {event} {url} />
|
||||||
{#if thunk}
|
{#if thunk}
|
||||||
<ThunkStatus {thunk} class="mt-2" />
|
<ThunkStatus {thunk} class="mt-2" />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
showEntire?: boolean
|
showEntire?: boolean
|
||||||
hideMediaAtDepth?: number
|
hideMediaAtDepth?: number
|
||||||
expandMode?: string
|
expandMode?: string
|
||||||
|
minimalQuote?: boolean
|
||||||
depth?: number
|
depth?: number
|
||||||
url?: string
|
url?: string
|
||||||
}
|
}
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
showEntire = $bindable(false),
|
showEntire = $bindable(false),
|
||||||
hideMediaAtDepth = 1,
|
hideMediaAtDepth = 1,
|
||||||
expandMode = "block",
|
expandMode = "block",
|
||||||
|
minimalQuote = false,
|
||||||
depth = 0,
|
depth = 0,
|
||||||
url,
|
url,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
@@ -128,7 +130,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
class="overflow-hidden text-ellipsis break-words"
|
class="flex flex-col overflow-hidden text-ellipsis break-words"
|
||||||
style={expandBlock ? "mask-image: linear-gradient(0deg, transparent 0px, black 100px)" : ""}>
|
style={expandBlock ? "mask-image: linear-gradient(0deg, transparent 0px, black 100px)" : ""}>
|
||||||
{#each shortContent as parsed, i}
|
{#each shortContent as parsed, i}
|
||||||
{#if isNewline(parsed) && !isBlock(i - 1)}
|
{#if isNewline(parsed) && !isBlock(i - 1)}
|
||||||
@@ -153,7 +155,13 @@
|
|||||||
<ContentMention value={parsed.value} {url} />
|
<ContentMention value={parsed.value} {url} />
|
||||||
{:else if isEvent(parsed) || isAddress(parsed)}
|
{:else if isEvent(parsed) || isAddress(parsed)}
|
||||||
{#if isBlock(i)}
|
{#if isBlock(i)}
|
||||||
<ContentQuote {depth} {url} {hideMediaAtDepth} value={parsed.value} {event} />
|
<ContentQuote
|
||||||
|
{depth}
|
||||||
|
{url}
|
||||||
|
{hideMediaAtDepth}
|
||||||
|
value={parsed.value}
|
||||||
|
{event}
|
||||||
|
minimal={minimalQuote} />
|
||||||
{:else}
|
{:else}
|
||||||
<Link
|
<Link
|
||||||
external
|
external
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
import {Router} from "@welshman/router"
|
import {Router} from "@welshman/router"
|
||||||
import {tracker, repository} from "@welshman/app"
|
import {tracker, repository} from "@welshman/app"
|
||||||
import type {TrustedEvent} from "@welshman/util"
|
import type {TrustedEvent} from "@welshman/util"
|
||||||
import {Address, DIRECT_MESSAGE, MESSAGE, THREAD, EVENT_TIME} from "@welshman/util"
|
import {Address, getTagValue, DIRECT_MESSAGE, MESSAGE, THREAD, EVENT_TIME} from "@welshman/util"
|
||||||
import {scrollToEvent} from "@lib/html"
|
import {scrollToEvent} from "@lib/html"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.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 NoteContent from "@app/components/NoteContent.svelte"
|
import NoteContent from "@app/components/NoteContent.svelte"
|
||||||
import {deriveEvent, entityLink, ROOM} from "@app/state"
|
import {deriveEvent, entityLink, ROOM} from "@app/state"
|
||||||
import {makeThreadPath, makeCalendarPath, makeRoomPath} from "@app/routes"
|
import {makeThreadPath, makeSpacePath, makeCalendarPath, makeRoomPath} from "@app/routes"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: any
|
value: any
|
||||||
@@ -20,9 +20,10 @@
|
|||||||
event: TrustedEvent
|
event: TrustedEvent
|
||||||
depth: number
|
depth: number
|
||||||
url?: string
|
url?: string
|
||||||
|
minimal?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const {value, event, depth, hideMediaAtDepth, url}: Props = $props()
|
const {value, event, depth, hideMediaAtDepth, url, minimal}: Props = $props()
|
||||||
|
|
||||||
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()
|
||||||
@@ -37,11 +38,12 @@
|
|||||||
? nip19.neventEncode({id, relays: mergedRelays})
|
? nip19.neventEncode({id, relays: mergedRelays})
|
||||||
: new Address(kind, pubkey, identifier, mergedRelays).toNaddr()
|
: new Address(kind, pubkey, identifier, mergedRelays).toNaddr()
|
||||||
|
|
||||||
const openMessage = (url: string, room: string, id: string) => {
|
const openMessage = (url: string, room: string | undefined, id: string) => {
|
||||||
const event = repository.getEvent(id)
|
const event = repository.getEvent(id)
|
||||||
|
const path = room ? makeRoomPath(url, room) : makeSpacePath(url, "chat")
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
goto(makeRoomPath(url, room))
|
goto(path)
|
||||||
scrollToEvent(id)
|
scrollToEvent(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,9 +57,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [url] = tracker.getRelays($quote.id)
|
const [url] = tracker.getRelays($quote.id)
|
||||||
const room = $quote.tags.find(nthEq(0, ROOM))?.[1]
|
const room = getTagValue(ROOM, $quote.tags)
|
||||||
|
|
||||||
if (url && room) {
|
if (url) {
|
||||||
if ($quote.kind === THREAD) {
|
if ($quote.kind === THREAD) {
|
||||||
return goto(makeThreadPath(url, $quote.id))
|
return goto(makeThreadPath(url, $quote.id))
|
||||||
}
|
}
|
||||||
@@ -95,9 +97,17 @@
|
|||||||
|
|
||||||
<Button class="my-2 block max-w-full text-left" {onclick}>
|
<Button class="my-2 block max-w-full text-left" {onclick}>
|
||||||
{#if $quote}
|
{#if $quote}
|
||||||
|
{#if minimal && $quote.kind === MESSAGE}
|
||||||
|
<div
|
||||||
|
class="border-l-2 border-solid border-l-primary py-1 pl-2 opacity-90"
|
||||||
|
style="background-color: color-mix(in srgb, var(--primary) 10%, var(--base-300) 90%);">
|
||||||
|
<NoteContent {hideMediaAtDepth} {url} event={$quote} depth={depth + 1} />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
<NoteCard event={$quote} {url} class="bg-alt rounded-box p-4">
|
<NoteCard event={$quote} {url} class="bg-alt rounded-box p-4">
|
||||||
<NoteContent {hideMediaAtDepth} {url} event={$quote} depth={depth + 1} />
|
<NoteContent {hideMediaAtDepth} {url} event={$quote} depth={depth + 1} />
|
||||||
</NoteCard>
|
</NoteCard>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="rounded-box p-4">
|
<div class="rounded-box p-4">
|
||||||
<Spinner loading>Loading event...</Spinner>
|
<Spinner loading>Loading event...</Spinner>
|
||||||
|
|||||||
Reference in New Issue
Block a user