Make content components reactive
This commit is contained in:
parent
a254ec10f1
commit
c139722261
2 changed files with 9 additions and 5 deletions
|
|
@ -59,7 +59,7 @@
|
||||||
url,
|
url,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
const fullContent = parse(event)
|
const fullContent = $derived(parse(event))
|
||||||
|
|
||||||
const expand = () => {
|
const expand = () => {
|
||||||
showEntire = true
|
showEntire = true
|
||||||
|
|
@ -98,12 +98,16 @@
|
||||||
|
|
||||||
const isQuote = (p: Parsed) => isEvent(p) || isAddress(p)
|
const isQuote = (p: Parsed) => isEvent(p) || isAddress(p)
|
||||||
|
|
||||||
|
let warningDismissed = $state(false)
|
||||||
|
|
||||||
const ignoreWarning = () => {
|
const ignoreWarning = () => {
|
||||||
warning = null
|
warningDismissed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let warning = $state(
|
const warning = $derived(
|
||||||
$userSettingsValues.hide_sensitive && event.tags.find(nthEq(0, "content-warning"))?.[1],
|
warningDismissed
|
||||||
|
? undefined
|
||||||
|
: $userSettingsValues.hide_sensitive && event.tags.find(nthEq(0, "content-warning"))?.[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
const dropWhile = <T,>(f: (x: T) => boolean, xs: Iterable<T>) => {
|
const dropWhile = <T,>(f: (x: T) => boolean, xs: Iterable<T>) => {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
const {event, trimParent = false, singleLine = false, url}: Props = $props()
|
const {event, trimParent = false, singleLine = false, url}: Props = $props()
|
||||||
|
|
||||||
const fullContent = parse(event)
|
const fullContent = $derived(parse(event))
|
||||||
|
|
||||||
const isBoundary = (i: number) => {
|
const isBoundary = (i: number) => {
|
||||||
const parsed = fullContent[i]
|
const parsed = fullContent[i]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue