itube-specs 0.0.726 → 0.0.729

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,12 +12,26 @@
12
12
  class="s-grid-videos__card"
13
13
  :card="item"
14
14
  :priority="priority && index < 4"
15
- :loading="index < 8 && !related ? 'eager' : 'lazy'"
15
+ :loading="!related ? 'eager' : 'lazy'"
16
16
  :top-chips="topChips"
17
17
  :playlist-id="playlistId"
18
18
  :playlist="playlist"
19
19
  />
20
20
  <slot/>
21
+ <NuxtLazyHydrate when-idle v-if="idleItems.length > 0">
22
+ <div class="s-grid-videos__idle">
23
+ <FVideoCard
24
+ v-for="item in idleItems"
25
+ :key="`video-idle-${item.guid}`"
26
+ class="s-grid-videos__card"
27
+ :card="item"
28
+ loading="lazy"
29
+ :top-chips="topChips"
30
+ :playlist-id="playlistId"
31
+ :playlist="playlist"
32
+ />
33
+ </div>
34
+ </NuxtLazyHydrate>
21
35
  <NuxtLazyHydrate when-visible v-if="lazyItems.length > 0">
22
36
  <div class="s-grid-videos__lazy">
23
37
  <FVideoCard
@@ -39,7 +53,8 @@
39
53
  <script setup lang="ts">
40
54
  import type { IVideoCard } from '../../types';
41
55
 
42
- const EAGER_COUNT = 12;
56
+ const EAGER_COUNT = 4;
57
+ const IDLE_COUNT = 8;
43
58
 
44
59
  const props = defineProps<{
45
60
  items: Array<IVideoCard>
@@ -52,5 +67,6 @@ const props = defineProps<{
52
67
  }>()
53
68
 
54
69
  const eagerItems = computed(() => props.items.slice(0, EAGER_COUNT));
55
- const lazyItems = computed(() => props.items.slice(EAGER_COUNT));
70
+ const idleItems = computed(() => props.items.slice(EAGER_COUNT, EAGER_COUNT + IDLE_COUNT));
71
+ const lazyItems = computed(() => props.items.slice(EAGER_COUNT + IDLE_COUNT));
56
72
  </script>
@@ -0,0 +1,24 @@
1
+ import type { ELanguage } from '../runtime';
2
+ import type { IGroupCategories } from '../types';
3
+
4
+ export const useFetchGroupsCategoriesLazy = (
5
+ apiMethod: (...args: any[]) => Promise<IGroupCategories[]>
6
+ ) => {
7
+ const data = useState<IGroupCategories[] | null>('lazy-groups-categories', () => null);
8
+ const isLoading = useState<boolean>('lazy-groups-categories-loading', () => false);
9
+ const lang = useLang() as ELanguage;
10
+
11
+ async function load() {
12
+ if (data.value?.length || isLoading.value) return;
13
+ isLoading.value = true;
14
+ try {
15
+ data.value = await apiMethod(lang);
16
+ } catch (err) {
17
+ console.error('Failed to load groups categories:', err);
18
+ } finally {
19
+ isLoading.value = false;
20
+ }
21
+ }
22
+
23
+ return { data, isLoading, load };
24
+ };
@@ -2,7 +2,7 @@ import type { IChipsItem } from '../../types';
2
2
 
3
3
  export const categoriesNavigation: Array<IChipsItem> = [
4
4
  {
5
- title: 'top_rated',
5
+ title: 'grouped',
6
6
  value: '/categories',
7
7
  },
8
8
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.726",
4
+ "version": "0.0.729",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {