This commit is contained in:
Henry Jameson 2026-09-10 19:20:35 +03:00
commit 313a1758a5
4 changed files with 30 additions and 27 deletions

View file

@ -22,7 +22,9 @@ export function useConversation(statusId, expanded) {
const loadError = ref(null)
const currentStatus = computed(() => getStatusObject(statusId.value))
const mainStatus = computed(() => currentStatus.value?.retweeted_status ?? currentStatus.value)
const mainStatus = computed(
() => currentStatus.value?.retweeted_status ?? currentStatus.value,
)
const sortById = (a, b) => {
const idA = a.type === 'retweet' ? a.retweeted_status.id : a.id

View file

@ -1,5 +1,5 @@
import { computed, ref, toValue, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { computed, ref, watch } from 'vue'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
@ -20,17 +20,19 @@ export function useInterfaceSizes() {
watch(fontSizeSetting, updateFontSize, { immediate: true })
const navbarSize = computed(() => {
const string = fontSize.value * window
.getComputedStyle(document.body)
.getPropertyValue('--navbarSize')
const string =
fontSize.value *
window.getComputedStyle(document.body).getPropertyValue('--navbarSize')
return fontSize.value * Number.parseInt(string.slice(0, -3), 10) // remove the 'rem'
})
const panelHeaderSize = computed(() => {
const string = fontSize.value * window
.getComputedStyle(document.body)
.getPropertyValue('--panelHeaderSize')
const string =
fontSize.value *
window
.getComputedStyle(document.body)
.getPropertyValue('--panelHeaderSize')
return fontSize.value * Number.parseInt(string.slice(0, -3), 10) // remove the 'rem'
})

View file

@ -1,4 +1,4 @@
import { computed, ref, toValue, watch, nextTick } from 'vue'
import { computed, nextTick, ref, toValue, watch } from 'vue'
import { useWindowSize } from 'src/composables/useWindowSize.js'
@ -63,11 +63,7 @@ export function useVirtualScrolling({
}
// ## Scroll compensation
const {
y: scrollY,
inProgress: scrollInProgress,
scrollBy,
} = scrollPositionInstance
const { y: scrollY, scrollBy } = scrollPositionInstance
watch(heightChart, async (newVal, oldVal) => {
if (!toValue(scrollCompensation)) return
if (newVal.length === 0 && oldVal.length === 0) return
@ -76,7 +72,10 @@ export function useVirtualScrolling({
// If we're not given an achor, treat last element as one
const getAnchoredEl = (list) =>
toValue(anchorId)
? list.find(({ id }) => id === toValue(anchorId) || id === toValue(anchorRepeatId))
? list.find(
({ id }) =>
id === toValue(anchorId) || id === toValue(anchorRepeatId),
)
: list[list.length - 1]
const oldElement = getAnchoredEl(oldVal)
@ -85,8 +84,12 @@ export function useVirtualScrolling({
const diff = (() => {
if (oldElement && newElement) {
// Generic shifting
const oldOffset = toValue(anchorId) ? oldElement.top : (oldElement.top + oldElement.height)
const newOffset = toValue(anchorId) ? newElement.top : (newElement.top + newElement.height)
const oldOffset = toValue(anchorId)
? oldElement.top
: oldElement.top + oldElement.height
const newOffset = toValue(anchorId)
? newElement.top
: newElement.top + newElement.height
return newOffset - oldOffset
} else if (!oldElement && newElement) {
// Expansion
@ -95,7 +98,9 @@ export function useVirtualScrolling({
// Collapsing
return 0 - oldElement.top - oldElement.height
} else {
throw new Error("Somehow both new and old elements are missing, this shouldn't happen")
throw new Error(
"Somehow both new and old elements are missing, this shouldn't happen",
)
}
})()