tweak how at works
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
const room = deriveRoom(url, h)
|
const room = deriveRoom(url, h)
|
||||||
const shouldProtect = canEnforceNip70(url)
|
const shouldProtect = canEnforceNip70(url)
|
||||||
const membershipStatus = deriveUserRoomMembershipStatus(url, h)
|
const membershipStatus = deriveUserRoomMembershipStatus(url, h)
|
||||||
const at = $derived(parseInt($page.url.searchParams.get("at") || String(now())))
|
const at = $derived(parseInt($page.url.searchParams.get("at")!))
|
||||||
|
|
||||||
const showRoomDetail = () => pushModal(RoomDetail, {url, h})
|
const showRoomDetail = () => pushModal(RoomDetail, {url, h})
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const manageScrollPosition = () => {
|
const manageScrollPosition = () => {
|
||||||
showScrollButton = Boolean(at) || Math.abs(element?.scrollTop || 0) > 1500
|
showScrollButton = !isNaN(at) || Math.abs(element?.scrollTop || 0) > 1500
|
||||||
|
|
||||||
const newMessages = document.getElementById("new-messages")
|
const newMessages = document.getElementById("new-messages")
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userHasScrolled && $page.url.searchParams.get("at")) {
|
if (!userHasScrolled && !isNaN(at)) {
|
||||||
const targetEvent = $events.find(event => event.created_at >= at)
|
const targetEvent = $events.find(event => event.created_at >= at)
|
||||||
|
|
||||||
if (targetEvent) {
|
if (targetEvent) {
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
document.getElementById("new-messages")?.scrollIntoView({behavior: "smooth", block: "center"})
|
document.getElementById("new-messages")?.scrollIntoView({behavior: "smooth", block: "center"})
|
||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if ($page.url.searchParams.get("at")) {
|
if (!isNaN(at)) {
|
||||||
goto($page.url.pathname, {replaceState: true})
|
goto($page.url.pathname, {replaceState: true})
|
||||||
} else {
|
} else {
|
||||||
element?.scrollTo({top: 0, behavior: "smooth"})
|
element?.scrollTo({top: 0, behavior: "smooth"})
|
||||||
@@ -305,8 +305,8 @@
|
|||||||
cleanup?.()
|
cleanup?.()
|
||||||
|
|
||||||
const feed = makeFeed({
|
const feed = makeFeed({
|
||||||
at,
|
|
||||||
url,
|
url,
|
||||||
|
at: at || now(),
|
||||||
element: element!,
|
element: element!,
|
||||||
filters: [{kinds: [...MESSAGE_KINDS, ROOM_ADD_MEMBER, ROOM_REMOVE_MEMBER], "#h": [h]}],
|
filters: [{kinds: [...MESSAGE_KINDS, ROOM_ADD_MEMBER, ROOM_REMOVE_MEMBER], "#h": [h]}],
|
||||||
onBackwardExhausted: () => {
|
onBackwardExhausted: () => {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
const lastChecked = $checked[$page.url.pathname]
|
const lastChecked = $checked[$page.url.pathname]
|
||||||
const url = decodeRelay($page.params.relay!)
|
const url = decodeRelay($page.params.relay!)
|
||||||
const shouldProtect = canEnforceNip70(url)
|
const shouldProtect = canEnforceNip70(url)
|
||||||
const at = $derived(parseInt($page.url.searchParams.get("at") || String(now())))
|
const at = $derived(parseInt($page.url.searchParams.get("at")!))
|
||||||
|
|
||||||
const replyTo = (event: TrustedEvent) => {
|
const replyTo = (event: TrustedEvent) => {
|
||||||
parent = event
|
parent = event
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const manageScrollPosition = () => {
|
const manageScrollPosition = () => {
|
||||||
showScrollButton = Boolean(at) || Math.abs(element?.scrollTop || 0) > 1500
|
showScrollButton = !isNaN(at) || Math.abs(element?.scrollTop || 0) > 1500
|
||||||
|
|
||||||
const newMessages = document.getElementById("new-messages")
|
const newMessages = document.getElementById("new-messages")
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userHasScrolled && $page.url.searchParams.get("at")) {
|
if (!userHasScrolled && !isNaN(at)) {
|
||||||
const targetEvent = $events.find(event => event.created_at >= at)
|
const targetEvent = $events.find(event => event.created_at >= at)
|
||||||
|
|
||||||
if (targetEvent) {
|
if (targetEvent) {
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
document.getElementById("new-messages")?.scrollIntoView({behavior: "smooth", block: "center"})
|
document.getElementById("new-messages")?.scrollIntoView({behavior: "smooth", block: "center"})
|
||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if ($page.url.searchParams.get("at")) {
|
if (!isNaN(at)) {
|
||||||
goto($page.url.pathname, {replaceState: true})
|
goto($page.url.pathname, {replaceState: true})
|
||||||
} else {
|
} else {
|
||||||
element?.scrollTo({top: 0, behavior: "smooth"})
|
element?.scrollTo({top: 0, behavior: "smooth"})
|
||||||
@@ -241,8 +241,8 @@
|
|||||||
cleanup?.()
|
cleanup?.()
|
||||||
|
|
||||||
const feed = makeFeed({
|
const feed = makeFeed({
|
||||||
at,
|
|
||||||
url,
|
url,
|
||||||
|
at: at || now(),
|
||||||
element: element!,
|
element: element!,
|
||||||
filters: [{kinds: [...MESSAGE_KINDS, RELAY_ADD_MEMBER, RELAY_REMOVE_MEMBER]}],
|
filters: [{kinds: [...MESSAGE_KINDS, RELAY_ADD_MEMBER, RELAY_REMOVE_MEMBER]}],
|
||||||
onBackwardExhausted: () => {
|
onBackwardExhausted: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user