itube-specs 0.0.911 → 0.0.913

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.
Files changed (44) hide show
  1. package/assets/scss/base/_animations.scss +11 -10
  2. package/assets/scss/mixins/_font-sizes.scss +5 -2
  3. package/assets/scss/themes/dark/_theme.scss +22 -18
  4. package/assets/scss/themes/light/_theme.scss +17 -13
  5. package/assets/scss/vars/_tokens.scss +1 -1
  6. package/assets/scss/vars/_vars.scss +1 -0
  7. package/components/auth/register.vue +0 -4
  8. package/components/card/collections-more.vue +1 -1
  9. package/components/card/dropdown/index.vue +2 -2
  10. package/components/card/playlist.vue +7 -8
  11. package/components/card/video/actions.vue +2 -2
  12. package/components/card/video/index.vue +9 -9
  13. package/components/filter/popup.vue +1 -0
  14. package/components/library/feed.vue +1 -14
  15. package/components/playlist/add.vue +123 -113
  16. package/components/playlist/edit.vue +133 -199
  17. package/components/playlist/input.vue +23 -133
  18. package/components/playlist/main.vue +21 -40
  19. package/components/playlist/visibility.vue +149 -0
  20. package/components/section/collections.vue +2 -2
  21. package/components/section/swiper-cards.vue +3 -3
  22. package/components/ui/chips.vue +7 -2
  23. package/components/ui/confirm.vue +17 -5
  24. package/components/ui/dropdown.vue +17 -8
  25. package/components/ui/expand-row.vue +0 -4
  26. package/components/ui/popup.vue +33 -15
  27. package/components/ui/section-title.vue +6 -6
  28. package/components/ui/tooltip.vue +35 -14
  29. package/composables/__tests__/use-overlay-stack.test.ts +110 -0
  30. package/composables/__tests__/use-video-collections.test.ts +75 -0
  31. package/composables/use-overlay-stack.ts +58 -0
  32. package/composables/use-playlist-edit.ts +13 -3
  33. package/composables/use-snackbar.ts +15 -1
  34. package/composables/use-user.ts +0 -4
  35. package/composables/use-video-collections.ts +27 -5
  36. package/package.json +1 -1
  37. package/pages/following.vue +4 -4
  38. package/pages/history.vue +1 -1
  39. package/pages/library/index.vue +4 -4
  40. package/pages/playlists/index.vue +7 -76
  41. package/runtime/constants/playlist-type.ts +5 -0
  42. package/components/playlist/private-toggle.vue +0 -20
  43. package/composables/use-favorites.ts +0 -20
  44. package/pages/favorites.vue +0 -31
@@ -13,7 +13,7 @@
13
13
  v-if="h1"
14
14
  :title="h1"
15
15
  :count="publicData.items.length"
16
- icon="list"
16
+ icon="playlist"
17
17
  />
18
18
 
19
19
  <UiLink
@@ -25,7 +25,7 @@
25
25
  name="playlist"
26
26
  size="16"
27
27
  />
28
- {{ $t('my_playlists_count', { count: myPlaylistsCount }) }}
28
+ {{ $t('my_playlists') }} (3)
29
29
  <UiIcon
30
30
  name="arrow-right"
31
31
  size="16"
@@ -33,33 +33,13 @@
33
33
  </UiLink>
34
34
  </header>
35
35
 
36
- <ClientOnly>
37
- <template v-if="isAuthorized && filteredUserItems && filteredUserItems.length > 0">
38
- <UiSectionTitle
39
- :title="$t('my_playlists')"
40
- :count="filteredUserItems.length"
41
- class="playlists__title"
42
- title-tag="h2"
43
- size="xl"
44
- icon="clapperboard-play"
45
- />
46
-
47
- <GridPlaylists
48
- :items="filteredUserItems"
49
- class="playlists__user-playlist"
50
- top-playlists
51
- priority
52
- />
53
- </template>
54
- </ClientOnly>
55
-
56
36
  <SectionCollections :data-items="publicData.items"/>
57
37
 
58
38
  <UiSectionTitle
59
39
  :title="$t('user_playlists')"
60
40
  class="playlists__title"
61
41
  title-tag="h2"
62
- size="xl"
42
+ variant="section"
63
43
  />
64
44
 
65
45
  <SectionNavLinks
@@ -76,7 +56,7 @@
76
56
  >
77
57
  <GridPlaylists
78
58
  :items="publicData.items"
79
- :priority="!filteredUserItems || filteredUserItems.length === 0"
59
+ priority
80
60
  />
81
61
  </div>
82
62
 
@@ -98,59 +78,16 @@
98
78
  </template>
99
79
 
100
80
  <script setup lang="ts">
101
- import type { Language } from '../../runtime';
102
- import { AsyncData } from '../../runtime';
103
81
  import { sortPlaylists } from '../../lib';
104
- import type { IBreadcrumbItem, IPlaylistCard } from '../../types';
105
- import { AuthorizationApiService } from '../../services/api/authorization.service';
82
+ import type { IBreadcrumbItem } from '../../types';
106
83
  import { PlaylistsApiService } from '../../services/api/playlists.service';
107
84
 
108
- const { locale } = useI18n();
109
- const lang = locale.value as Language;
110
-
111
85
  const { data: publicData, status } = await useFetchPlaylistsByNiche(PlaylistsApiService.getPlaylistByNiche);
112
86
 
113
- const { isAuthorized } = useUser(AuthorizationApiService);
114
-
115
- const { execute: fetchMyPlaylists } = useApiAction(
116
- PlaylistsApiService.getUserPlaylists,
117
- true
118
- );
119
-
120
- const { FAVORITES_KEY } = useFavorites();
121
- const userDataState = useState(`data-${AsyncData.GetPlaylists}`);
122
- const filteredUserItems = computed(() =>
123
- userDataState.value?.items?.filter((item: IPlaylistCard) => item.name !== FAVORITES_KEY)
124
- );
125
-
126
- const { data, refresh: refreshUserData } = useAsyncData(
127
- AsyncData.GetPlaylists,
128
- () => fetchMyPlaylists([lang]),
129
- {
130
- immediate: false,
131
- }
132
- );
133
-
134
- watch(
135
- () => isAuthorized.value,
136
- async (val) => {
137
- if (val) {
138
- await refreshUserData();
139
- userDataState.value = data.value;
140
- } else {
141
- userDataState.value = null;
142
- }
143
- },
144
- { immediate: true }
145
- );
146
-
147
87
  const { t } = useI18n();
148
88
 
149
89
  const { generateLink } = useGenerateLink();
150
90
 
151
- /** До загрузки своих плейлистов (и у гостя) в скобках 0 */
152
- const myPlaylistsCount = computed(() => filteredUserItems.value?.length ?? 0);
153
-
154
91
  const pagePureName = useGetPureRouteName();
155
92
  const { meta, h1 } = useMeta({
156
93
  t,
@@ -180,7 +117,7 @@ const breadcrumbs = [
180
117
  flex-direction: column;
181
118
  align-items: flex-start;
182
119
  row-gap: 12px;
183
- margin-bottom: 24px;
120
+ margin-bottom: 32px;
184
121
 
185
122
  @include from-br(xm) {
186
123
  flex-direction: row;
@@ -195,16 +132,10 @@ const breadcrumbs = [
195
132
  }
196
133
 
197
134
  .playlists__title {
198
- margin-bottom: 24px;
135
+ margin-bottom: 16px;
199
136
  }
200
137
 
201
138
  .playlists__navigation {
202
139
  margin-bottom: 32px;
203
140
  }
204
-
205
- .playlists__user-playlist {
206
- margin-bottom: 32px;
207
- padding-bottom: 32px;
208
- border-bottom: 1px solid $page-playlists-border;
209
- }
210
141
  </style>
@@ -4,3 +4,8 @@ export const PlaylistType = {
4
4
  } as const;
5
5
 
6
6
  export type PlaylistType = typeof PlaylistType[keyof typeof PlaylistType];
7
+
8
+ export const PLAYLIST_TYPE_ICON: Record<PlaylistType, string> = {
9
+ [PlaylistType.Public]: 'earth',
10
+ [PlaylistType.Private]: 'lock',
11
+ };
@@ -1,20 +0,0 @@
1
- <template>
2
- <div class="playlist-private-toggle">
3
- <UiToggle
4
- :model-value="modelValue"
5
- class="playlist-private-toggle__toggler"
6
- @update:model-value="(value: boolean) => emit('update:modelValue', value)"
7
- />
8
- <p class="playlist-private-toggle__text">{{ $t('playlist.private_playlist')}}</p>
9
- </div>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- defineProps<{
14
- modelValue: boolean
15
- }>();
16
-
17
- const emit = defineEmits<{
18
- (eventName: 'update:modelValue', value: boolean): void
19
- }>();
20
- </script>
@@ -1,20 +0,0 @@
1
- export const FAVORITES_KEY = 'favorites';
2
-
3
- /** Управляет состоянием плейлиста избранного: id, первое видео и вычисляемая ссылка на плейлист. */
4
- export const useFavorites = () => {
5
- const favoritesId = useState<string | null>('favorites-playlist-id', () => null);
6
- const favoritesFirstVideoId = useState<string | null>('favorites-first-video-id', () => null);
7
-
8
- const favoritesLink = computed(() =>
9
- favoritesId.value && favoritesFirstVideoId.value
10
- ? `/playlists/${favoritesId.value}/${favoritesFirstVideoId.value}`
11
- : null
12
- );
13
-
14
- return {
15
- FAVORITES_KEY,
16
- favoritesId,
17
- favoritesFirstVideoId,
18
- favoritesLink,
19
- };
20
- };
@@ -1,31 +0,0 @@
1
- <template>
2
- <div class="_page _container _loading" />
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import { PlaylistsApiService } from '../services/api/playlists.service';
7
- import type { Language } from '../runtime';
8
-
9
- const { locale } = useI18n();
10
- const { generateLink } = useGenerateLink();
11
- const cookie = useCookie('jwtoken');
12
-
13
- if (!cookie.value) {
14
- await navigateTo(generateLink('/playlists'), { replace: true });
15
- } else {
16
- try {
17
- const res = await PlaylistsApiService.getUserPlaylists(locale.value as Language);
18
- const fav = res?.items?.find(item => item.name === 'favorites');
19
-
20
- if (fav?.id && fav?.firstVideoId) {
21
- await navigateTo(generateLink(`/playlists/${fav.id}/${fav.firstVideoId}`), { replace: true });
22
- } else if (fav?.id) {
23
- await navigateTo(generateLink(`/playlists/${fav.id}`), { replace: true });
24
- } else {
25
- await navigateTo(generateLink('/playlists'), { replace: true });
26
- }
27
- } catch {
28
- await navigateTo(generateLink('/playlists'), { replace: true });
29
- }
30
- }
31
- </script>