@saooti/octopus-sdk 30.0.44 → 30.0.45

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
@@ -540,4 +540,5 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
540
540
  * 30.0.41 Inline list arrow
541
541
  * 30.0.42 Resize rubriqueList
542
542
  * 30.0.43 Resize rubriqueList
543
- * 30.0.44 ProgressBar pour le soir
543
+ * 30.0.44 ProgressBar pour le soir
544
+ * 30.0.45 ProgressBar pour le soir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.44",
3
+ "version": "30.0.45",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -77,36 +77,7 @@
77
77
  <!-- eslint-enable -->
78
78
  </div>
79
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>
109
- </div>
80
+ <PodcastPlayBar :podcast="p" />
110
81
  </div>
111
82
  <div
112
83
  v-if="
@@ -157,11 +128,15 @@ import octopusApi from '@saooti/octopus-api';
157
128
  import { Emission } from '@/store/class/general/emission';
158
129
  import { Podcast } from '@/store/class/general/podcast';
159
130
  import { state } from '../../../store/paramStore';
160
- import DurationHelper from '../../../helper/duration';
131
+ import PodcastPlayBar from '../podcasts/PodcastPlayBar.vue';
161
132
  import { displayMethods } from '../../mixins/functions';
162
133
  import { defineComponent } from 'vue'
163
134
  export default defineComponent({
164
135
  name: 'EmissionPlayerItem',
136
+
137
+ components:{
138
+ PodcastPlayBar
139
+ },
165
140
  mixins: [displayMethods],
166
141
  props: {
167
142
  emission: { default: ()=>({}), type: Object as ()=>Emission },
@@ -190,9 +165,6 @@ export default defineComponent({
190
165
  organisationId(): string|undefined {
191
166
  return state.generalParameters.organisationId;
192
167
  },
193
- isProgressBar(){
194
- return (state.emissionsPage.progressBar as boolean);
195
- },
196
168
  editRight(): boolean {
197
169
  if (
198
170
  (this.authenticated && this.organisationId === this.emission.orga.id) ||
@@ -221,36 +193,6 @@ export default defineComponent({
221
193
  }
222
194
  },
223
195
  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
- },
254
196
  async loadPodcasts(): Promise<void> {
255
197
  const nb = this.nbPodcasts ? this.nbPodcasts : 2;
256
198
  const data = await octopusApi.fetchPodcasts({
@@ -60,6 +60,10 @@
60
60
  {{ title }}
61
61
  </div>
62
62
  </router-link>
63
+ <PodcastPlayBar
64
+ :podcast="podcast"
65
+ class="mx-2"
66
+ />
63
67
  <div class="d-flex justify-content-between">
64
68
  <router-link
65
69
  v-if="!isPodcastmaker"
@@ -88,7 +92,7 @@ import { state } from '../../../store/paramStore';
88
92
  import moment from 'moment';
89
93
  // @ts-ignore
90
94
  import humanizeDuration from 'humanize-duration';
91
-
95
+ import PodcastPlayBar from '../podcasts/PodcastPlayBar.vue';
92
96
  import { Podcast } from '@/store/class/general/podcast';
93
97
  import { Category } from '@/store/class/general/category';
94
98
  import { defineComponent } from 'vue'
@@ -98,6 +102,7 @@ export default defineComponent({
98
102
  components: {
99
103
  AnimatorsItem,
100
104
  PodcastImage,
105
+ PodcastPlayBar
101
106
  },
102
107
 
103
108
  props: {
@@ -116,6 +116,9 @@
116
116
  :participants="podcast.guests"
117
117
  :is-guest="true"
118
118
  />
119
+ <PodcastPlayBar
120
+ :podcast="podcast"
121
+ />
119
122
  <div v-if="editRight && !isPodcastmaker">
120
123
  <div
121
124
  v-if="podcast.annotations && podcast.annotations.RSS"
@@ -152,6 +155,7 @@
152
155
  </template>
153
156
 
154
157
  <script lang="ts">
158
+ import PodcastPlayBar from './PodcastPlayBar.vue';
155
159
  import PodcastImage from './PodcastImage.vue';
156
160
  import ParticipantDescription from './ParticipantDescription.vue';
157
161
  import TagList from './TagList.vue';
@@ -174,6 +178,7 @@ export default defineComponent({
174
178
  ShareButtons,
175
179
  TagList,
176
180
  ErrorMessage,
181
+ PodcastPlayBar
177
182
  },
178
183
 
179
184
  mixins:[displayMethods],
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <div
3
+ v-if="isProgressBar"
4
+ class="d-flex align-items-center podcast-play-bar"
5
+ >
6
+ <div class="me-2">
7
+ {{ playedTime }}
8
+ </div>
9
+ <div class="position-relative flex-grow-1">
10
+ <div
11
+ class="progress flex-grow-1 c-hand"
12
+ @mouseup="seekTo"
13
+ >
14
+ <div
15
+ class="progress-bar primary-bg"
16
+ role="progressbar"
17
+ aria-valuenow="0"
18
+ aria-valuemin="0"
19
+ aria-valuemax="100"
20
+ :style="'width: ' + percentProgress + '%'"
21
+ />
22
+ <div
23
+ class="progress-bar-cursor"
24
+ :style="'left:' + percentProgress + '%'"
25
+ />
26
+ </div>
27
+ </div>
28
+ <div class="ms-2">
29
+ {{ totalTime }}
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script lang="ts">
35
+ import { Podcast } from '@/store/class/general/podcast';
36
+ import DurationHelper from '../../../helper/duration';
37
+ import { displayMethods } from '../../mixins/functions';
38
+ import { state } from '../../../store/paramStore';
39
+ import { defineComponent } from 'vue'
40
+ export default defineComponent({
41
+ name: 'PodcastPlayBar',
42
+ mixins: [displayMethods],
43
+ props: {
44
+ podcast: { default: ()=>({}), type: Object as ()=>Podcast },
45
+ },
46
+ computed: {
47
+ isProgressBar(): boolean{
48
+ return (state.emissionsPage.progressBar as boolean);
49
+ },
50
+ percentProgress(): number{
51
+ if(this.podcast !== this.$store.state.player.podcast){
52
+ return 0;
53
+ }
54
+ if(!this.$store.state.player.elapsed){return 0;}
55
+ return this.$store.state.player.elapsed * 100;
56
+ },
57
+ playedTime(): string{
58
+ if(this.podcast === this.$store.state.player.podcast){
59
+ if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0) {
60
+ return DurationHelper.formatDuration(
61
+ Math.round(this.$store.state.player.elapsed * this.$store.state.player.total)
62
+ );
63
+ }
64
+ }
65
+ return '00:00';
66
+ },
67
+ totalTime(): string {
68
+ return DurationHelper.formatDuration(Math.round(this.podcast.duration/1000));
69
+ },
70
+ },
71
+ methods: {
72
+ seekTo(event: MouseEvent): void {
73
+ if(this.podcast!== this.$store.state.player.podcast){return;}
74
+ const rect = (event.currentTarget as Element).getBoundingClientRect();
75
+ const barWidth = (event.currentTarget as Element).clientWidth;
76
+ const x = event.clientX - rect.left;
77
+ const percentPosition = x / barWidth;
78
+ if (percentPosition * 100 >= this.percentLiveProgress) return;
79
+ const seekTime = this.$store.state.player.total * percentPosition;
80
+ this.$store.commit("playerSeekTime", seekTime);
81
+ }
82
+ },
83
+ })
84
+ </script>
85
+
86
+ <style lang="scss">
87
+ .podcast-play-bar {
88
+ .progress{
89
+ height: 6px;
90
+ }
91
+ .progress-bar-cursor{
92
+ width: 10px;
93
+ height: 10px;
94
+ border-radius: 50%;
95
+ background: black;
96
+ align-self: center;
97
+ position: absolute;
98
+ }
99
+ }
100
+ </style>