@saooti/octopus-sdk 30.0.19 → 30.0.23

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 (63) hide show
  1. package/README.md +5 -1
  2. package/package.json +2 -2
  3. package/src/assets/bootstrap-diff.scss +30 -84
  4. package/src/assets/form.scss +6 -3
  5. package/src/assets/general.scss +14 -3
  6. package/src/assets/share.scss +17 -43
  7. package/src/components/display/aggregator/RssSection.vue +1 -3
  8. package/src/components/display/categories/CategoryChooser.vue +1 -3
  9. package/src/components/display/categories/CategoryFilter.vue +5 -4
  10. package/src/components/display/categories/CategoryList.vue +4 -15
  11. package/src/components/display/comments/AddCommentModal.vue +35 -50
  12. package/src/components/display/comments/CommentBasicView.vue +96 -0
  13. package/src/components/display/comments/CommentInput.vue +22 -28
  14. package/src/components/display/comments/CommentItem.vue +56 -148
  15. package/src/components/display/comments/CommentList.vue +56 -112
  16. package/src/components/display/comments/CommentParentInfo.vue +17 -57
  17. package/src/components/display/comments/CommentPlayer.vue +2 -7
  18. package/src/components/display/comments/CommentSection.vue +9 -24
  19. package/src/components/display/edit/EditBox.vue +0 -2
  20. package/src/components/display/edit/EditCommentBox.vue +123 -23
  21. package/src/components/display/emission/EmissionChooser.vue +1 -3
  22. package/src/components/display/emission/EmissionInlineList.vue +2 -2
  23. package/src/components/display/emission/EmissionItem.vue +1 -2
  24. package/src/components/display/emission/EmissionList.vue +5 -2
  25. package/src/components/display/filter/AdvancedSearch.vue +2 -2
  26. package/src/components/display/filter/CategoryFilter.vue +0 -2
  27. package/src/components/display/filter/MonetizableFilter.vue +1 -3
  28. package/src/components/display/filter/ProductorSearch.vue +2 -2
  29. package/src/components/display/filter/RubriqueChoice.vue +1 -3
  30. package/src/components/display/filter/RubriqueFilter.vue +1 -3
  31. package/src/components/display/live/CountDown.vue +1 -3
  32. package/src/components/display/live/LiveHorizontalList.vue +6 -5
  33. package/src/components/display/organisation/OrganisationChooser.vue +1 -3
  34. package/src/components/display/playlist/PlaylistItem.vue +2 -4
  35. package/src/components/display/playlist/PlaylistList.vue +6 -5
  36. package/src/components/display/playlist/PodcastList.vue +5 -2
  37. package/src/components/display/podcasts/ParticipantDescription.vue +1 -3
  38. package/src/components/display/podcasts/PodcastFilterList.vue +1 -3
  39. package/src/components/display/podcasts/PodcastImage.vue +1 -1
  40. package/src/components/display/podcasts/PodcastInlineList.vue +5 -7
  41. package/src/components/display/podcasts/PodcastList.vue +6 -5
  42. package/src/components/display/podcasts/PodcastModuleBox.vue +1 -3
  43. package/src/components/display/podcasts/TagList.vue +2 -1
  44. package/src/components/display/rubriques/RubriqueChooser.vue +1 -3
  45. package/src/components/display/rubriques/RubriqueList.vue +1 -1
  46. package/src/components/display/sharing/QrCode.vue +1 -3
  47. package/src/components/display/sharing/ShareDistribution.vue +1 -6
  48. package/src/components/display/sharing/SharePlayer.vue +1 -1
  49. package/src/components/display/sharing/SubscribeButtons.vue +3 -5
  50. package/src/components/display/studio/RecordingItemButton.vue +1 -3
  51. package/src/components/form/ClassicSearch.vue +21 -19
  52. package/src/components/misc/HomeDropdown.vue +74 -115
  53. package/src/components/misc/PlayerButtons.vue +1 -4
  54. package/src/components/misc/TopBar.vue +2 -2
  55. package/src/components/misc/modal/MessageModal.vue +2 -4
  56. package/src/components/misc/modal/QrCodeModal.vue +1 -3
  57. package/src/components/pages/Emission.vue +2 -6
  58. package/src/components/pages/Rubrique.vue +1 -3
  59. package/src/locale/en.ts +2 -0
  60. package/src/locale/fr.ts +2 -0
  61. package/src/sass/_variables.scss +10 -7
  62. package/src/store/AppStore.ts +0 -3
  63. package/src/store/typeAppStore.ts +0 -1
@@ -1,25 +1,14 @@
1
1
  <template>
2
2
  <div class="d-flex flex-column mt-3">
3
- <div
4
- v-if="loading"
5
- class="d-flex justify-content-center"
6
- >
7
- <div class="spinner-border me-3" />
8
- <h3 class="mt-2">
9
- {{ $t('Loading content ...') }}
10
- </h3>
11
- </div>
12
- <div
13
- v-if="error"
14
- class="text-danger align-self-center"
15
- >
16
- {{ $t('Comments loading error') }}
17
- </div>
3
+ <ClassicLoading
4
+ :loading-text="loading?$t('Loading content ...'):undefined"
5
+ :error-text="error?$t(`Comments loading error`):undefined"
6
+ />
18
7
  <transition-group
19
- v-show="loaded"
8
+ v-show="!loading"
20
9
  tag="div"
21
10
  name="comment-list"
22
- class="d-flex flex-column my-transition-list-comments"
11
+ class="my-transition-list-comments"
23
12
  >
24
13
  <CommentItem
25
14
  v-for="(c, indexCom) in comments"
@@ -35,12 +24,12 @@
35
24
  />
36
25
  </transition-group>
37
26
  <button
38
- v-show="!allFetched && loaded"
27
+ v-show="!allFetched && (!loading || 0!==first)"
39
28
  class="btn btn-primary mt-2"
40
29
  :class="comId ? 'align-self-start' : 'align-self-center'"
41
- :disabled="inFetching"
30
+ :disabled="loading"
42
31
  :title="$t('See more comments')"
43
- @click="displayMore"
32
+ @click="fetchContent(false)"
44
33
  >
45
34
  {{ $t('See more comments') }}
46
35
  </button>
@@ -48,10 +37,10 @@
48
37
  </template>
49
38
 
50
39
  <script lang="ts">
40
+ import ClassicLoading from '../../form/ClassicLoading.vue';
51
41
  import { state } from '../../../store/paramStore';
52
42
  import octopusApi from '@saooti/octopus-api';
53
43
  import moment from 'moment';
54
-
55
44
  import { Podcast } from '@/store/class/general/podcast';
56
45
  import { Conference } from '@/store/class/conference/conference';
57
46
  import { CommentPodcast } from '@/store/class/general/comment';
@@ -65,11 +54,10 @@ export default defineComponent({
65
54
 
66
55
  components: {
67
56
  CommentItem,
57
+ ClassicLoading
68
58
  },
69
59
 
70
60
  props: {
71
- first: { default: 0, type: Number },
72
- size: { default: 50, type: Number },
73
61
  podcast: { default: undefined, type: Object as ()=>Podcast},
74
62
  comId: { default: undefined, type: Number },
75
63
  reload: { default: false, type: Boolean},
@@ -83,21 +71,19 @@ export default defineComponent({
83
71
  data() {
84
72
  return {
85
73
  loading: true as boolean,
86
- loaded: false as boolean,
87
74
  error: false as boolean,
88
- dfirst: this.first as number,
89
- dsize: this.size as number,
75
+ first:0 as number,
76
+ size: 20 as number,
90
77
  totalCount: 0 as number,
91
78
  comments: [] as Array<CommentPodcast>,
92
- inFetching: false as boolean,
93
79
  };
94
80
  },
95
81
 
96
82
  computed: {
97
83
  allFetched(): boolean {
98
- return this.dfirst >= this.totalCount;
84
+ return this.first >= this.totalCount;
99
85
  },
100
- organisationId(): string|undefined {
86
+ myOrganisationId(): string|undefined {
101
87
  return state.generalParameters.organisationId;
102
88
  },
103
89
  podcastId(): number|undefined {
@@ -108,8 +94,8 @@ export default defineComponent({
108
94
  if (
109
95
  (state.generalParameters.isCommments &&
110
96
  ((this.podcast &&
111
- this.organisationId === this.podcast.organisation.id) ||
112
- this.organisationId === this.organisation)) ||
97
+ this.myOrganisationId === this.podcast.organisation.id) ||
98
+ this.myOrganisationId === this.organisation)) ||
113
99
  state.generalParameters.isAdmin
114
100
  )
115
101
  return true;
@@ -118,10 +104,10 @@ export default defineComponent({
118
104
  },
119
105
  watch: {
120
106
  reload(): void {
121
- this.fetchContent(true);
107
+ this.fetchContent();
122
108
  },
123
109
  status(): void {
124
- this.fetchContent(true);
110
+ this.fetchContent();
125
111
  },
126
112
  comments: {
127
113
  deep: true,
@@ -131,121 +117,85 @@ export default defineComponent({
131
117
  },
132
118
  },
133
119
  created() {
134
- this.fetchContent(true);
120
+ this.fetchContent();
135
121
  },
136
122
  methods: {
137
- async fetchContent(reset: boolean): Promise<void> {
138
- this.inFetching = true;
139
- this.resetData(reset);
123
+ async fetchContent(reset=true): Promise<void> {
124
+ this.loading = true;
125
+ if(reset){
126
+ this.first = 0;
127
+ }
140
128
  let data;
141
129
  try {
142
- const param: FetchParam = {
143
- first: this.dfirst,
144
- size: this.dsize,
145
- podcastId: this.podcastId,
146
- };
147
- if (!this.editRight) {
148
- param.status = ['Valid'];
149
- }else if(this.status){
150
- param.status = [this.status];
151
- }
152
- if (undefined === this.podcastId) {
153
- param.organisationId = this.organisation;
154
- }
155
130
  if (this.comId) {
156
- data = await octopusApi.fetchCommentAnswers(this.comId, {first: this.dfirst,size: this.dsize});
157
- } else if (!this.isFlat) {
158
- data = await octopusApi.fetchRootComments(param);
159
- } else {
131
+ data = await octopusApi.fetchCommentAnswers(this.comId, {first: this.first,size: this.size});
132
+ }else{
160
133
  const param: FetchParam = {
161
- first: this.dfirst,
162
- size: this.dsize,
134
+ first: this.first,
135
+ size: this.size,
163
136
  podcastId: this.podcastId,
137
+ status:this.editRight && this.status?[this.status]:['Valid'],
138
+ organisationId: undefined === this.podcastId? this.organisation: undefined,
164
139
  };
165
- if (!this.editRight) {
166
- param.status = ['Valid'];
167
- }else if(this.status){
168
- param.status = [this.status];
169
- }
170
- if (undefined === this.podcastId) {
171
- param.organisationId = this.organisation;
172
- }
173
140
  if (!this.isFlat) {
174
141
  data = await octopusApi.fetchRootComments(param);
175
142
  } else {
176
143
  data = await octopusApi.fetchComments(param);
177
144
  }
178
145
  }
179
- this.resetData(reset);
180
- this.loading = false;
181
- this.loaded = true;
146
+ if(reset){
147
+ this.comments.length = 0;
148
+ }
182
149
  this.totalCount = data.totalElements;
183
150
  this.comments = this.comments.concat(data.content).filter((c: CommentPodcast) => {
184
151
  return null !== c;
185
152
  });
186
- this.dfirst += this.dsize;
187
- } catch (error) {
188
- this.loading = false;
153
+ this.first += this.size;
154
+ } catch {
189
155
  this.error = true;
190
156
  }
191
- this.inFetching = false;
157
+ this.loading = false;
192
158
  },
193
- resetData(reset: boolean): void {
194
- if (!reset) return;
195
- this.comments.length = 0;
196
- this.dfirst = 0;
197
- this.loading = true;
198
- this.loaded = false;
159
+ findCommentIndex(comId: number|undefined): number{
160
+ return this.comments.findIndex(
161
+ (element: CommentPodcast) => element.comId === comId
162
+ );
199
163
  },
200
- displayMore(event: { preventDefault: () => void }): void {
201
- event.preventDefault();
202
- this.fetchContent(false);
164
+ commentIsNotInList(commentIdReferer:undefined|number):boolean{
165
+ return !this.isFlat && undefined!==commentIdReferer && this.comId !==commentIdReferer;
203
166
  },
204
167
  deleteComment(comment: CommentPodcast): void {
205
- if (
206
- !this.isFlat &&
207
- comment.commentIdReferer &&
208
- this.comId !== comment.commentIdReferer
209
- ) {
168
+ if (this.commentIsNotInList(comment.commentIdReferer)){
210
169
  const comItem = (this.$refs['comItem' + comment.commentIdReferer] as InstanceType<typeof CommentItem>);
211
170
  comItem.receiveCommentEvent({ type: 'Delete', comment: comment });
212
171
  return;
213
172
  }
214
- const index = this.comments.findIndex(
215
- (element: CommentPodcast) => element.comId === comment.comId
216
- );
173
+ const index = this.findCommentIndex(comment.comId);
217
174
  if (-1 === index) return;
218
175
  this.totalCount -= 1;
219
- if (0 !== this.dfirst) {
220
- this.dfirst -= 1;
221
- }
176
+ /* if (0 !== this.first) {
177
+ this.first -= 1;
178
+ } */
222
179
  this.comments.splice(index, 1);
223
180
  },
224
181
  updateComment(data: {type?: string; comment: CommentPodcast; status?: string; oldStatus?:string }): void {
225
- if (
226
- !this.isFlat &&
227
- data.comment.commentIdReferer &&
228
- this.comId !== data.comment.commentIdReferer
229
- ) {
182
+ if (this.commentIsNotInList(data.comment.commentIdReferer)){
230
183
  const comItem = (this.$refs['comItem' + data.comment.commentIdReferer] as InstanceType<typeof CommentItem>);
231
184
  comItem.receiveCommentEvent({ ...data, type: 'Update' });
232
185
  return;
233
186
  }
234
- const index = this.comments.findIndex(
235
- (element: CommentPodcast) => element.comId === data.comment.comId
236
- );
187
+ const index = this.findCommentIndex(data.comment.comId);
237
188
  if (-1 !== index) {
238
- if (
239
- 'Valid' !== data.status &&
189
+ if ('Valid' !== data.status &&
240
190
  (!this.editRight || (this.status && this.status !== data.status))
241
191
  ) {
242
192
  this.comments.splice(index, 1);
243
193
  } else {
244
194
  this.comments.splice(index, 1, data.comment);
245
195
  }
246
- } else if (this.status === data.comment.status) {
196
+ }else if (this.status === data.comment.status) {
247
197
  this.comments.unshift(data.comment);
248
- } else if ('Valid' === data.status /* && !this.editRight */) {
198
+ } else if ('Valid' === data.status) {
249
199
  if (this.comments.length > 0) {
250
200
  let indexNewComment = -1;
251
201
  for (let i = 0, len = this.comments.length; i < len; i++) {
@@ -277,21 +227,15 @@ export default defineComponent({
277
227
  if (!myself && !this.editRight && 'Valid' !== comment.status) {
278
228
  return;
279
229
  }
280
- if (
281
- !this.isFlat &&
282
- comment.commentIdReferer &&
283
- this.comId !== comment.commentIdReferer
284
- ) {
230
+ if (this.commentIsNotInList(comment.commentIdReferer)){
285
231
  const comItem = (this.$refs['comItem' + comment.commentIdReferer] as InstanceType<typeof CommentItem>);
286
232
  comItem.receiveCommentEvent({ type: 'Create', comment: comment });
287
233
  return;
288
234
  }
289
- const index = this.comments.findIndex(
290
- (element: CommentPodcast) => element.comId === comment.comId
291
- );
235
+ const index = this.findCommentIndex(comment.comId);
292
236
  if (-1 === index) {
293
237
  this.totalCount += 1;
294
- this.dfirst += 1;
238
+ /* this.first += 1; */
295
239
  if (!this.status || this.status === comment.status) {
296
240
  this.comments.unshift(comment);
297
241
  }
@@ -1,79 +1,41 @@
1
1
  <template>
2
2
  <div class="mt-2">
3
- <div
4
- v-if="loading"
5
- class="d-flex"
6
- >
7
- <div class="spinner-border me-3" />
8
- <div class="mt-2">
9
- {{ $t('Loading content ...') }}
10
- </div>
11
- </div>
12
- <div v-else>
13
- <div class="d-flex small-text">
14
- <b class="me-2">{{ comment.name }}</b>
15
- <img
16
- v-if="comment.certified"
17
- class="icon-certified"
18
- src="/img/certified.png"
19
- :title="$t('Certified account')"
20
- >
21
- <div class="me-2">
22
- {{ date }}
23
- </div>
24
- </div>
25
- <div>{{ contentDisplay }}</div>
26
- <a
27
- v-if="comment.content.length > 300"
28
- class="c-hand font-italic"
29
- @click="summary = !summary"
30
- >{{ readMore }}</a>
31
- </div>
3
+ <ClassicLoading
4
+ :loading-text="loading?$t('Loading content ...'):undefined"
5
+ />
6
+ <CommentBasicView
7
+ v-if="!loading"
8
+ :comment="comment"
9
+ :edit-right="editRight"
10
+ />
32
11
  </div>
33
12
  </template>
34
13
 
35
14
  <script lang="ts">
36
15
  import octopusApi from '@saooti/octopus-api';
37
- import moment from 'moment';
16
+ import CommentBasicView from './CommentBasicView.vue';
17
+ import ClassicLoading from '../../form/ClassicLoading.vue';
38
18
  import { CommentPodcast } from '@/store/class/general/comment';
39
19
  import { defineComponent } from 'vue'
40
20
  export default defineComponent({
41
21
  name: 'CommentParentInfo',
42
22
 
23
+ components:{
24
+ CommentBasicView,
25
+ ClassicLoading
26
+ },
27
+
43
28
  props: {
44
29
  comId: { default: undefined, type: Number },
30
+ editRight: { default: false, type: Boolean},
45
31
  },
46
32
 
47
33
  data() {
48
34
  return {
49
35
  loading: true as boolean,
50
- summary: true as boolean,
51
36
  comment: undefined as CommentPodcast|undefined,
52
37
  };
53
38
  },
54
-
55
-
56
- computed: {
57
- date(): string {
58
- if (this.comment && this.comment.date)
59
- return moment(this.comment.date).format('D MMMM YYYY HH[h]mm');
60
- return '';
61
- },
62
- limitContent(): string {
63
- if (!this.comment || !this.comment.content) return '';
64
- if (this.comment.content.length <= 300) return this.comment.content;
65
- return this.comment.content.substring(0, 300) + '...';
66
- },
67
- readMore(): string {
68
- if (this.summary) return this.$t('Read more').toString();
69
- return this.$t('Read less').toString();
70
- },
71
- contentDisplay(): string {
72
- if (this.summary) return this.limitContent;
73
- return this.comment && this.comment.content? this.comment.content : '';
74
- },
75
- },
76
-
77
39
  async created() {
78
40
  if(this.comId){
79
41
  this.comment = await octopusApi.fetchComment(this.comId);
@@ -81,6 +43,4 @@ export default defineComponent({
81
43
  this.loading = false;
82
44
  },
83
45
  })
84
- </script>
85
-
86
- <style lang="scss"></style>
46
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="comment-player-container comment-item-container">
2
+ <div class="comment-player-container">
3
3
  <div
4
4
  v-for="c in comments"
5
5
  :key="c.comId"
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
  <div
22
22
  v-if="displayContent"
23
- class="comment-content"
23
+ class="small-text mt-auto"
24
24
  >
25
25
  <div class="primary-color flex-shrink-0">
26
26
  {{ displayContent.name }}
@@ -95,10 +95,5 @@ export default defineComponent({
95
95
  margin-top: 20px;
96
96
  position: absolute;
97
97
  }
98
- .comment-content {
99
- margin-top: auto;
100
- font-size: 0.7rem;
101
- display: flex;
102
- }
103
98
  }
104
99
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="isComments"
4
- class="d-flex flex-column mt-3 module-box comment-item-container"
4
+ class="module-box"
5
5
  >
6
6
  <div class="d-flex align-items-center">
7
7
  <h2
@@ -18,7 +18,7 @@
18
18
  <button
19
19
  v-if="!isLive"
20
20
  :title="$t('Refresh')"
21
- class="saooti-refresh-stud btn btn-reload primary-color"
21
+ class="btn admin-button saooti-refresh-stud"
22
22
  @click="reloadComments"
23
23
  />
24
24
  </div>
@@ -115,7 +115,7 @@ export default defineComponent({
115
115
  this.knownIdentity = this.getCookie('comment-octopus-name');
116
116
  },
117
117
  methods: {
118
- updateFetch(value: { count: number }): void {
118
+ updateFetch(value: { count: number, comments: Array<CommentPodcast> }): void {
119
119
  this.loaded = true;
120
120
  this.$store.commit('setCommentLoaded', {
121
121
  ...value,
@@ -130,38 +130,23 @@ export default defineComponent({
130
130
  (this.$refs.commentList as InstanceType<typeof CommentListVue>).addNewComment(comment, true);
131
131
  },
132
132
  receiveCommentEvent(event: {type?: string; comment: CommentPodcast; status?: string; oldStatus?:string }): void {
133
+ const commentList = (this.$refs.commentList as InstanceType<typeof CommentListVue>);
133
134
  let statusUpdated = undefined;
134
135
  switch (event.type) {
135
- case 'Create':
136
- (this.$refs.commentList as InstanceType<typeof CommentListVue>).addNewComment(event.comment);
137
- break;
136
+ case 'Create':commentList.addNewComment(event.comment);break;
138
137
  case 'Update':
139
138
  if (event.comment.status !== event.oldStatus) {
140
139
  statusUpdated = event.comment.status;
141
140
  }
142
- (this.$refs.commentList as InstanceType<typeof CommentListVue>).updateComment({
141
+ commentList.updateComment({
143
142
  comment: event.comment,
144
143
  status: statusUpdated,
145
144
  });
146
145
  break;
147
- case 'Delete':
148
- (this.$refs.commentList as InstanceType<typeof CommentListVue>).deleteComment(event.comment);
149
- break;
150
- default:
151
- console.log('Event not handle');
152
- break;
146
+ case 'Delete':commentList.deleteComment(event.comment);break;
147
+ default:break;
153
148
  }
154
149
  },
155
150
  },
156
151
  })
157
- </script>
158
-
159
- <style lang="scss">
160
- .btn-reload {
161
- width: 40px;
162
- height: 40px;
163
- padding: 0;
164
- font-size: 1rem;
165
- font-weight: bold;
166
- }
167
- </style>
152
+ </script>
@@ -14,5 +14,3 @@ export default defineComponent({
14
14
  }
15
15
  })
16
16
  </script>
17
-
18
- <style lang="scss"></style>
@@ -1,53 +1,153 @@
1
1
  <template>
2
2
  <div class="d-flex">
3
3
  <button
4
- class="btn btn-comment-edit saooti-edit-bounty"
4
+ class="btn admin-button me-1"
5
5
  title="edit"
6
6
  @click="editComment"
7
- />
7
+ >
8
+ <span
9
+ class="saooti-edit-bounty"
10
+ :data-selenium="'Edit-Comment-' + seleniumFormat(comment.name)"
11
+ />
12
+ </button>
8
13
  <button
9
14
  v-if="'Pending' === comment.status || 'Invalid' === comment.status"
10
- class="btn btn-comment-edit saooti-valid-stud"
15
+ class="btn admin-button me-1"
11
16
  title="valid"
12
- @click="validComment"
13
- />
17
+ @click="commentModal('Valid')"
18
+ >
19
+ <span
20
+ class="saooti-valid-stud"
21
+ :data-selenium="'Validate-Comment-' + seleniumFormat(comment.name)"
22
+ />
23
+ </button>
14
24
  <button
15
25
  v-if="'Pending' === comment.status || 'Valid' === comment.status"
16
- class="btn btn-comment-edit saooti-cross"
26
+ class="btn admin-button me-1"
17
27
  title="invalid"
18
- @click="invalidComment"
19
- />
28
+ @click="commentModal('Invalid')"
29
+ >
30
+ <span
31
+ class="saooti-cross"
32
+ :data-selenium="'Invalidate-Comment-' + seleniumFormat(comment.name)"
33
+ />
34
+ </button>
35
+ <button
36
+ v-if="organisation"
37
+ class="btn admin-button me-1"
38
+ :title="$t('See more')"
39
+ @click="seeMore = true"
40
+ >
41
+ <span
42
+ class="saooti-more_vert"
43
+ :data-selenium="'More-Info-Comment-' + seleniumFormat(comment.name)"
44
+ />
45
+ </button>
20
46
  <button
21
- class="btn btn-comment-edit saooti-bin"
47
+ class="btn admin-button me-1"
22
48
  title="delete"
23
- @click="deleteComment"
49
+ @click="commentModal('Delete')"
50
+ >
51
+ <span
52
+ class="saooti-bin"
53
+ :data-selenium="'Trash-Comment-' + seleniumFormat(comment.name)"
54
+ />
55
+ </button>
56
+ <MessageModal
57
+ v-if="displayModal"
58
+ :validatetext="validateText"
59
+ :canceltext="canceltext"
60
+ :closable="false"
61
+ :title="modalTitle"
62
+ :message="modalMessage"
63
+ @cancel="displayModal = false"
64
+ @validate="deleteComment"
65
+ @close="displayModal = false"
24
66
  />
25
67
  </div>
26
68
  </template>
27
69
 
28
70
  <script lang="ts">
71
+ import { selenium } from '../../mixins/functions';
29
72
  import { CommentPodcast } from '@/store/class/general/comment';
30
- import { defineComponent } from 'vue'
73
+ import { defineComponent, defineAsyncComponent } from 'vue';
74
+ const MessageModal = defineAsyncComponent(
75
+ () => import('@/components/misc/modal/MessageModal.vue')
76
+ );
31
77
  export default defineComponent({
78
+ components: {
79
+ MessageModal,
80
+ },
81
+ mixins: [selenium],
82
+
32
83
  props: {
33
- comment: { default: undefined, type: Object as ()=>CommentPodcast},
84
+ comment: { default: () => ({}), type: Object as () => CommentPodcast },
85
+ organisation: { default: undefined, type: String },
86
+ },
87
+ emits: ['editComment', 'updateComment', 'deleteComment'],
88
+
89
+ data() {
90
+ return {
91
+ displayModal: false as boolean,
92
+ isDeleting: false as boolean,
93
+ type: 'update' as string,
94
+ seeMore: false as boolean,
95
+ };
96
+ },
97
+
98
+ computed: {
99
+ validateText(): string | undefined {
100
+ if ('Error' === this.type || 'Error403' === this.type)
101
+ return this.$t('Close').toString();
102
+ if (this.isDeleting) return undefined;
103
+ return this.$t('Yes').toString();
104
+ },
105
+ canceltext(): string | undefined {
106
+ if ('Error' === this.type || 'Error403' === this.type) return undefined;
107
+ return this.$t('No').toString();
108
+ },
109
+ modalMessage(): string {
110
+ switch (this.type) {
111
+ case 'Delete':
112
+ if (this.isDeleting)
113
+ return this.$t('Deleting in progress ...').toString();
114
+ return this.$t('Confirm comment deletion text', {
115
+ name: this.comment.name,
116
+ }).toString();
117
+ case 'Error':
118
+ return this.$t('Error occurs while updating your comment').toString();
119
+ case 'Error403':
120
+ return this.$t('403 error forbidden').toString();
121
+ default:
122
+ return '';
123
+ }
124
+ },
125
+ modalTitle(): string {
126
+ switch (this.type) {
127
+ case 'Delete':
128
+ return this.$t('Delete comment').toString();
129
+ case 'Error403':
130
+ case 'Error':
131
+ return this.$t('Error').toString();
132
+ default:
133
+ return this.$t('Update comment').toString();
134
+ }
135
+ },
34
136
  },
35
- emits: ['editComment'],
36
137
 
37
138
  methods: {
38
- editComment() {
139
+ editComment(): void {
39
140
  this.$emit('editComment');
40
141
  },
41
- validComment() {
42
- console.log('valid');
142
+ commentModal(type: string): void {
143
+ console.log('commentModal'+ type);
43
144
  },
44
- invalidComment() {
45
- console.log('invalid');
145
+ async updateComment(newComment?: CommentPodcast | undefined): Promise<void> {
146
+ console.log('updateComment' + newComment);
46
147
  },
47
- deleteComment() {
48
- console.log('delete');
148
+ async deleteComment(): Promise<void> {
149
+ console.log('deleteComment');
49
150
  },
50
151
  },
51
- })
52
- </script>
53
- <style lang="scss"></style>
152
+ });
153
+ </script>