@saooti/octopus-sdk 40.2.19 → 41.0.0

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 (214) hide show
  1. package/index.ts +2 -1
  2. package/package.json +4 -3
  3. package/src/App.vue +71 -95
  4. package/src/components/composable/player/usePlayerLive.ts +13 -4
  5. package/src/components/composable/player/usePlayerLogic.ts +6 -6
  6. package/src/components/composable/player/usePlayerVast.ts +7 -7
  7. package/src/components/composable/podcasts/usePodcastView.ts +3 -3
  8. package/src/components/composable/route/useAdvancedParamInit.ts +1 -1
  9. package/src/components/composable/route/useRouteUpdateParams.ts +4 -4
  10. package/src/components/composable/route/useSimplePageParam.ts +15 -8
  11. package/src/components/composable/useInit.ts +2 -2
  12. package/src/components/composable/useMetaTitleWatch.ts +2 -2
  13. package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
  14. package/src/components/display/categories/CategoryChooser.vue +144 -145
  15. package/src/components/display/categories/CategoryFilter.vue +172 -198
  16. package/src/components/display/categories/CategoryList.vue +122 -147
  17. package/src/components/display/comments/CommentInput.vue +100 -122
  18. package/src/components/display/comments/CommentList.vue +169 -191
  19. package/src/components/display/comments/CommentName.vue +35 -45
  20. package/src/components/display/comments/CommentParentInfo.vue +28 -34
  21. package/src/components/display/comments/CommentPlayer.vue +38 -50
  22. package/src/components/display/comments/CommentSection.vue +85 -103
  23. package/src/components/display/comments/item/CommentBasicView.vue +48 -61
  24. package/src/components/display/comments/item/CommentItem.vue +104 -115
  25. package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
  26. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
  27. package/src/components/display/comments/like/LikeButton.vue +36 -41
  28. package/src/components/display/comments/like/LikeSection.vue +128 -136
  29. package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
  30. package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
  31. package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
  32. package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
  33. package/src/components/display/edit/EditBox.vue +9 -8
  34. package/src/components/display/edit/EditBoxRadio.vue +1 -5
  35. package/src/components/display/emission/EmissionInlineList.vue +82 -97
  36. package/src/components/display/emission/EmissionItem.vue +57 -69
  37. package/src/components/display/emission/EmissionList.vue +189 -218
  38. package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
  39. package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
  40. package/src/components/display/emission/EmissionPresentationList.vue +51 -61
  41. package/src/components/display/filter/AdvancedSearch.vue +151 -176
  42. package/src/components/display/filter/CategorySearchFilter.vue +43 -46
  43. package/src/components/display/filter/DateFilter.vue +76 -91
  44. package/src/components/display/filter/MonetizableFilter.vue +27 -30
  45. package/src/components/display/filter/ProductorSearch.vue +87 -90
  46. package/src/components/display/filter/RubriqueChoice.vue +58 -63
  47. package/src/components/display/filter/RubriqueFilter.vue +154 -169
  48. package/src/components/display/filter/SearchOrder.vue +35 -35
  49. package/src/components/display/list/ListPaginate.vue +72 -93
  50. package/src/components/display/list/PaginateParams.vue +36 -40
  51. package/src/components/display/list/PaginateSection.vue +113 -124
  52. package/src/components/display/list/SwiperList.vue +97 -109
  53. package/src/components/display/live/CountDown.vue +15 -9
  54. package/src/components/display/live/CountdownOctopus.vue +16 -10
  55. package/src/components/display/live/LiveHorizontalList.vue +95 -103
  56. package/src/components/display/live/LiveItem.vue +64 -73
  57. package/src/components/display/live/LiveList.vue +125 -137
  58. package/src/components/display/live/RadioCurrently.vue +66 -73
  59. package/src/components/display/live/RadioImage.vue +39 -50
  60. package/src/components/display/live/RadioItem.vue +9 -14
  61. package/src/components/display/live/RadioList.vue +39 -53
  62. package/src/components/display/live/RadioPlanning.vue +210 -222
  63. package/src/components/display/organisation/OrganisationChooser.vue +116 -122
  64. package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
  65. package/src/components/display/participant/ParticipantInlineList.vue +42 -58
  66. package/src/components/display/participant/ParticipantItem.vue +66 -74
  67. package/src/components/display/participant/ParticipantList.vue +116 -141
  68. package/src/components/display/playlist/PlaylistItem.vue +33 -46
  69. package/src/components/display/playlist/PlaylistList.vue +115 -144
  70. package/src/components/display/playlist/PodcastList.vue +90 -103
  71. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
  72. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
  73. package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
  74. package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
  75. package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
  76. package/src/components/display/podcasts/PodcastFilterList.vue +62 -56
  77. package/src/components/display/podcasts/PodcastImage.vue +96 -99
  78. package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
  79. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
  80. package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
  81. package/src/components/display/podcasts/PodcastItem.vue +48 -63
  82. package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
  83. package/src/components/display/podcasts/PodcastList.vue +182 -206
  84. package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
  85. package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
  86. package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
  87. package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
  88. package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
  89. package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
  90. package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
  91. package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
  92. package/src/components/display/podcasts/TagList.vue +48 -50
  93. package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
  94. package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
  95. package/src/components/display/rubriques/RubriqueList.vue +140 -160
  96. package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
  97. package/src/components/display/sharing/FormatSwitch.vue +16 -11
  98. package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
  99. package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
  100. package/src/components/display/sharing/PlayerParameters.vue +69 -71
  101. package/src/components/display/sharing/QrCode.vue +55 -67
  102. package/src/components/display/sharing/ShareAnonymous.vue +160 -178
  103. package/src/components/display/sharing/ShareDistribution.vue +103 -117
  104. package/src/components/display/sharing/ShareNewsletter.vue +154 -161
  105. package/src/components/display/sharing/SharePlayer.vue +273 -295
  106. package/src/components/display/sharing/SharePlayerColors.vue +25 -16
  107. package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
  108. package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
  109. package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
  110. package/src/components/display/sharing/SubscribeButtons.vue +184 -207
  111. package/src/components/display/studio/RecordingItemButton.vue +1 -4
  112. package/src/components/form/ClassicCheckbox.vue +26 -30
  113. package/src/components/form/ClassicContentEditable.vue +37 -33
  114. package/src/components/form/ClassicCopyButton.vue +40 -44
  115. package/src/components/form/ClassicDatePicker.vue +114 -114
  116. package/src/components/form/ClassicEmojiPicker.vue +20 -28
  117. package/src/components/form/ClassicInputText.vue +116 -120
  118. package/src/components/form/ClassicLoading.vue +7 -12
  119. package/src/components/form/ClassicMultiselect.vue +115 -117
  120. package/src/components/form/ClassicRadio.vue +21 -16
  121. package/src/components/form/ClassicRadioLabel.vue +23 -22
  122. package/src/components/form/ClassicSearch.vue +24 -19
  123. package/src/components/form/ClassicSelect.vue +47 -38
  124. package/src/components/form/ClassicWysiwyg.vue +116 -123
  125. package/src/components/icons/AmazonMusicIcon.vue +7 -10
  126. package/src/components/icons/ApplePodcastIcon.vue +7 -11
  127. package/src/components/icons/BlueSkyIcon.vue +8 -11
  128. package/src/components/icons/DeezerIcon.vue +8 -11
  129. package/src/components/icons/EditFtpIcon.vue +8 -11
  130. package/src/components/icons/IHeartIcon.vue +8 -11
  131. package/src/components/icons/PlayVideoIcon.vue +7 -10
  132. package/src/components/icons/PlayerFmIcon.vue +7 -10
  133. package/src/components/icons/PocketCastIcon.vue +8 -11
  134. package/src/components/icons/PodcastAddictIcon.vue +7 -10
  135. package/src/components/icons/RadiolineIcon.vue +8 -11
  136. package/src/components/icons/TuninIcon.vue +8 -11
  137. package/src/components/icons/XIcon.vue +7 -10
  138. package/src/components/misc/AcpmImage.vue +6 -7
  139. package/src/components/misc/ClassicAccordion.vue +26 -31
  140. package/src/components/misc/ClassicLazy.vue +86 -90
  141. package/src/components/misc/ClassicNav.vue +16 -20
  142. package/src/components/misc/ClassicPopover.vue +271 -282
  143. package/src/components/misc/ClassicSpinner.vue +5 -27
  144. package/src/components/misc/ErrorMessage.vue +11 -12
  145. package/src/components/misc/FooterGarSection.vue +33 -41
  146. package/src/components/misc/FooterSection.vue +94 -131
  147. package/src/components/misc/HomeDropdown.vue +83 -105
  148. package/src/components/misc/MobileMenu.vue +101 -111
  149. package/src/components/misc/ProgressBar.vue +53 -62
  150. package/src/components/misc/TopBar.vue +98 -120
  151. package/src/components/misc/TopBarMainContent.vue +114 -133
  152. package/src/components/misc/modal/ClassicModal.vue +40 -33
  153. package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
  154. package/src/components/misc/modal/ClipboardModal.vue +27 -30
  155. package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
  156. package/src/components/misc/modal/MessageModal.vue +50 -47
  157. package/src/components/misc/modal/NewsletterModal.vue +30 -31
  158. package/src/components/misc/modal/QrCodeModal.vue +21 -21
  159. package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
  160. package/src/components/misc/player/PlayerCompact.vue +6 -4
  161. package/src/components/misc/player/PlayerComponent.vue +8 -9
  162. package/src/components/misc/player/PlayerLarge.vue +9 -8
  163. package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
  164. package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
  165. package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
  166. package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
  167. package/src/components/misc/player/elements/PlayerImage.vue +51 -57
  168. package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
  169. package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
  170. package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
  171. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
  172. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
  173. package/src/components/misc/player/radio/RadioHistory.vue +80 -99
  174. package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
  175. package/src/components/misc/player/video/PlayerVideo.vue +27 -40
  176. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
  177. package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
  178. package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
  179. package/src/components/pages/CategoryPage.vue +28 -33
  180. package/src/components/pages/EmissionPage.vue +113 -132
  181. package/src/components/pages/EmissionsPage.vue +2 -0
  182. package/src/components/pages/Error403Page.vue +21 -20
  183. package/src/components/pages/HomePage.vue +91 -100
  184. package/src/components/pages/LivesPage.vue +35 -37
  185. package/src/components/pages/MapPage.vue +209 -241
  186. package/src/components/pages/PageLogout.vue +8 -11
  187. package/src/components/pages/PageNotFound.vue +9 -5
  188. package/src/components/pages/ParticipantPage.vue +96 -110
  189. package/src/components/pages/ParticipantsPage.vue +3 -0
  190. package/src/components/pages/PlaylistPage.vue +112 -117
  191. package/src/components/pages/PlaylistsPage.vue +9 -2
  192. package/src/components/pages/PodcastPage.vue +224 -238
  193. package/src/components/pages/PodcastsPage.vue +9 -2
  194. package/src/components/pages/RadioPage.vue +56 -70
  195. package/src/components/pages/RubriquePage.vue +7 -3
  196. package/src/components/pages/SearchPage.vue +31 -36
  197. package/src/components/pages/TagPage.vue +11 -9
  198. package/src/components/pages/VideoPage.vue +14 -11
  199. package/src/helper/displayHelper.ts +1 -1
  200. package/src/helper/loadScript.ts +4 -4
  201. package/src/i18n.ts +2 -2
  202. package/src/main.ts +1 -1
  203. package/src/router/router.ts +17 -4
  204. package/src/stores/AuthStore.ts +12 -12
  205. package/src/stores/FilterStore.ts +1 -1
  206. package/src/stores/VastStore.ts +2 -2
  207. package/src/stores/class/general/player.ts +1 -0
  208. package/public/css/fonts/icomoon.eot +0 -0
  209. package/public/css/fonts/icomoon.svg +0 -113
  210. package/public/css/fonts/icomoon.ttf +0 -0
  211. package/public/css/fonts/icomoon.woff +0 -0
  212. package/public/css/fonts/icomoon.woff2 +0 -0
  213. package/public/css/fonts/style.css +0 -352
  214. package/sonarqube-scanner.js +0 -10
@@ -6,12 +6,12 @@
6
6
  v-model:is-mobile="isMobile"
7
7
  :text-count="
8
8
  displayCount > 1
9
- ? `${$t('Number playlists', { nb: displayCount })}`
9
+ ? `${t('Number playlists', { nb: displayCount })}`
10
10
  : undefined
11
11
  "
12
12
  :total-count="totalCount"
13
13
  :loading="loading"
14
- :loading-text="loading ? $t('Loading content ...') : undefined"
14
+ :loading-text="loading ? t('Loading content ...') : undefined"
15
15
  :player-responsive="true"
16
16
  >
17
17
  <template #list>
@@ -29,7 +29,7 @@
29
29
  name: 'playlist',
30
30
  params: { playlistId: p.playlistId },
31
31
  }"
32
- :title="$t('Playlist name page', { name: p.title })"
32
+ :title="t('Playlist name page', { name: p.title })"
33
33
  >
34
34
  {{ p.title }}
35
35
  </router-link>
@@ -40,7 +40,7 @@
40
40
  </ListPaginate>
41
41
  </template>
42
42
 
43
- <script lang="ts">
43
+ <script setup lang="ts">
44
44
  import ClassicLazy from "../../misc/ClassicLazy.vue";
45
45
  import ListPaginate from "../list/ListPaginate.vue";
46
46
  import {useErrorHandler} from "../../composable/useErrorHandler";
@@ -48,153 +48,124 @@ import classicApi from "../../../api/classicApi";
48
48
  import PlaylistItem from "./PlaylistItem.vue";
49
49
  import { Playlist, emptyPlaylistData } from "@/stores/class/general/playlist";
50
50
  import { useFilterStore } from "../../../stores/FilterStore";
51
- import { mapState } from "pinia";
52
- import { defineComponent } from "vue";
51
+ import { computed, onMounted, Ref, ref, watch } from "vue";
53
52
  import { AxiosError } from "axios";
54
53
  import { ListClassicReturn } from "@/stores/class/general/listReturn";
55
- export default defineComponent({
56
- name: "PlaylistList",
54
+ import { useI18n } from "vue-i18n";
57
55
 
58
- components: {
59
- PlaylistItem,
60
- ListPaginate,
61
- ClassicLazy,
62
- },
56
+ //Props
57
+ const props = defineProps({
58
+ first: { default: 0, type: Number },
59
+ size: { default: 30, type: Number },
60
+ query: { default: undefined, type: String },
61
+ organisationId: { default: undefined, type: String },
62
+ })
63
63
 
64
- props: {
65
- first: { default: 0, type: Number },
66
- size: { default: 30, type: Number },
67
- query: { default: undefined, type: String },
68
- organisationId: { default: undefined, type: String },
69
- },
64
+ //Data
65
+ const loading = ref(true);
66
+ const dfirst = ref(props.first);
67
+ const dsize = ref(props.size);
68
+ const totalCount = ref(0);
69
+ const displayCount = ref(0);
70
+ const isMobile = ref(false);
71
+ const playlists: Ref<Array<Playlist>> = ref([]);
70
72
 
71
- setup(){
72
- const {handle403} = useErrorHandler();
73
- return { handle403 }
74
- },
75
73
 
76
- data() {
77
- return {
78
- loading: true as boolean,
79
- dfirst: this.first,
80
- dsize: this.size,
81
- totalCount: 0 as number,
82
- displayCount: 0 as number,
83
- playlists: [] as Array<Playlist>,
84
- isMobile: false as boolean,
85
- };
86
- },
74
+ //Composables
75
+ const { t } = useI18n();
76
+ const {handle403} = useErrorHandler();
77
+ const filterStore = useFilterStore();
87
78
 
88
- computed: {
89
- ...mapState(useFilterStore, ["filterOrgaId"]),
90
- displayArray(): Array<Playlist> {
91
- if (this.isMobile) {
92
- return this.playlists;
93
- }
94
- return this.playlists.slice(
95
- this.dfirst,
96
- Math.min(this.dfirst + this.dsize, this.totalCount),
97
- );
98
- },
99
- changed(): string {
100
- return `${this.organisationId}|${this.query}`;
101
- },
102
- changePaginate(): string {
103
- return `${this.first}|${this.size}`;
104
- },
105
- sort(): string {
106
- return !this.query ? "NAME" : "SCORE";
107
- },
108
- organisation(): string | undefined {
109
- return this.organisationId ? this.organisationId : this.filterOrgaId;
110
- },
111
- },
112
- watch: {
113
- changePaginate() {
114
- this.dfirst = this.first;
115
- this.dsize = this.size;
116
- },
117
- changed(): void {
118
- this.reloadList();
119
- },
120
- dsize(): void {
121
- this.reloadList();
122
- },
123
- dfirst(): void {
124
- if (
125
- !this.playlists[this.dfirst] ||
126
- 0 === this.playlists[this.dfirst].playlistId
127
- ) {
128
- this.fetchContent(false);
129
- }
130
- },
131
- },
132
79
 
133
- mounted() {
134
- this.fetchContent(true);
135
- },
136
- methods: {
137
- reloadList() {
138
- this.dfirst = 0;
139
- this.fetchContent(true);
140
- },
141
- async fetchContent(reset: boolean): Promise<void> {
142
- this.loading = true;
143
- const param = {
144
- first: this.dfirst,
145
- size: this.dsize,
146
- query: this.query,
147
- organisationId: this.organisation,
148
- type: "NONE",
149
- sort: this.sort,
150
- };
151
- try {
152
- const data = await classicApi.fetchData<ListClassicReturn<Playlist>>({
153
- api: 0,
154
- path: "playlist/search",
155
- parameters: param,
156
- specialTreatement: true,
157
- });
158
- this.afterFetching(reset, data);
159
- } catch (error) {
160
- this.handle403(error as AxiosError);
161
- }
162
- },
163
- afterFetching(
164
- reset: boolean,
165
- data: { count: number; result: Array<Playlist>; sort: string },
166
- ): void {
167
- if (reset) {
168
- this.playlists.length = 0;
169
- }
170
- if (this.dfirst > this.playlists.length) {
171
- for (
172
- let i = this.playlists.length - 1, len = this.dfirst + this.dsize;
173
- i < len;
174
- i++
175
- ) {
176
- this.playlists.push(emptyPlaylistData());
177
- }
178
- }
179
- this.displayCount = data.count;
180
- const responsePlaylists = data.result.filter((e: Playlist | null) => {
181
- if (null === e) {
182
- this.displayCount--;
183
- }
184
- return null !== e;
185
- });
186
- this.playlists = this.playlists
187
- .slice(0, this.dfirst)
188
- .concat(responsePlaylists)
189
- .concat(
190
- this.playlists.slice(this.dfirst + this.dsize, this.playlists.length),
191
- );
192
- this.totalCount = data.count;
193
- this.loading = false;
194
- },
195
- displayMore(): void {
196
- this.fetchContent(false);
197
- },
198
- },
80
+ //Computed
81
+ const displayArray = computed(() => {
82
+ if (isMobile.value) {
83
+ return playlists.value;
84
+ }
85
+ return playlists.value.slice(
86
+ dfirst.value,
87
+ Math.min(dfirst.value + dsize.value, totalCount.value),
88
+ );
199
89
  });
90
+ const changed = computed(() => `${props.organisationId}|${props.query}`);
91
+ const changePaginate = computed(() => `${props.first}|${props.size}`);
92
+ const sort = computed(() => !props.query ? "NAME" : "SCORE");
93
+ const organisation = computed(() => props.organisationId ? props.organisationId : filterStore.filterOrgaId);
94
+
95
+
96
+ //Watch
97
+ watch(changePaginate, () => {
98
+ dfirst.value = props.first;
99
+ dsize.value = props.size;
100
+ });
101
+ watch(changed, () => fetchContent(true));
102
+ watch(dsize, () =>fetchContent(true));
103
+ watch(dfirst, () => {
104
+ if (
105
+ !playlists.value[dfirst.value] ||
106
+ 0 === playlists.value[dfirst.value].playlistId
107
+ ) {
108
+ fetchContent(false);
109
+ }
110
+ });
111
+
112
+ onMounted(()=>fetchContent(false))
113
+
114
+
115
+ //Methods
116
+ async function fetchContent(reset: boolean): Promise<void> {
117
+ loading.value = true;
118
+ const param = {
119
+ first: reset ? 0 : dfirst.value,
120
+ size: dsize.value,
121
+ query: props.query,
122
+ organisationId: organisation.value,
123
+ type: "NONE",
124
+ sort: sort.value,
125
+ };
126
+ try {
127
+ const data = await classicApi.fetchData<ListClassicReturn<Playlist>>({
128
+ api: 0,
129
+ path: "playlist/search",
130
+ parameters: param,
131
+ specialTreatement: true,
132
+ });
133
+ afterFetching(reset, data);
134
+ } catch (error) {
135
+ handle403(error as AxiosError);
136
+ }
137
+ }
138
+ function afterFetching(
139
+ reset: boolean,
140
+ data: { count: number; result: Array<Playlist>; sort: string },
141
+ ): void {
142
+ if (reset) {
143
+ dfirst.value = 0;
144
+ playlists.value.length = 0;
145
+ }
146
+ if (dfirst.value > playlists.value.length) {
147
+ for (
148
+ let i = playlists.value.length - 1, len = dfirst.value + dsize.value;
149
+ i < len;
150
+ i++
151
+ ) {
152
+ playlists.value.push(emptyPlaylistData());
153
+ }
154
+ }
155
+ displayCount.value = data.count;
156
+ const responsePlaylists = data.result.filter((e: Playlist | null) => {
157
+ if (null === e) {
158
+ displayCount.value--;
159
+ }
160
+ return null !== e;
161
+ });
162
+ playlists.value = playlists.value
163
+ .slice(0, dfirst.value)
164
+ .concat(responsePlaylists)
165
+ .concat(
166
+ playlists.value.slice(dfirst.value + dsize.value, playlists.value.length),
167
+ );
168
+ totalCount.value = data.count;
169
+ loading.value = false;
170
+ }
200
171
  </script>
@@ -8,27 +8,28 @@
8
8
  v-model:text-init="searchPattern"
9
9
  class="align-self-baseline mb-2"
10
10
  id-search="podcast-list-search"
11
- :label="$t('Search')"
11
+ :label="t('Search')"
12
12
  />
13
13
  <ListPaginate
14
14
  id="podcastPlaylistListPaginate"
15
- v-model:first="first"
16
- v-model:rows-per-page="size"
15
+ v-model:first="dfirst"
16
+ v-model:rows-per-page="dsize"
17
17
  v-model:is-mobile="isMobile"
18
18
  :text-count="
19
19
  podcasts.length > 1
20
- ? `${$t('Number podcasts', { nb: podcasts.length })}`
20
+ ? `${t('Number podcasts', { nb: podcasts.length })}`
21
21
  : undefined
22
22
  "
23
23
  :total-count="podcasts.length"
24
24
  :loading="loading"
25
- :loading-text="loading ? $t('Loading podcasts ...') : undefined"
25
+ :loading-text="loading ? t('Loading podcasts ...') : undefined"
26
26
  :error-text="
27
27
  !loading && !podcasts.length && notEmptyPlaylist
28
- ? $t(`No podcast match your query`)
28
+ ? t(`No podcast match your query`)
29
29
  : undefined
30
30
  "
31
31
  :player-responsive="true"
32
+ :force-update-parameters="true"
32
33
  >
33
34
  <template #list>
34
35
  <div class="octopus-element-list">
@@ -44,7 +45,7 @@
44
45
  name: 'podcast',
45
46
  params: { podcastId: p.podcastId },
46
47
  }"
47
- :title="$t('Episode name page', { name: p.title })"
48
+ :title="t('Episode name page', { name: p.title })"
48
49
  >
49
50
  {{ p.title }}
50
51
  </router-link>
@@ -56,7 +57,7 @@
56
57
  </div>
57
58
  </template>
58
59
 
59
- <script lang="ts">
60
+ <script setup lang="ts">
60
61
  import ListPaginate from "../list/ListPaginate.vue";
61
62
  import {useErrorHandler} from "../../composable/useErrorHandler";
62
63
  import {useOrgaComputed} from "../../composable/useOrgaComputed";
@@ -66,108 +67,94 @@ import ClassicSearch from "../../form/ClassicSearch.vue";
66
67
  import ClassicLazy from "../../misc/ClassicLazy.vue";
67
68
  import { Podcast } from "@/stores/class/general/podcast";
68
69
  import { Playlist } from "@/stores/class/general/playlist";
69
- import { defineComponent } from "vue";
70
+ import { computed, onBeforeMount, Ref, ref, watch } from "vue";
70
71
  import { AxiosError } from "axios";
71
- export default defineComponent({
72
- name: "PodcastList",
72
+ import { useI18n } from "vue-i18n";
73
73
 
74
- components: {
75
- PodcastItem,
76
- ClassicSearch,
77
- ListPaginate,
78
- ClassicLazy,
79
- },
74
+ //Props
75
+ const props = defineProps({
76
+ playlist: { default: () => ({}), type: Object as () => Playlist },
77
+ first: { default: 0, type: Number },
78
+ size: { default: 30, type: Number },
79
+ query: { default: undefined, type: String },
80
+ })
80
81
 
81
- props: {
82
- playlist: { default: () => ({}), type: Object as () => Playlist },
83
- },
82
+ //Emits
83
+ const emit = defineEmits(["update:query"]);
84
84
 
85
- setup(){
86
- const {handle403} = useErrorHandler();
87
- const { isEditRights } = useOrgaComputed();
88
- return { handle403, isEditRights }
89
- },
85
+ //Data
86
+ const loading = ref(true);
87
+ const podcasts: Ref<Array<Podcast>> = ref([]);
88
+ const podcastsQuery: Ref<Array<Podcast>> = ref([]);
89
+ const dfirst = ref(props.first);
90
+ const dsize = ref(props.size);
91
+ const searchPattern = ref("");
92
+ const isMobile = ref(false);
90
93
 
91
- data() {
92
- return {
93
- loading: true as boolean,
94
- podcasts: [] as Array<Podcast>,
95
- podcastsQuery: [] as Array<Podcast>,
96
- size: 30 as number,
97
- first: 0 as number,
98
- searchPattern: "" as string,
99
- isMobile: false as boolean,
100
- };
101
- },
94
+ //Composables
95
+ const { t } = useI18n();
96
+ const {handle403} = useErrorHandler();
97
+ const { isEditRights } = useOrgaComputed();
102
98
 
103
- computed: {
104
- titleList(): string {
105
- return this.notEmptyPlaylist
106
- ? this.$t("Podcasts in the playlist")
107
- : this.$t("No podcasts in the playlist");
108
- },
109
- notEmptyPlaylist(): boolean {
110
- return 0 !== Object.keys(this.playlist.samplingViews ?? []).length;
111
- },
112
- podcastsDisplay(): Array<Podcast> {
113
- if (this.isMobile) {
114
- return this.podcastsQuery.slice(
115
- 0,
116
- Math.min(this.first + this.size, this.podcasts.length),
117
- );
118
- }
119
- return this.podcastsQuery.slice(
120
- this.first,
121
- Math.min(this.first + this.size, this.podcasts.length),
122
- );
123
- },
124
- editRight(): boolean {
125
- return this.isEditRights(this.playlist.organisation?.id);
126
- },
127
- },
128
- watch: {
129
- searchPattern(): void {
130
- if ("" !== this.searchPattern) {
131
- this.podcastsQuery = this.podcasts.filter((el: Podcast) => {
132
- return el.title
133
- .toLowerCase()
134
- .includes(this.searchPattern.toLowerCase());
135
- });
136
- } else {
137
- this.podcastsQuery = this.podcasts;
138
- }
139
- },
140
- },
99
+ //Computed
100
+ const titleList = computed(() => notEmptyPlaylist.value? t("Podcasts in the playlist"): t("No podcasts in the playlist"));
101
+ const notEmptyPlaylist = computed(() => 0 !== Object.keys(props.playlist.samplingViews ?? []).length);
102
+ const podcastsDisplay = computed(() => {
103
+ if (isMobile.value) {
104
+ return podcastsQuery.value.slice(
105
+ 0,
106
+ Math.min(dfirst.value + dsize.value, podcasts.value.length),
107
+ );
108
+ }
109
+ return podcastsQuery.value.slice(
110
+ dfirst.value,
111
+ Math.min(dfirst.value + dsize.value, podcasts.value.length),
112
+ );
113
+ });
114
+ const editRight = computed(() =>isEditRights(props.playlist.organisation?.id));
141
115
 
142
- created() {
143
- this.fetchContent();
144
- },
145
- methods: {
146
- async fetchContent(): Promise<void> {
147
- if (this.notEmptyPlaylist) {
148
- this.podcasts.length = 0;
149
- this.loading = true;
150
- try {
151
- this.podcasts = await classicApi.fetchData<Array<Podcast>>({
152
- api: 0,
153
- path: "playlist/" + this.playlist.playlistId + "/content",
154
- });
155
- if (!this.editRight) {
156
- this.podcasts = this.podcasts.filter((p: Podcast | null) => {
157
- return (
158
- null !== p &&
159
- (!p.availability || true === p.availability.visibility)
160
- );
161
- });
162
- }
163
- this.podcastsQuery = this.podcasts;
164
- } catch (error) {
165
- this.handle403(error as AxiosError);
166
- }
167
- }
168
- this.loading = false;
169
- },
170
- },
116
+ //Watch
117
+ watch(searchPattern,() => {
118
+ emit('update:query', searchPattern.value);
119
+ if ("" !== searchPattern.value) {
120
+ podcastsQuery.value = podcasts.value.filter((el: Podcast) => {
121
+ return el.title
122
+ .toLowerCase()
123
+ .includes(searchPattern.value.toLowerCase());
124
+ });
125
+ } else {
126
+ podcastsQuery.value = podcasts.value;
127
+ }
171
128
  });
129
+
130
+ onBeforeMount(()=>fetchContent());
131
+
132
+
133
+ //Methods
134
+ async function fetchContent(): Promise<void> {
135
+ if (notEmptyPlaylist.value) {
136
+ podcasts.value.length = 0;
137
+ loading.value = true;
138
+ try {
139
+ podcasts.value = await classicApi.fetchData<Array<Podcast>>({
140
+ api: 0,
141
+ path: "playlist/" + props.playlist.playlistId + "/content",
142
+ });
143
+ if (!editRight.value) {
144
+ podcasts.value = podcasts.value.filter((p: Podcast | null) => {
145
+ return (
146
+ null !== p &&
147
+ (!p.availability || true === p.availability.visibility)
148
+ );
149
+ });
150
+ }
151
+ podcastsQuery.value = podcasts.value;
152
+ searchPattern.value = props.query ?? "";
153
+ } catch (error) {
154
+ handle403(error as AxiosError);
155
+ }
156
+ }
157
+ loading.value = false;
158
+ }
172
159
  </script>
173
160
 
@@ -2,7 +2,7 @@
2
2
  <PodcastInlineListTemplate
3
3
  v-if="loading || (!loading && 0 !== allPodcasts.length)"
4
4
  :display-arrow="false"
5
- :button-text="$t('See more')"
5
+ :button-text="t('See more')"
6
6
  :button-plus="true"
7
7
  :title="playlist?.title ?? ''"
8
8
  :href="'/main/pub/playlist/' + playlistId"
@@ -11,7 +11,7 @@
11
11
  <template #list-inline>
12
12
  <ClassicLoading
13
13
  class="loading-size"
14
- :loading-text="loading ? $t('Loading podcasts ...') : undefined"
14
+ :loading-text="loading ? t('Loading podcasts ...') : undefined"
15
15
  />
16
16
  <SwiperList
17
17
  v-if="!loading"
@@ -29,7 +29,7 @@
29
29
  </PodcastInlineListTemplate>
30
30
  </template>
31
31
 
32
- <script lang="ts">
32
+ <script setup lang="ts">
33
33
  import classicApi from "../../../api/classicApi";
34
34
  import PodcastInlineListTemplate from "../podcasts/PodcastInlineListTemplate.vue";
35
35
  import PodcastItem from "../podcasts/PodcastItem.vue";
@@ -38,75 +38,63 @@ import ClassicLoading from "../../form/ClassicLoading.vue";
38
38
  import { useAuthStore } from "../../../stores/AuthStore";
39
39
  import { Podcast } from "@/stores/class/general/podcast";
40
40
  import { Playlist } from "@/stores/class/general/playlist";
41
- import { defineComponent } from "vue";
42
- import { mapState } from "pinia";
43
- export default defineComponent({
44
- name: "PodcastPlaylistInlineList",
41
+ import { onMounted, Ref, ref, watch } from "vue";
42
+ import { useI18n } from "vue-i18n";
45
43
 
46
- components: {
47
- PodcastItem,
48
- ClassicLoading,
49
- PodcastInlineListTemplate,
50
- SwiperList,
51
- },
44
+ //Props
45
+ const props = defineProps({
46
+ playlistId: { default: undefined, type: Number },
47
+ sizeItemOverload: { default: undefined, type: Number }
48
+ })
52
49
 
53
- props: {
54
- playlistId: { default: undefined, type: Number },
55
- sizeItemOverload: { default: undefined, type: Number },
56
- },
50
+ //Data
51
+ const loading = ref(true);
52
+ const totalCount = ref(0);
53
+ const playlist: Ref<Playlist | undefined> = ref(undefined);
54
+ const allPodcasts: Ref<Array<Podcast>> = ref([]);
57
55
 
58
- data() {
59
- return {
60
- loading: true as boolean,
61
- totalCount: 0 as number,
62
- playlist: undefined as Playlist | undefined,
63
- allPodcasts: [] as Array<Podcast>,
64
- };
65
- },
66
- computed: {
67
- ...mapState(useAuthStore, ["authOrgaId", "isRoleAdmin"]),
68
- },
69
- watch: {
70
- playlistId(): void {
71
- this.reset();
72
- this.fetchContent();
73
- },
74
- },
75
- mounted() {
76
- this.fetchContent();
77
- },
78
- methods: {
79
- async fetchContent(): Promise<void> {
80
- this.allPodcasts.length = 0;
81
- this.loading = true;
82
- this.playlist = await classicApi.fetchData<Playlist>({
83
- api: 0,
84
- path: "playlist/" + this.playlistId,
85
- });
86
- this.allPodcasts = await classicApi.fetchData<Array<Podcast>>({
87
- api: 0,
88
- path: "playlist/" + this.playlistId + "/content",
89
- });
90
- if (
91
- !(
92
- (undefined !== this.authOrgaId &&
93
- this.authOrgaId === this.playlist?.organisation?.id) ||
94
- this.isRoleAdmin
95
- )
96
- ) {
97
- this.allPodcasts = this.allPodcasts.filter((p: Podcast | null) => {
98
- return (
99
- null !== p &&
100
- (!p.availability || true === p.availability.visibility)
101
- );
102
- });
103
- }
104
- this.loading = false;
105
- },
106
- reset(): void {
107
- this.totalCount = 0;
108
- this.allPodcasts.length = 0;
109
- },
110
- },
56
+ //Composables
57
+ const { t } = useI18n();
58
+ const authStore = useAuthStore();
59
+
60
+ //Watch
61
+ watch(()=>props.playlistId, () => {
62
+ reset();
63
+ fetchContent();
111
64
  });
65
+
66
+ onMounted(()=>fetchContent())
67
+
68
+ //Methods
69
+ async function fetchContent(): Promise<void> {
70
+ allPodcasts.value.length = 0;
71
+ loading.value = true;
72
+ playlist.value = await classicApi.fetchData<Playlist>({
73
+ api: 0,
74
+ path: "playlist/" + props.playlistId,
75
+ });
76
+ allPodcasts.value = await classicApi.fetchData<Array<Podcast>>({
77
+ api: 0,
78
+ path: "playlist/" + props.playlistId + "/content",
79
+ });
80
+ if (
81
+ !(
82
+ (undefined !== authStore.authOrgaId &&
83
+ authStore.authOrgaId === playlist.value?.organisation?.id) ||
84
+ authStore.isRoleAdmin
85
+ )
86
+ ) {
87
+ allPodcasts.value = allPodcasts.value.filter((p: Podcast | null) => {
88
+ return (
89
+ null !== p &&
90
+ (!p.availability || true === p.availability.visibility)
91
+ );
92
+ });
93
+ }
94
+ loading.value = false;
95
+ }
96
+ function reset(): void {
97
+ totalCount.value = 0;
98
+ allPodcasts.value.length = 0;
99
+ }
112
100
  </script>