Make content components reactive

This commit is contained in:
Jon Staab 2026-07-08 14:13:04 -07:00
parent a254ec10f1
commit c139722261
2 changed files with 9 additions and 5 deletions

View file

@ -59,7 +59,7 @@
url,
}: Props = $props()
const fullContent = parse(event)
const fullContent = $derived(parse(event))
const expand = () => {
showEntire = true
@ -98,12 +98,16 @@
const isQuote = (p: Parsed) => isEvent(p) || isAddress(p)
let warningDismissed = $state(false)
const ignoreWarning = () => {
warning = null
warningDismissed = true
}
let warning = $state(
$userSettingsValues.hide_sensitive && event.tags.find(nthEq(0, "content-warning"))?.[1],
const warning = $derived(
warningDismissed
? undefined
: $userSettingsValues.hide_sensitive && event.tags.find(nthEq(0, "content-warning"))?.[1],
)
const dropWhile = <T,>(f: (x: T) => boolean, xs: Iterable<T>) => {

View file

@ -44,7 +44,7 @@
const {event, trimParent = false, singleLine = false, url}: Props = $props()
const fullContent = parse(event)
const fullContent = $derived(parse(event))
const isBoundary = (i: number) => {
const parsed = fullContent[i]