mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-14 02:50:07 -04:00
Delete svelte-infinite-loading package
This commit is contained in:
parent
3a0b23836a
commit
6ecf2d7b72
4 changed files with 42 additions and 60 deletions
|
@ -3,7 +3,6 @@
|
|||
import BottomBar from '~/components/BottomBar.svelte'
|
||||
import Modal from 'svelte-simple-modal'
|
||||
import { page } from '$app/stores'
|
||||
import InfiniteLoading from 'svelte-infinite-loading'
|
||||
import {
|
||||
fetchChannels,
|
||||
channels,
|
||||
|
@ -23,15 +22,8 @@
|
|||
import { afterNavigate } from '$app/navigation'
|
||||
|
||||
let _countries = []
|
||||
const initLimit = 10
|
||||
let limit = initLimit
|
||||
let infiniteId = +new Date()
|
||||
let isLoading = true
|
||||
|
||||
const unsubscribe = filteredChannels.subscribe(reset)
|
||||
onDestroy(unsubscribe)
|
||||
|
||||
$: visibleCountries = _countries.slice(0, limit)
|
||||
$: groupedByCountry = _.groupBy($filteredChannels, 'country')
|
||||
|
||||
function loadMore({ detail }) {
|
||||
|
@ -44,11 +36,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
infiniteId = +new Date()
|
||||
limit = initLimit
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
if (!$channels.length) {
|
||||
await fetchChannels()
|
||||
|
@ -104,7 +91,7 @@
|
|||
loading...
|
||||
</div>
|
||||
{/if}
|
||||
{#each visibleCountries as country (country.code)}
|
||||
{#each _countries as country (country.code)}
|
||||
{#if groupedByCountry[country.code] && groupedByCountry[country.code].length > 0}
|
||||
<CountryItem
|
||||
bind:country
|
||||
|
@ -113,14 +100,6 @@
|
|||
></CountryItem>
|
||||
{/if}
|
||||
{/each}
|
||||
{#if !isLoading}
|
||||
<InfiniteLoading on:infinite={loadMore} identifier={infiniteId} distance={500}>
|
||||
<div slot="noResults"></div>
|
||||
<div slot="noMore"></div>
|
||||
<div slot="error"></div>
|
||||
<div slot="spinner"></div>
|
||||
</InfiniteLoading>
|
||||
{/if}
|
||||
</section>
|
||||
</Modal>
|
||||
</main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue