@saooti/octopus-sdk 31.0.26 → 31.0.29

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 (59) hide show
  1. package/README.md +7 -1
  2. package/package.json +2 -1
  3. package/src/assets/bootstrap-diff.scss +3 -34
  4. package/src/assets/general.scss +0 -1
  5. package/src/assets/share.scss +3 -0
  6. package/src/components/display/comments/AddCommentModal.vue +1 -1
  7. package/src/components/display/comments/CommentInput.vue +2 -2
  8. package/src/components/display/comments/CommentItem.vue +1 -1
  9. package/src/components/display/comments/CommentList.vue +1 -1
  10. package/src/components/display/emission/EmissionInlineList.vue +1 -1
  11. package/src/components/display/emission/EmissionList.vue +1 -1
  12. package/src/components/display/live/LiveHorizontalList.vue +1 -1
  13. package/src/components/display/playlist/PlaylistList.vue +1 -1
  14. package/src/components/display/playlist/PodcastList.vue +1 -1
  15. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +1 -1
  16. package/src/components/display/podcasts/PodcastImage.vue +15 -9
  17. package/src/components/display/podcasts/PodcastInlineList.vue +43 -309
  18. package/src/components/display/podcasts/PodcastInlineListClassic.vue +246 -0
  19. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +158 -0
  20. package/src/components/display/podcasts/PodcastList.vue +1 -1
  21. package/src/components/display/podcasts/PodcastModuleBox.vue +3 -26
  22. package/src/components/display/podcasts/PodcastSwiperList.vue +209 -0
  23. package/src/components/display/sharing/ShareButtons.vue +1 -1
  24. package/src/components/display/sharing/ShareDistribution.vue +1 -1
  25. package/src/components/display/sharing/SharePlayer.vue +58 -97
  26. package/src/components/display/sharing/SharePlayerColors.vue +17 -15
  27. package/src/components/display/sharing/SharePlayerTypes.vue +15 -32
  28. package/src/components/display/sharing/SubscribeButtons.vue +44 -200
  29. package/src/components/form/ClassicCheckbox.vue +8 -8
  30. package/src/components/form/ClassicRadio.vue +9 -9
  31. package/src/components/form/ClassicSearch.vue +29 -29
  32. package/src/components/form/ClassicSelect.vue +12 -15
  33. package/src/components/misc/ErrorMessage.vue +6 -8
  34. package/src/components/misc/Footer.vue +63 -95
  35. package/src/components/misc/LeftMenu.vue +41 -89
  36. package/src/components/misc/Snackbar.vue +1 -1
  37. package/src/components/misc/TopBar.vue +41 -82
  38. package/src/components/misc/modal/ClipboardModal.vue +2 -9
  39. package/src/components/misc/modal/MessageModal.vue +3 -4
  40. package/src/components/misc/modal/NewsletterModal.vue +1 -1
  41. package/src/components/misc/modal/QrCodeModal.vue +2 -12
  42. package/src/components/misc/modal/ShareModalPlayer.vue +1 -1
  43. package/src/components/misc/player/PlayerCompact.vue +3 -3
  44. package/src/components/mixins/orgaComputed.ts +15 -0
  45. package/src/components/pages/Emission.vue +43 -86
  46. package/src/components/pages/Emissions.vue +27 -73
  47. package/src/components/pages/Error403Page.vue +1 -1
  48. package/src/components/pages/Home.vue +5 -12
  49. package/src/components/pages/Lives.vue +1 -6
  50. package/src/components/pages/Participant.vue +34 -48
  51. package/src/components/pages/Participants.vue +10 -28
  52. package/src/components/pages/Playlist.vue +20 -31
  53. package/src/components/pages/Playlists.vue +5 -15
  54. package/src/components/pages/Podcast.vue +95 -116
  55. package/src/components/pages/Podcasts.vue +34 -93
  56. package/src/components/pages/Rubrique.vue +6 -17
  57. package/src/components/pages/Search.vue +16 -36
  58. package/src/sass/_variables.scss +1 -1
  59. package/src/store/paramStore.ts +13 -11
package/README.md CHANGED
@@ -581,6 +581,10 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
581
581
  * 30.0.82 Cherry pick Color Qr code
582
582
  * 30.0.83 Locales parlement
583
583
  * 30.0.84 Une émission non visible n'apparaît pas dans la page émission
584
+ * 30.0.85 PB en cliquant sur le bouton "tous les épisodes de l'organisation" dans la page d'un épisode
585
+ * 30.0.86 Podcastmaker newest
586
+ * 30.0.87 Podcastmaker newest (swiper list)
587
+ * 30.0.88 Podcastmaker newest (swiper list)
584
588
 
585
589
  * 31.0.0 Passage en 31
586
590
  * 31.0.1 Ajout pocket casts
@@ -609,4 +613,6 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
609
613
  * 31.0.24 Amélioration accessibilité
610
614
  * 31.0.25 Erreur audioUrl
611
615
  * 31.0.26 Erreur 403 page expose
612
-
616
+ * 31.0.27 Snackbar chose holdtime
617
+ * 31.0.28 Mixins orgComputed
618
+ * 31.0.29 Changement css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "31.0.26",
3
+ "version": "31.0.29",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -28,6 +28,7 @@
28
28
  "qrcode.vue": "^3.3.3",
29
29
  "sass": "^1.49.11",
30
30
  "sass-loader": "^12.6.0",
31
+ "swiper": "^8.1.5",
31
32
  "v-calendar": "^3.0.0-alpha.8",
32
33
  "vue": "^3.2.31",
33
34
  "vue-i18n": "^9.2.0-beta.34",
@@ -27,38 +27,6 @@
27
27
  &:hover{
28
28
  background: rgba($octopus-primary-color, 0.3) ;
29
29
  }
30
- // Button Primary
31
- &.btn-primary {
32
- background: $octopus-third-color;
33
- background: -moz-linear-gradient(-45deg, $octopus-third-color 0%, $octopus-primary-linear-background 100%);
34
- background: -webkit-gradient(left top, right bottom, color-stop(0%, $octopus-third-color), color-stop(100%, $octopus-primary-linear-background));
35
- background: -webkit-linear-gradient(-45deg, $octopus-third-color 0%, $octopus-primary-linear-background 100%);
36
- background: -o-linear-gradient(-45deg, $octopus-third-color 0%, $octopus-primary-linear-background 100%);
37
- background: -ms-linear-gradient(-45deg, $octopus-third-color 0%, $octopus-primary-linear-background 100%);
38
- background: linear-gradient(135deg, $octopus-third-color 0%, $octopus-primary-linear-background 100%);
39
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d6d91f', endColorstr='#50b685', GradientType=1 );
40
- border-radius: 50px;
41
- height: auto;
42
- border: 0;
43
- color: black !important;
44
- &:focus,
45
- &:hover {
46
- background:$octopus-third-color;
47
- background: -moz-linear-gradient(-45deg, darken($octopus-third-color,7%) 0%, darken($octopus-primary-linear-background, 7%) 100%);
48
- background: -webkit-gradient(left top, right bottom, color-stop(0%, darken($octopus-third-color,7%)), color-stop(100%, darken($octopus-primary-linear-background, 7%)));
49
- background: -webkit-linear-gradient(-45deg, darken($octopus-third-color,7%) 0%, darken($octopus-primary-linear-background, 7%) 100%);
50
- background: -o-linear-gradient(-45deg, darken($octopus-third-color,7%) 0%, darken($octopus-primary-linear-background, 7%) 100%);
51
- background: -ms-linear-gradient(-45deg, darken($octopus-third-color,7%) 0%, darken($octopus-primary-linear-background, 7%) 100%);
52
- background: linear-gradient(135deg, darken($octopus-third-color,7%) 0%, darken($octopus-primary-linear-background, 7%) 100%);
53
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d6d91f', endColorstr='#4fcf91', GradientType=1 );
54
- border: 0;
55
- }
56
- &:active,
57
- &.active {
58
- background: darken($octopus-primary-linear-background, 4%);
59
- border-color: darken($octopus-primary-linear-background, 7%);
60
- }
61
- }
62
30
  //Button disable halo after click
63
31
  &.btn-underline{
64
32
  background: none;
@@ -74,12 +42,13 @@
74
42
  }
75
43
  }
76
44
 
77
- &.btn-link {
45
+ &.btn-primary {
78
46
  display: flex;
79
47
  align-items: center;
80
48
  justify-content: center;
81
49
  background: $octopus-primary-dark;
82
- border: 2px solid $octopus-primary-dark;
50
+ border: 1px solid $octopus-primary-dark;
51
+ border-radius: 4px !important;
83
52
  color: white;
84
53
  font-weight: bold;
85
54
  &:focus,
@@ -95,7 +95,6 @@ body{
95
95
  .page-box{
96
96
  background-color: $octopus-background;
97
97
  padding: 2rem 5rem 5rem 6rem;
98
- border-radius: 2rem 2rem 0 0;
99
98
  @media (max-width: 1400px) {
100
99
  padding: 2rem;
101
100
  }
@@ -233,5 +233,8 @@
233
233
  @media (max-width: 960px) {
234
234
  width: 200px;
235
235
  }
236
+ @media (max-width: 200px) {
237
+ width: 90%;
238
+ }
236
239
  }
237
240
  }
@@ -53,7 +53,7 @@
53
53
  </button>
54
54
  <button
55
55
  v-if="!sending"
56
- class="btn btn-link m-1"
56
+ class="btn btn-primary m-1"
57
57
  :disabled="0 === countName || !validName"
58
58
  @click="validateName"
59
59
  >
@@ -33,7 +33,7 @@
33
33
  {{ $t('Cancel') }}
34
34
  </button>
35
35
  <button
36
- class="btn btn-link m-1"
36
+ class="btn btn-primary m-1"
37
37
  :disabled="0 === countName || !validName"
38
38
  @click="validEdit"
39
39
  >
@@ -64,7 +64,7 @@
64
64
  {{ $t('Cancel') }}
65
65
  </button>
66
66
  <button
67
- class="btn btn-link"
67
+ class="btn btn-primary"
68
68
  :disabled="0 === countComment || !validComment"
69
69
  @mousedown="requestToSend"
70
70
  >
@@ -39,7 +39,7 @@
39
39
  {{ $t('Cancel') }}
40
40
  </button>
41
41
  <button
42
- class="btn btn-link m-1"
42
+ class="btn btn-primary m-1"
43
43
  :disabled="0 === countComment || !validComment || 0 === countName || !validName"
44
44
  @click="validEdit"
45
45
  >
@@ -25,7 +25,7 @@
25
25
  </transition-group>
26
26
  <button
27
27
  v-show="!allFetched && (!loading || 0!==first)"
28
- class="btn btn-link mt-2"
28
+ class="btn btn-primary mt-2"
29
29
  :class="comId ? 'align-self-start' : 'align-self-center'"
30
30
  :disabled="loading"
31
31
  :title="$t('See more comments')"
@@ -57,7 +57,7 @@
57
57
  </transition-group>
58
58
  <router-link
59
59
  :to="href"
60
- class="btn btn-link align-self-center width-fit-content m-4"
60
+ class="btn btn-primary align-self-center width-fit-content m-4"
61
61
  >
62
62
  {{
63
63
  buttonText
@@ -41,7 +41,7 @@
41
41
  <button
42
42
  v-show="!allFetched"
43
43
  class="btn"
44
- :class="buttonPlus ? 'btn-link align-self-center width-fit-content m-4' : 'btn-more'"
44
+ :class="buttonPlus ? 'btn-primary align-self-center width-fit-content m-4' : 'btn-more'"
45
45
  :disabled="loading"
46
46
  :title="$t('See more')"
47
47
  @click="fetchContent(false)"
@@ -16,7 +16,7 @@
16
16
  <button
17
17
  v-show="!allFetched"
18
18
  class="btn"
19
- :class="buttonPlus ? 'btn-link align-self-center width-fit-content m-4 mt-3' : 'btn-more'"
19
+ :class="buttonPlus ? 'btn-primary align-self-center width-fit-content m-4 mt-3' : 'btn-more'"
20
20
  :disabled="inFetching"
21
21
  :title="$t('See more')"
22
22
  @click="displayMore"
@@ -19,7 +19,7 @@
19
19
  <button
20
20
  v-show="!allFetched && loaded"
21
21
  class="btn"
22
- :class="buttonPlus ? 'btn-link align-self-center width-fit-content m-4':'btn-more'"
22
+ :class="buttonPlus ? 'btn-primary align-self-center width-fit-content m-4':'btn-more'"
23
23
  :disabled="inFetching"
24
24
  :title="$t('See more')"
25
25
  @click="displayMore"
@@ -40,7 +40,7 @@
40
40
  <button
41
41
  v-show="size < podcasts.length && loaded"
42
42
  class="btn"
43
- :class="buttonPlus ? 'btn-link align-self-center width-fit-content m-4':'btn-more'"
43
+ :class="buttonPlus ? 'btn-primary align-self-center width-fit-content m-4':'btn-more'"
44
44
  :title="$t('See more')"
45
45
  @click="displayMore"
46
46
  >
@@ -47,7 +47,7 @@
47
47
  />
48
48
  </transition-group>
49
49
  <router-link
50
- class="btn btn-link align-self-center width-fit-content m-4"
50
+ class="btn btn-primary align-self-center width-fit-content m-4"
51
51
  :to="{
52
52
  name: 'playlist',
53
53
  params: { playlistId: playlistId.toString() },
@@ -237,6 +237,9 @@ export default defineComponent({
237
237
  'PENDING' === this.fetchConference.status)
238
238
  );
239
239
  },
240
+ clickPlayGoPage():boolean{
241
+ return (state.podcastPage.clickPlayGoPage as boolean);
242
+ },
240
243
  },
241
244
  watch: {
242
245
  arrowDirection(): void {
@@ -265,16 +268,19 @@ export default defineComponent({
265
268
  }
266
269
  if (!this.recordingLive) {
267
270
  this.$store.commit('playerPlayPodcast', this.podcast);
268
- return;
271
+ }else{
272
+ this.$store.commit('playerPlayPodcast', {
273
+ title: this.podcast.title,
274
+ audioUrl: this.podcast.audioUrl,
275
+ duration: this.podcast.duration,
276
+ conferenceId: this.fetchConference ? this.fetchConference.conferenceId : undefined,
277
+ livePodcastId: this.podcast.podcastId,
278
+ organisation: this.podcast.organisation,
279
+ });
280
+ }
281
+ if(this.clickPlayGoPage){
282
+ this.$router.push('/main/pub/podcast/'+this.podcast.podcastId);
269
283
  }
270
- this.$store.commit('playerPlayPodcast', {
271
- title: this.podcast.title,
272
- audioUrl: this.podcast.audioUrl,
273
- duration: this.podcast.duration,
274
- conferenceId: this.fetchConference ? this.fetchConference.conferenceId : undefined,
275
- livePodcastId: this.podcast.podcastId,
276
- organisation: this.podcast.organisation,
277
- });
278
284
  },
279
285
  showDescription(): void {
280
286
  if (this.isDescription) {
@@ -1,108 +1,52 @@
1
1
  <template>
2
- <div
3
- v-if="loading || (!loading && 0 !== allPodcasts.length)"
4
- class="d-flex flex-column p-3"
5
- >
6
- <h2>{{ title }}</h2>
7
- <div class="d-flex justify-content-between">
8
- <div class="d-flex">
9
- <button
10
- class="btn btn-underline"
11
- :class="{ active: !popularSort }"
12
- @click="sortChrono()"
13
- >
14
- {{ $t('Last added') }}
15
- </button>
16
- <button
17
- class="btn btn-underline"
18
- :class="{ active: popularSort }"
19
- @click="sortPopular()"
20
- >
21
- {{ $t('Most popular') }}
22
- </button>
23
- </div>
24
- <div
25
- v-if="!isArrow && !overflowScroll"
26
- class="hide-phone"
27
- >
28
- <button
29
- class="btn admin-button m-1"
30
- :class="{ disabled: !previousAvailable }"
31
- :title="$t('Display previous')"
32
- @click="displayPrevious()"
33
- >
34
- <div class="saooti-left fw-bold" />
35
- </button>
36
- <button
37
- class="btn admin-button m-1"
38
- :class="{ disabled: !nextAvailable }"
39
- :title="$t('Display next')"
40
- @click="displayNext()"
41
- >
42
- <div class="saooti-right fw-bold" />
43
- </button>
44
- </div>
45
- </div>
46
- <ClassicLoading
47
- :loading-text="loading?$t('Loading podcasts ...'):undefined"
48
- />
49
- <transition-group
50
- v-show="loaded"
51
- :name="transitionName"
52
- class="element-list-inline"
53
- tag="ul"
54
- :class="[
55
- alignLeft ? 'justify-content-start' : '',
56
- overflowScroll ? 'overflowScroll' : '',
57
- ]"
58
- :css="isInlineAnimation"
59
- >
60
- <PodcastItem
61
- v-for="p in podcasts"
62
- :key="p.podcastId"
63
- class="flex-shrink-0 item-phone-margin"
64
- :podcast="p"
65
- :class="[alignLeft ? 'me-3' : '']"
66
- />
67
- </transition-group>
68
- <router-link
69
- class="btn btn-link align-self-center width-fit-content m-4"
70
- :to="refTo"
71
- @click="handleSeeMoreButton"
72
- >
73
- {{ buttonText }}
74
- <div
75
- v-if="buttonPlus"
76
- class="ms-1 saooti-more"
77
- />
78
- </router-link>
79
- </div>
2
+ <PodcastInlineListClassic
3
+ v-if="listTypeClassic"
4
+ :organisation-id="organisationId"
5
+ :emission-id="emissionId"
6
+ :iab-id="iabId"
7
+ :title="title"
8
+ :href="href"
9
+ :button-text="buttonText"
10
+ :is-arrow="isArrow"
11
+ :require-popular-sort="requirePopularSort"
12
+ :button-plus="buttonPlus"
13
+ :rubrique-id="rubriqueId"
14
+ :rubriquage-id="rubriquageId"
15
+ :no-rubriquage-id="noRubriquageId"
16
+ :query="query"
17
+ @update:isArrow="$emit('update:isArrow',$event)"
18
+ />
19
+ <PodcastSwiperList
20
+ v-else
21
+ :organisation-id="organisationId"
22
+ :emission-id="emissionId"
23
+ :iab-id="iabId"
24
+ :title="title"
25
+ :href="href"
26
+ :button-text="buttonText"
27
+ :is-arrow="isArrow"
28
+ :require-popular-sort="requirePopularSort"
29
+ :button-plus="buttonPlus"
30
+ :rubrique-id="rubriqueId"
31
+ :rubriquage-id="rubriquageId"
32
+ :no-rubriquage-id="noRubriquageId"
33
+ :query="query"
34
+ @update:isArrow="$emit('update:isArrow',$event)"
35
+ />
80
36
  </template>
81
37
 
82
38
  <script lang="ts">
83
- import { handle403 } from '../../mixins/handle403';
84
- import octopusApi from '@saooti/octopus-api';
85
- import domHelper from '../../../helper/dom';
86
- import PodcastItem from './PodcastItem.vue';
87
- import ClassicLoading from '../../form/ClassicLoading.vue';
88
- const PHONE_WIDTH = 960;
89
39
  import { state } from '../../../store/paramStore';
90
- import { Podcast } from '@/store/class/general/podcast';
91
- import { RubriquageFilter } from '@/store/class/rubrique/rubriquageFilter';
92
- import { defineComponent } from 'vue'
93
- import { RouteLocationRaw } from 'vue-router';
94
- import { AxiosError } from 'axios';
95
- import { Rubrique } from '@/store/class/rubrique/rubrique';
40
+ import { defineAsyncComponent, defineComponent } from 'vue';
41
+ const PodcastInlineListClassic = defineAsyncComponent(() => import('./PodcastInlineListClassic.vue'));
42
+ const PodcastSwiperList = defineAsyncComponent(() => import('./PodcastSwiperList.vue'));
96
43
  export default defineComponent({
97
44
  name: 'PodcastInlineList',
98
45
 
99
46
  components: {
100
- PodcastItem,
101
- ClassicLoading
47
+ PodcastInlineListClassic,
48
+ PodcastSwiperList,
102
49
  },
103
-
104
- mixins: [handle403],
105
-
106
50
  props: {
107
51
  organisationId: { default: undefined, type: String},
108
52
  emissionId: { default: undefined, type: Number},
@@ -119,220 +63,10 @@ export default defineComponent({
119
63
  query: { default: undefined, type: String},
120
64
  },
121
65
  emits: ['update:isArrow'],
122
-
123
- data() {
124
- return {
125
- loading: true as boolean,
126
- loaded: true as boolean,
127
- index: 0 as number,
128
- first: 0 as number,
129
- size: 5 as number,
130
- totalCount: 0 as number,
131
- popularSort: false as boolean,
132
- allPodcasts: [] as Array<Podcast>,
133
- direction: 1 as number,
134
- alignLeft: false as boolean,
135
- };
136
- },
137
- computed: {
138
- podcasts(): Array<Podcast> {
139
- return this.allPodcasts.slice(this.index, this.index + this.size);
140
- },
141
- sizeItem(): number {
142
- return state.generalParameters.podcastItem ? (state.generalParameters.podcastItem as number): 13;
143
- },
144
- overflowScroll(): boolean {
145
- return (state.emissionPage.overflowScroll as boolean);
146
- },
147
- isInlineAnimation(): boolean {
148
- return (state.generalParameters.isInlineAnimation as boolean);
149
- },
150
- filterOrga(): string {
151
- return this.$store.state.filter.organisationId;
152
- },
153
- organisation(): string|undefined {
154
- if (this.organisationId) return this.organisationId;
155
- if (this.filterOrga) return this.filterOrga;
156
- return undefined;
66
+ computed:{
67
+ listTypeClassic(): boolean {
68
+ return (state.podcastPage.listTypeClassic as boolean);
157
69
  },
158
- rubriqueQueryParam(): string|undefined{
159
- if(this.$store.state.filter && this.$store.state.filter.rubriqueFilter && this.$store.state.filter.rubriqueFilter.length){
160
- return this.$store.state.filter.rubriqueFilter.map((value: RubriquageFilter) => value.rubriquageId+':'+value.rubriqueId).join();
161
- }
162
- return undefined;
163
- },
164
- refTo(): string | RouteLocationRaw {
165
- if (this.href) return this.href;
166
- if(this.iabId){
167
- return {
168
- name: 'category',
169
- params:{ 'iabId': this.iabId },
170
- query: { productor: this.$store.state.filter.organisationId },
171
- };
172
- }
173
- return {
174
- name: 'podcasts',
175
- query: { productor: this.$store.state.filter.organisationId,
176
- iabId: this.$store.state.filter.iab ? this.$store.state.filter.iab.id : undefined,
177
- rubriquesId: this.rubriqueQueryParam },
178
- };
179
- },
180
- previousAvailable(): boolean {
181
- return this.index > 0;
182
- },
183
- nextAvailable(): boolean {
184
- return this.index + this.size < this.totalCount;
185
- },
186
- transitionName(): string {
187
- return this.direction > 0 ? 'out-left' : 'out-right';
188
- },
189
- watchVariable():string{
190
- return `${this.emissionId}|${this.organisationId}|${this.filterOrga}|${this.iabId}|${this.rubriqueId}|${this.rubriquageId}|${this.query}`;
191
- }
192
- },
193
- watch: {
194
- watchVariable(): void {
195
- this.reset();
196
- this.fetchNext();
197
- },
198
- },
199
-
200
- created() {
201
- if (undefined !== this.requirePopularSort) {
202
- this.popularSort = this.requirePopularSort;
203
- }
204
- if (undefined !== this.isArrow) {
205
- this.$emit('update:isArrow', true);
206
- }
207
- window.addEventListener('resize', this.handleResize);
208
- },
209
-
210
- unmounted() {
211
- window.removeEventListener('resize', this.handleResize);
212
- },
213
-
214
- mounted() {
215
- this.handleResize();
216
- this.fetchNext();
217
- },
218
- methods: {
219
- handleSeeMoreButton(event: { preventDefault: () => void; }){
220
- if(!this.rubriqueId || this.noRubriquageId.length){
221
- return;
222
- }
223
- event.preventDefault();
224
- const rubriqueChosenId = this.rubriqueId[this.rubriqueId.length - 1];
225
- let filterToAdd: RubriquageFilter = {
226
- rubriquageId: 0,
227
- rubriqueId: rubriqueChosenId,
228
- nameRubriquage: '',
229
- nameRubrique: ''
230
- };
231
- if(this.$store.state.filter.rubriquageArray.length){
232
- const rubriqueChosen = this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriques.find((element: Rubrique) => element.rubriqueId === rubriqueChosenId);
233
- filterToAdd = {
234
- rubriquageId: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriquageId,
235
- rubriqueId: rubriqueChosenId,
236
- nameRubriquage: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].title,
237
- nameRubrique: rubriqueChosen.name
238
- };
239
- }
240
- const newFilter: Array<RubriquageFilter> = Array.from(this.$store.state.filter.rubriqueFilter);
241
- newFilter.push(filterToAdd);
242
- this.$store.commit('filterRubrique', newFilter);
243
- const queries = this.$route.query;
244
- const queryString = newFilter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
245
- this.$router.push({ name: 'podcasts',query: { ...queries, ...{ rubriquesId: queryString }} });
246
- },
247
- async fetchNext(): Promise<void> {
248
- try {
249
- const data = await octopusApi.fetchPodcasts({
250
- first: this.first,
251
- size: this.size + 1,
252
- organisationId: this.organisation,
253
- emissionId: this.emissionId,
254
- iabId: this.iabId,
255
- rubriqueId: this.rubriqueId.length ?this.rubriqueId:undefined,
256
- rubriquageId: this.rubriquageId.length ?this.rubriquageId : undefined,
257
- noRubriquageId: this.noRubriquageId.length ? this.noRubriquageId : undefined,
258
- sort: this.popularSort ? 'POPULARITY' : 'DATE',
259
- query: this.query,
260
- });
261
- this.loading = false;
262
- this.loaded = true;
263
- this.totalCount = data.count;
264
- if (this.allPodcasts.length + data.result.length < this.totalCount) {
265
- const nexEl = data.result.pop() as Podcast;
266
- this.preloadImage(nexEl.imageUrl?nexEl.imageUrl:'');
267
- }
268
- this.allPodcasts = this.allPodcasts.concat(
269
- data.result.filter((pod: Podcast|null) => null !== pod)
270
- );
271
- if (this.allPodcasts.length <= 3) {
272
- this.alignLeft = true;
273
- } else {
274
- this.alignLeft = false;
275
- }
276
- this.first += this.size;
277
- } catch (error) {
278
- this.handle403((error as AxiosError));
279
- }
280
- },
281
- displayPrevious(): void {
282
- this.direction = -1;
283
- if (this.previousAvailable) {
284
- this.index -= 1;
285
- }
286
- },
287
- displayNext(): void {
288
- this.direction = 1;
289
- if (!this.nextAvailable) return;
290
- if (
291
- this.first - (this.index + this.size) < 2 &&
292
- this.allPodcasts.length < this.totalCount
293
- ) {
294
- this.fetchNext();
295
- }
296
- this.index += 1;
297
- },
298
- handleResize(): void {
299
- if (!this.$el) return;
300
- if (this.overflowScroll) {
301
- this.size = 20;
302
- return;
303
- }
304
- if (window.innerWidth <= PHONE_WIDTH) {
305
- this.size = 10;
306
- return;
307
- }
308
- const width = (this.$el as HTMLElement).offsetWidth;
309
- const sixteen = domHelper.convertRemToPixels(this.sizeItem + 0.7);
310
- this.size = Math.floor(width / sixteen);
311
- },
312
- sortPopular(): void {
313
- if (this.popularSort) return;
314
- this.popularSort = true;
315
- this.reset();
316
- this.fetchNext();
317
- },
318
- sortChrono(): void {
319
- if (!this.popularSort) return;
320
- this.popularSort = false;
321
- this.reset();
322
- this.fetchNext();
323
- },
324
- reset(): void {
325
- this.loading = true;
326
- this.loaded = true;
327
- this.index = 0;
328
- this.first = 0;
329
- this.totalCount = 0;
330
- this.allPodcasts.length = 0;
331
- },
332
- preloadImage(url: string): void {
333
- const img = new Image();
334
- img.src = url;
335
- },
336
- },
70
+ }
337
71
  })
338
72
  </script>