@saooti/octopus-sdk 30.0.40 → 30.0.44

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.
package/README.md CHANGED
@@ -536,4 +536,8 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
536
536
  * 30.0.36 LiveList
537
537
  * 30.0.37 Commentaires
538
538
  * 30.0.38 EmissionList expose
539
- * 30.0.39 Listes inline taille item
539
+ * 30.0.39 Listes inline taille item
540
+ * 30.0.41 Inline list arrow
541
+ * 30.0.42 Resize rubriqueList
542
+ * 30.0.43 Resize rubriqueList
543
+ * 30.0.44 ProgressBar pour le soir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.40",
3
+ "version": "30.0.44",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -58,7 +58,7 @@
58
58
  @categoriesLength="checkIfCategories"
59
59
  />
60
60
  <RubriqueList
61
- v-else-if="rubriquageFilter.length !== rubriqueFilter.length"
61
+ v-else-if="isDisplay && rubriquageFilter.length !== rubriqueFilter.length"
62
62
  :rubriquages="rubriquageFilter"
63
63
  />
64
64
  </div>
@@ -11,7 +11,7 @@
11
11
  :title="$t('Display previous')"
12
12
  @click="displayPrevious()"
13
13
  >
14
- <div class="saooti-arrow-left2" />
14
+ <div class="saooti-left fw-bold" />
15
15
  </button>
16
16
  <button
17
17
  class="btn admin-button m-1"
@@ -19,7 +19,7 @@
19
19
  :title="$t('Display next')"
20
20
  @click="displayNext()"
21
21
  >
22
- <div class="saooti-arrow-right2" />
22
+ <div class="saooti-right fw-bold" />
23
23
  </button>
24
24
  </div>
25
25
  </div>
@@ -53,29 +53,61 @@
53
53
  class="border-top emission-item-border-color p-2 secondary-bg d-flex"
54
54
  >
55
55
  <div class="d-flex justify-content-between flex-grow-1">
56
- <router-link
57
- :to="{
58
- name: 'podcast',
59
- params: { podcastId: p.podcastId },
60
- query: { productor: $store.state.filter.organisationId },
61
- }"
62
- class="d-flex flex-column define-width text-dark"
63
- >
64
- <div class="fw-bold text-truncate">
65
- {{ p.title }}
66
- </div>
67
- <div
68
- :id="'description-podcast-container-' + p.podcastId"
69
- class="emission-description html-wysiwyg-content"
56
+ <div class="d-flex flex-column">
57
+ <router-link
58
+ :to="{
59
+ name: 'podcast',
60
+ params: { podcastId: p.podcastId },
61
+ query: { productor: $store.state.filter.organisationId },
62
+ }"
63
+ class="d-flex flex-column define-width text-dark"
70
64
  >
71
- <!-- eslint-disable vue/no-v-html -->
65
+ <div class="fw-bold text-truncate">
66
+ {{ p.title }}
67
+ </div>
72
68
  <div
73
- :id="'description-podcast-' + p.podcastId"
74
- v-html="urlify(p.description)"
75
- />
76
- <!-- eslint-enable -->
69
+ :id="'description-podcast-container-' + p.podcastId"
70
+ class="emission-description html-wysiwyg-content"
71
+ >
72
+ <!-- eslint-disable vue/no-v-html -->
73
+ <div
74
+ :id="'description-podcast-' + p.podcastId"
75
+ v-html="urlify(p.description)"
76
+ />
77
+ <!-- eslint-enable -->
78
+ </div>
79
+ </router-link>
80
+ <div
81
+ v-if="isProgressBar"
82
+ class="d-flex align-items-center"
83
+ >
84
+ <div class="me-2">
85
+ {{ playedTime(p) }}
86
+ </div>
87
+ <div class="position-relative flex-grow-1">
88
+ <div
89
+ class="progress flex-grow-1 c-hand"
90
+ @mouseup="seekTo($event, p)"
91
+ >
92
+ <div
93
+ class="progress-bar primary-bg"
94
+ role="progressbar"
95
+ aria-valuenow="0"
96
+ aria-valuemin="0"
97
+ aria-valuemax="100"
98
+ :style="'width: ' + percentProgress(p) + '%'"
99
+ />
100
+ <div
101
+ class="progress-bar-cursor"
102
+ :style="'left:' + percentProgress(p) + '%'"
103
+ />
104
+ </div>
105
+ </div>
106
+ <div class="ms-2">
107
+ {{ totalTime(p) }}
108
+ </div>
77
109
  </div>
78
- </router-link>
110
+ </div>
79
111
  <div
80
112
  v-if="
81
113
  $store.state.player.podcast !== p ||
@@ -125,6 +157,7 @@ import octopusApi from '@saooti/octopus-api';
125
157
  import { Emission } from '@/store/class/general/emission';
126
158
  import { Podcast } from '@/store/class/general/podcast';
127
159
  import { state } from '../../../store/paramStore';
160
+ import DurationHelper from '../../../helper/duration';
128
161
  import { displayMethods } from '../../mixins/functions';
129
162
  import { defineComponent } from 'vue'
130
163
  export default defineComponent({
@@ -157,6 +190,9 @@ export default defineComponent({
157
190
  organisationId(): string|undefined {
158
191
  return state.generalParameters.organisationId;
159
192
  },
193
+ isProgressBar(){
194
+ return (state.emissionsPage.progressBar as boolean);
195
+ },
160
196
  editRight(): boolean {
161
197
  if (
162
198
  (this.authenticated && this.organisationId === this.emission.orga.id) ||
@@ -185,6 +221,36 @@ export default defineComponent({
185
221
  }
186
222
  },
187
223
  methods: {
224
+ seekTo(event: MouseEvent, podcast: Podcast): void {
225
+ if(podcast!== this.$store.state.player.podcast){return;}
226
+ const rect = (event.currentTarget as Element).getBoundingClientRect();
227
+ const barWidth = (event.currentTarget as Element).clientWidth;
228
+ const x = event.clientX - rect.left;
229
+ const percentPosition = x / barWidth;
230
+ if (percentPosition * 100 >= this.percentLiveProgress) return;
231
+ const seekTime = this.$store.state.player.total * percentPosition;
232
+ this.$store.commit("playerSeekTime", seekTime);
233
+ },
234
+ percentProgress(podcast: Podcast): number{
235
+ if(podcast !== this.$store.state.player.podcast){
236
+ return 0;
237
+ }
238
+ if(!this.$store.state.player.elapsed){return 0;}
239
+ return this.$store.state.player.elapsed * 100;
240
+ },
241
+ playedTime(podcast: Podcast): string{
242
+ if(podcast === this.$store.state.player.podcast){
243
+ if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0) {
244
+ return DurationHelper.formatDuration(
245
+ Math.round(this.$store.state.player.elapsed * this.$store.state.player.total)
246
+ );
247
+ }
248
+ }
249
+ return '00:00';
250
+ },
251
+ totalTime(podcast: Podcast): string {
252
+ return DurationHelper.formatDuration(Math.round(podcast.duration/1000));
253
+ },
188
254
  async loadPodcasts(): Promise<void> {
189
255
  const nb = this.nbPodcasts ? this.nbPodcasts : 2;
190
256
  const data = await octopusApi.fetchPodcasts({
@@ -238,6 +304,17 @@ export default defineComponent({
238
304
  height: min-content;
239
305
  border-radius: 0.8rem;
240
306
  overflow: hidden;
307
+ .progress{
308
+ height: 6px;
309
+ }
310
+ .progress-bar-cursor{
311
+ width: 10px;
312
+ height: 10px;
313
+ border-radius: 50%;
314
+ background: black;
315
+ align-self: center;
316
+ position: absolute;
317
+ }
241
318
  .emission-item-border-color {
242
319
  border-color: #ddd;
243
320
  }
@@ -31,7 +31,7 @@
31
31
  :title="$t('Display previous')"
32
32
  @click="displayPrevious()"
33
33
  >
34
- <div class="saooti-arrow-left2" />
34
+ <div class="saooti-left fw-bold" />
35
35
  </button>
36
36
  <button
37
37
  class="btn admin-button m-1"
@@ -39,7 +39,7 @@
39
39
  :title="$t('Display next')"
40
40
  @click="displayNext()"
41
41
  >
42
- <div class="saooti-arrow-right2" />
42
+ <div class="saooti-right fw-bold" />
43
43
  </button>
44
44
  </div>
45
45
  </div>
@@ -113,7 +113,9 @@ export default defineComponent({
113
113
  if(!this.rubriquage){ return ;}
114
114
  this.$store.commit('filterRubriqueDisplay', this.rubriquage.rubriques);
115
115
  window.addEventListener('resize', this.resizeWindow);
116
- this.resizeWindow();
116
+ this.$nextTick(() => {
117
+ this.resizeWindow();
118
+ });
117
119
  },
118
120
  addFilter(rubrique: Rubrique): void{
119
121
  if(!this.rubriquage){ return ;}
@@ -123,6 +123,7 @@ export default defineComponent({
123
123
  if(!state.player.elapsed){return 0;}
124
124
  return state.player.elapsed * 100;
125
125
  },
126
+ playerSeekTime: (state: StoreState) => state.player.seekTime,
126
127
  }),
127
128
  audioUrl(): string {
128
129
  if (this.media) return this.media.audioUrl? this.media.audioUrl:"";
@@ -150,6 +151,15 @@ export default defineComponent({
150
151
  },
151
152
 
152
153
  watch: {
154
+ playerSeekTime(){
155
+ if(!this.playerSeekTime){return;}
156
+ if (this.$store.state.player.podcast || this.$store.state.player.live) {
157
+ this.notListenTime = this.playerSeekTime - this.listenTime;
158
+ }
159
+ const audioPlayer: HTMLAudioElement | null = document.querySelector('#audio-player');
160
+ if (!audioPlayer) return;
161
+ audioPlayer.currentTime = this.playerSeekTime;
162
+ },
153
163
  live: {
154
164
  deep: true,
155
165
  async handler(){
@@ -24,13 +24,6 @@
24
24
  :title="$t('Without rubric')"
25
25
  :button-text="$t('All podcast button', { name: $t('Without rubric') })"
26
26
  />
27
- <PodcastInlineList
28
- v-if="rubriqueDisplay && rubriqueDisplay.length"
29
- :no-rubriquage-id="[rubriqueDisplay[0].rubriquageId]"
30
- :rubrique-id="rubriqueId"
31
- :title="$t('Without rubric')"
32
- :button-text="$t('All podcast button', { name: $t('Without rubric') })"
33
- />
34
27
  </template>
35
28
  </div>
36
29
  </template>
@@ -77,6 +77,9 @@ export default createStore({
77
77
  playerVolume(state, volume) {
78
78
  state.player.volume = volume;
79
79
  },
80
+ playerSeekTime(state, seekTime) {
81
+ state.player.seekTime = seekTime;
82
+ },
80
83
 
81
84
  filterOrga(state, filter) {
82
85
  state.filter.organisationId = filter.orgaId;
@@ -10,4 +10,5 @@ export interface Player{
10
10
  media: Media|undefined;
11
11
  live: Podcast|undefined;
12
12
  stop?: boolean;
13
+ seekTime?: number;
13
14
  }
@@ -50,6 +50,7 @@ const state:paramStore = {
50
50
  buttonMore: false,
51
51
  overflowScroll: false,
52
52
  titleInImage: false,
53
+ progressBar:false
53
54
  },
54
55
  emissionPage: {
55
56
  ouestFranceStyle: false,
@@ -136,6 +137,7 @@ export interface EmissionsPage{
136
137
  buttonMore?: boolean,
137
138
  overflowScroll?: boolean,
138
139
  titleInImage?: boolean,
140
+ progressBar?:boolean
139
141
  }
140
142
  export interface EmissionPage{
141
143
  ouestFranceStyle?: boolean,
@@ -199,6 +199,7 @@ export function emptyPodcastData(): Podcast{
199
199
  total: 0,
200
200
  media: undefined ,
201
201
  live: undefined ,
202
+ seekTime:0,
202
203
  },
203
204
 
204
205
  navigator: {