You've already forked AstralRinth
forked from didirus/AstralRinth
Bump tauri to v2 (#3018)
* Bump tauri to v2 * Switch to virtual typed list for content page * Fix unexpected hang on windows * Fix ads window scaling issues on some devices * Use DPR from browser * Fix link opens, bump version, fix lint
This commit is contained in:
@@ -5,7 +5,7 @@ import Checkbox from '../base/Checkbox.vue'
|
||||
import ContentListItem from './ContentListItem.vue'
|
||||
import type { ContentItem } from './ContentListItem.vue'
|
||||
import { DropdownIcon } from '@modrinth/assets'
|
||||
import { RecycleScroller } from 'vue-virtual-scroller'
|
||||
import { createVirtualScroller } from 'vue-typed-virtual-list'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -17,6 +17,8 @@ const props = withDefaults(
|
||||
{},
|
||||
)
|
||||
|
||||
const VirtualScroller = createVirtualScroller()
|
||||
|
||||
const selectionStates: Ref<Record<string, boolean>> = ref({})
|
||||
const selected: Ref<string[]> = computed(() =>
|
||||
Object.keys(selectionStates.value).filter(
|
||||
@@ -76,26 +78,21 @@ function setSelected(value: boolean) {
|
||||
</slot>
|
||||
</div>
|
||||
<div class="bg-bg-raised rounded-xl">
|
||||
<RecycleScroller
|
||||
v-slot="{ item, index }"
|
||||
:items="items"
|
||||
:item-size="64"
|
||||
disable-transform
|
||||
key-field="filename"
|
||||
style="height: 100%"
|
||||
>
|
||||
<ContentListItem
|
||||
v-model="selectionStates[item.filename]"
|
||||
:item="item"
|
||||
:last="props.items.length - 1 === index"
|
||||
class="mb-2"
|
||||
@update:model-value="updateSelection"
|
||||
>
|
||||
<template #actions="{ item }">
|
||||
<slot name="actions" :item="item" />
|
||||
</template>
|
||||
</ContentListItem>
|
||||
</RecycleScroller>
|
||||
<VirtualScroller :items="items" :default-size="64" style="height: 100%">
|
||||
<template #item="{ ref }">
|
||||
<ContentListItem
|
||||
v-model="selectionStates[ref.filename]"
|
||||
:item="ref"
|
||||
:last="false"
|
||||
class="mb-2"
|
||||
@update:model-value="updateSelection"
|
||||
>
|
||||
<template #actions="{ item }">
|
||||
<slot name="actions" :item="item" />
|
||||
</template>
|
||||
</ContentListItem>
|
||||
</template>
|
||||
</VirtualScroller>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user