@saooti/octopus-sdk 40.2.19 → 41.0.0-SNAPSHOT

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 (204) hide show
  1. package/package.json +2 -3
  2. package/src/App.vue +68 -88
  3. package/src/components/composable/player/usePlayerLive.ts +12 -3
  4. package/src/components/composable/player/usePlayerLogic.ts +6 -6
  5. package/src/components/composable/podcasts/usePodcastView.ts +3 -3
  6. package/src/components/composable/useInit.ts +2 -2
  7. package/src/components/composable/useMetaTitleWatch.ts +2 -2
  8. package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
  9. package/src/components/display/categories/CategoryChooser.vue +142 -145
  10. package/src/components/display/categories/CategoryFilter.vue +172 -198
  11. package/src/components/display/categories/CategoryList.vue +122 -147
  12. package/src/components/display/comments/CommentInput.vue +100 -122
  13. package/src/components/display/comments/CommentList.vue +169 -191
  14. package/src/components/display/comments/CommentName.vue +35 -45
  15. package/src/components/display/comments/CommentParentInfo.vue +28 -34
  16. package/src/components/display/comments/CommentPlayer.vue +38 -50
  17. package/src/components/display/comments/CommentSection.vue +85 -103
  18. package/src/components/display/comments/item/CommentBasicView.vue +48 -61
  19. package/src/components/display/comments/item/CommentItem.vue +101 -116
  20. package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
  21. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
  22. package/src/components/display/comments/like/LikeButton.vue +36 -41
  23. package/src/components/display/comments/like/LikeSection.vue +128 -136
  24. package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
  25. package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
  26. package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
  27. package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
  28. package/src/components/display/edit/EditBox.vue +6 -9
  29. package/src/components/display/edit/EditBoxRadio.vue +1 -5
  30. package/src/components/display/emission/EmissionInlineList.vue +82 -97
  31. package/src/components/display/emission/EmissionItem.vue +57 -69
  32. package/src/components/display/emission/EmissionList.vue +192 -218
  33. package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
  34. package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
  35. package/src/components/display/emission/EmissionPresentationList.vue +51 -61
  36. package/src/components/display/filter/AdvancedSearch.vue +154 -176
  37. package/src/components/display/filter/CategorySearchFilter.vue +43 -46
  38. package/src/components/display/filter/DateFilter.vue +76 -91
  39. package/src/components/display/filter/MonetizableFilter.vue +27 -30
  40. package/src/components/display/filter/ProductorSearch.vue +87 -90
  41. package/src/components/display/filter/RubriqueChoice.vue +58 -63
  42. package/src/components/display/filter/RubriqueFilter.vue +154 -169
  43. package/src/components/display/filter/SearchOrder.vue +35 -35
  44. package/src/components/display/list/ListPaginate.vue +80 -93
  45. package/src/components/display/list/PaginateParams.vue +36 -40
  46. package/src/components/display/list/PaginateSection.vue +113 -124
  47. package/src/components/display/list/SwiperList.vue +97 -109
  48. package/src/components/display/live/CountDown.vue +15 -9
  49. package/src/components/display/live/CountdownOctopus.vue +16 -10
  50. package/src/components/display/live/LiveHorizontalList.vue +95 -103
  51. package/src/components/display/live/LiveItem.vue +65 -73
  52. package/src/components/display/live/LiveList.vue +125 -137
  53. package/src/components/display/live/RadioCurrently.vue +66 -73
  54. package/src/components/display/live/RadioImage.vue +39 -50
  55. package/src/components/display/live/RadioItem.vue +9 -14
  56. package/src/components/display/live/RadioList.vue +39 -53
  57. package/src/components/display/live/RadioPlanning.vue +210 -222
  58. package/src/components/display/organisation/OrganisationChooser.vue +116 -122
  59. package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
  60. package/src/components/display/participant/ParticipantInlineList.vue +42 -58
  61. package/src/components/display/participant/ParticipantItem.vue +66 -74
  62. package/src/components/display/participant/ParticipantList.vue +119 -141
  63. package/src/components/display/playlist/PlaylistItem.vue +33 -46
  64. package/src/components/display/playlist/PlaylistList.vue +118 -144
  65. package/src/components/display/playlist/PodcastList.vue +79 -101
  66. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
  67. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
  68. package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
  69. package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
  70. package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
  71. package/src/components/display/podcasts/PodcastFilterList.vue +48 -53
  72. package/src/components/display/podcasts/PodcastImage.vue +96 -99
  73. package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
  74. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
  75. package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
  76. package/src/components/display/podcasts/PodcastItem.vue +48 -63
  77. package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
  78. package/src/components/display/podcasts/PodcastList.vue +183 -206
  79. package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
  80. package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
  81. package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
  82. package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
  83. package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
  84. package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
  85. package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
  86. package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
  87. package/src/components/display/podcasts/TagList.vue +48 -50
  88. package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
  89. package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
  90. package/src/components/display/rubriques/RubriqueList.vue +140 -160
  91. package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
  92. package/src/components/display/sharing/FormatSwitch.vue +16 -11
  93. package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
  94. package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
  95. package/src/components/display/sharing/PlayerParameters.vue +69 -71
  96. package/src/components/display/sharing/QrCode.vue +55 -67
  97. package/src/components/display/sharing/ShareAnonymous.vue +160 -178
  98. package/src/components/display/sharing/ShareDistribution.vue +103 -117
  99. package/src/components/display/sharing/ShareNewsletter.vue +154 -161
  100. package/src/components/display/sharing/SharePlayer.vue +273 -295
  101. package/src/components/display/sharing/SharePlayerColors.vue +25 -16
  102. package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
  103. package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
  104. package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
  105. package/src/components/display/sharing/SubscribeButtons.vue +184 -207
  106. package/src/components/display/studio/RecordingItemButton.vue +1 -4
  107. package/src/components/form/ClassicCheckbox.vue +26 -30
  108. package/src/components/form/ClassicContentEditable.vue +37 -33
  109. package/src/components/form/ClassicCopyButton.vue +40 -44
  110. package/src/components/form/ClassicDatePicker.vue +114 -114
  111. package/src/components/form/ClassicEmojiPicker.vue +20 -28
  112. package/src/components/form/ClassicInputText.vue +116 -120
  113. package/src/components/form/ClassicLoading.vue +7 -12
  114. package/src/components/form/ClassicMultiselect.vue +106 -116
  115. package/src/components/form/ClassicRadio.vue +21 -16
  116. package/src/components/form/ClassicRadioLabel.vue +23 -22
  117. package/src/components/form/ClassicSearch.vue +24 -19
  118. package/src/components/form/ClassicSelect.vue +47 -38
  119. package/src/components/form/ClassicWysiwyg.vue +116 -123
  120. package/src/components/icons/AmazonMusicIcon.vue +7 -10
  121. package/src/components/icons/ApplePodcastIcon.vue +7 -11
  122. package/src/components/icons/BlueSkyIcon.vue +8 -11
  123. package/src/components/icons/DeezerIcon.vue +8 -11
  124. package/src/components/icons/EditFtpIcon.vue +8 -11
  125. package/src/components/icons/IHeartIcon.vue +8 -11
  126. package/src/components/icons/PlayVideoIcon.vue +7 -10
  127. package/src/components/icons/PlayerFmIcon.vue +7 -10
  128. package/src/components/icons/PocketCastIcon.vue +8 -11
  129. package/src/components/icons/PodcastAddictIcon.vue +7 -10
  130. package/src/components/icons/RadiolineIcon.vue +8 -11
  131. package/src/components/icons/TuninIcon.vue +8 -11
  132. package/src/components/icons/XIcon.vue +7 -10
  133. package/src/components/misc/AcpmImage.vue +6 -7
  134. package/src/components/misc/ClassicAccordion.vue +26 -31
  135. package/src/components/misc/ClassicLazy.vue +86 -90
  136. package/src/components/misc/ClassicNav.vue +16 -20
  137. package/src/components/misc/ClassicPopover.vue +266 -282
  138. package/src/components/misc/ClassicSpinner.vue +5 -27
  139. package/src/components/misc/ErrorMessage.vue +11 -12
  140. package/src/components/misc/FooterGarSection.vue +33 -41
  141. package/src/components/misc/FooterSection.vue +109 -130
  142. package/src/components/misc/HomeDropdown.vue +83 -105
  143. package/src/components/misc/MobileMenu.vue +101 -111
  144. package/src/components/misc/ProgressBar.vue +53 -62
  145. package/src/components/misc/TopBar.vue +97 -120
  146. package/src/components/misc/TopBarMainContent.vue +114 -133
  147. package/src/components/misc/modal/ClassicModal.vue +40 -33
  148. package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
  149. package/src/components/misc/modal/ClipboardModal.vue +27 -30
  150. package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
  151. package/src/components/misc/modal/MessageModal.vue +50 -47
  152. package/src/components/misc/modal/NewsletterModal.vue +30 -31
  153. package/src/components/misc/modal/QrCodeModal.vue +21 -21
  154. package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
  155. package/src/components/misc/player/PlayerCompact.vue +6 -4
  156. package/src/components/misc/player/PlayerComponent.vue +8 -9
  157. package/src/components/misc/player/PlayerLarge.vue +9 -8
  158. package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
  159. package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
  160. package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
  161. package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
  162. package/src/components/misc/player/elements/PlayerImage.vue +51 -57
  163. package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
  164. package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
  165. package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
  166. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
  167. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
  168. package/src/components/misc/player/radio/RadioHistory.vue +80 -99
  169. package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
  170. package/src/components/misc/player/video/PlayerVideo.vue +27 -40
  171. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
  172. package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
  173. package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
  174. package/src/components/pages/CategoryPage.vue +28 -33
  175. package/src/components/pages/EmissionPage.vue +99 -132
  176. package/src/components/pages/EmissionsPage.vue +2 -0
  177. package/src/components/pages/Error403Page.vue +21 -20
  178. package/src/components/pages/HomePage.vue +91 -100
  179. package/src/components/pages/LivesPage.vue +35 -37
  180. package/src/components/pages/MapPage.vue +209 -241
  181. package/src/components/pages/PageLogout.vue +8 -11
  182. package/src/components/pages/PageNotFound.vue +9 -5
  183. package/src/components/pages/ParticipantPage.vue +82 -110
  184. package/src/components/pages/ParticipantsPage.vue +3 -0
  185. package/src/components/pages/PlaylistPage.vue +97 -115
  186. package/src/components/pages/PlaylistsPage.vue +9 -2
  187. package/src/components/pages/PodcastPage.vue +223 -238
  188. package/src/components/pages/PodcastsPage.vue +9 -2
  189. package/src/components/pages/RadioPage.vue +56 -70
  190. package/src/components/pages/RubriquePage.vue +7 -3
  191. package/src/components/pages/SearchPage.vue +31 -36
  192. package/src/components/pages/TagPage.vue +11 -9
  193. package/src/components/pages/VideoPage.vue +14 -11
  194. package/src/helper/displayHelper.ts +1 -1
  195. package/src/i18n.ts +2 -2
  196. package/src/main.ts +1 -1
  197. package/src/stores/class/general/player.ts +1 -0
  198. package/public/css/fonts/icomoon.eot +0 -0
  199. package/public/css/fonts/icomoon.svg +0 -113
  200. package/public/css/fonts/icomoon.ttf +0 -0
  201. package/public/css/fonts/icomoon.woff +0 -0
  202. package/public/css/fonts/icomoon.woff2 +0 -0
  203. package/public/css/fonts/style.css +0 -352
  204. package/sonarqube-scanner.js +0 -10
@@ -25,14 +25,14 @@
25
25
  class="btn btn-transparent"
26
26
  @click="answerComment"
27
27
  >
28
- {{ $t("To answer") }}
28
+ {{ t("To answer") }}
29
29
  </button>
30
30
  <button
31
31
  v-if="isFlatList && comment.answerTo"
32
32
  class="btn btn-transparent d-flex align-items-center"
33
33
  @click="showParentComment = !showParentComment"
34
34
  >
35
- {{ $t("In response to") }}
35
+ {{ t("In response to") }}
36
36
  <ChevronDownIcon :class="{ 'arrow-transform': showParentComment }" />
37
37
  </button>
38
38
  </div>
@@ -54,7 +54,7 @@
54
54
  @click="showAnswers = !showAnswers"
55
55
  >
56
56
  <ChevronDownIcon :class="{ 'arrow-transform': showAnswers }" />
57
- {{ $t("nb answers", { nb: comment.responses.length }) }}
57
+ {{ t("nb answers", { nb: comment.responses.length }) }}
58
58
  </button>
59
59
  <CommentList
60
60
  v-if="showAnswers"
@@ -77,19 +77,19 @@
77
77
  </div>
78
78
  </template>
79
79
 
80
- <script lang="ts">
80
+ <script setup lang="ts">
81
81
  import ChevronDownIcon from "vue-material-design-icons/ChevronDown.vue";
82
82
  import { CommentPodcast } from "@/stores/class/general/comment";
83
83
  import { Podcast } from "../../../../stores/class/general/podcast";
84
84
  import CommentBasicView from "./CommentBasicView.vue";
85
85
  import { useCommentStore } from "../../../../stores/CommentStore";
86
86
  import { useAuthStore } from "../../../../stores/AuthStore";
87
- import { mapActions, mapState } from "pinia";
88
- import { defineComponent, defineAsyncComponent } from "vue";
87
+ import { defineAsyncComponent, ref, Ref, computed } from "vue";
89
88
  import {
90
89
  CommentMessage,
91
90
  CommentsConfig,
92
91
  } from "../../../../stores/class/config/commentsConfig";
92
+ import { useI18n } from "vue-i18n";
93
93
  const CommentInput = defineAsyncComponent(() => import("../CommentInput.vue"));
94
94
  const CommentParentInfo = defineAsyncComponent(
95
95
  () => import("../CommentParentInfo.vue"),
@@ -101,121 +101,106 @@ const CommentMoreActions = defineAsyncComponent(
101
101
  () => import("./CommentMoreActions.vue"),
102
102
  );
103
103
  const CommentList = defineAsyncComponent(() => import("../CommentList.vue"));
104
- export default defineComponent({
105
- name: "CommentItem",
106
104
 
107
- components: {
108
- CommentInput,
109
- CommentList,
110
- CommentParentInfo,
111
- CommentBasicView,
112
- LikeSection,
113
- CommentMoreActions,
114
- ChevronDownIcon,
115
- },
116
105
 
117
- props: {
118
- comment: { default: () => ({}), type: Object as () => CommentPodcast },
119
- podcast: { default: undefined, type: Object as () => Podcast },
120
- isFlatList: { default: false, type: Boolean },
121
- config: { default: undefined, type: Object as () => CommentsConfig },
122
- organisationId: { default: undefined, type: String },
123
- },
106
+ //Props
107
+ const props = defineProps({
108
+ comment: { default: () => ({}), type: Object as () => CommentPodcast },
109
+ podcast: { default: undefined, type: Object as () => Podcast },
110
+ isFlatList: { default: false, type: Boolean },
111
+ config: { default: undefined, type: Object as () => CommentsConfig },
112
+ organisationId: { default: undefined, type: String },
113
+ })
124
114
 
125
- emits: ["deleteComment", "update:comment"],
115
+ //Emits
116
+ const emit = defineEmits(["deleteComment", "update:comment"]);
126
117
 
127
- data() {
128
- return {
129
- isAnsweringComment: false as boolean,
130
- showAnswers: false as boolean,
131
- focus: false as boolean,
132
- showParentComment: false as boolean,
133
- eventToHandle: undefined as CommentMessage | undefined,
134
- };
135
- },
136
- computed: {
137
- ...mapState(useAuthStore, ["authOrgaId", "isRoleComments", "isRoleAdmin"]),
138
- ...mapState(useCommentStore, ["commentUser"]),
139
- commentForVmodel: {
140
- get(): CommentPodcast {
141
- return this.comment;
142
- },
143
- set(value: CommentPodcast) {
144
- if (!this.eventActive) {
145
- this.$emit("update:comment", value);
146
- }
147
- },
148
- },
149
- isAnAnswer() {
150
- return undefined !== this.comment.answerTo;
151
- },
152
- editRight(): boolean {
153
- return (
154
- (true === this.isRoleComments &&
155
- (this.authOrgaId === this.podcast?.organisation.id ||
156
- this.authOrgaId === this.organisationId)) ||
157
- true === this.isRoleAdmin
158
- );
159
- },
160
- isValidComment() {
161
- return "VALIDATED" === this.comment.state;
162
- },
163
- canPostComment(): boolean {
164
- return this.getCanPostComment(
165
- this.config,
166
- this.podcast,
167
- undefined !== this.authOrgaId,
168
- );
169
- },
170
- eventActive(): boolean {
171
- return undefined !== this.podcast?.conferenceId;
172
- },
118
+ //Data
119
+ const isAnsweringComment = ref(false);
120
+ const showAnswers = ref(false);
121
+ const focus = ref(false);
122
+ const showParentComment = ref(false);
123
+ const eventToHandle : Ref<CommentMessage | undefined>= ref(undefined);
124
+
125
+ //Composables
126
+ const { t } = useI18n();
127
+ const authStore = useAuthStore();
128
+ const commentStore = useCommentStore();
129
+
130
+
131
+ //Computed
132
+ const commentForVmodel = computed({
133
+ get(): CommentPodcast {
134
+ return props.comment;
173
135
  },
174
- methods: {
175
- ...mapActions(useCommentStore, ["getCanPostComment"]),
176
- answerComment(): void {
177
- this.isAnsweringComment = true;
178
- this.focus = !this.focus;
179
- },
180
- newComment(comment: CommentPodcast): void {
181
- this.modifyAnswerNumber(comment.commentId);
182
- if (!this.eventActive) {
183
- this.eventToHandle = { type: "CREATE", comment: comment };
184
- }
185
- this.isAnsweringComment = false;
186
- },
187
- modifyAnswerNumber(commentId: number, isAdd = true) {
188
- const commentToEdit = this.comment;
189
- if (commentToEdit.responses) {
190
- if (this.isAdd) {
191
- commentToEdit.responses.push(commentId);
192
- } else {
193
- const index = commentToEdit.responses.indexOf(commentId);
194
- if (index !== -1) {
195
- commentToEdit.responses.splice(index, 1);
196
- }
197
- }
198
- } else if (isAdd) {
199
- commentToEdit.responses = [commentId];
200
- }
201
- this.$emit("update:comment", commentToEdit);
202
- },
203
- emitDeleteComment() {
204
- if (!this.eventActive) {
205
- this.$emit("deleteComment");
206
- }
207
- },
208
- receiveEvent(event: CommentMessage) {
209
- if ("CREATE" === event.type) {
210
- this.modifyAnswerNumber(event.comment.commentId);
211
- } else if ("DELETE" === event.type) {
212
- this.modifyAnswerNumber(event.comment.commentId, false);
213
- }
214
- this.eventToHandle = event;
215
- },
216
- updateForAnswerDeleted(commentId: number) {
217
- this.modifyAnswerNumber(commentId, false);
218
- },
136
+ set(value: CommentPodcast) {
137
+ if (!eventActive.value) {
138
+ emit("update:comment", value);
139
+ }
219
140
  },
220
141
  });
142
+ const isAnAnswer = computed(() => undefined !== props.comment.answerTo);
143
+ const editRight = computed(() => {
144
+ return (
145
+ (true === authStore.isRoleComments &&
146
+ (authStore.authOrgaId === props.podcast?.organisation.id ||
147
+ authStore.authOrgaId === props.organisationId)) ||
148
+ true === authStore.isRoleAdmin
149
+ );
150
+ });
151
+ const isValidComment = computed(() => "VALIDATED" === props.comment.state);
152
+ const canPostComment = computed(() => {
153
+ return commentStore.getCanPostComment(
154
+ props.config,
155
+ props.podcast,
156
+ undefined !== authStore.authOrgaId,
157
+ );
158
+ });
159
+ const eventActive = computed(() => undefined !== props.podcast?.conferenceId);
160
+
161
+
162
+ //Methods
163
+ function answerComment(): void {
164
+ isAnsweringComment.value = true;
165
+ focus.value = !focus.value;
166
+ }
167
+ function newComment(comment: CommentPodcast): void {
168
+ modifyAnswerNumber(comment.commentId);
169
+ if (!eventActive.value) {
170
+ eventToHandle.value = { type: "CREATE", comment: comment };
171
+ }
172
+ isAnsweringComment.value = false;
173
+ }
174
+ function modifyAnswerNumber(commentId: number, isAdd = true) {
175
+ const commentToEdit = props.comment;
176
+ if (commentToEdit.responses) {
177
+ if (isAdd) {
178
+ commentToEdit.responses.push(commentId);
179
+ } else {
180
+ const index = commentToEdit.responses.indexOf(commentId);
181
+ if (index !== -1) {
182
+ commentToEdit.responses.splice(index, 1);
183
+ }
184
+ }
185
+ } else if (isAdd) {
186
+ commentToEdit.responses = [commentId];
187
+ }
188
+ emit("update:comment", commentToEdit);
189
+ }
190
+ function emitDeleteComment() {
191
+ if (!eventActive.value) {
192
+ emit("deleteComment");
193
+ }
194
+ }
195
+ function receiveEvent(event: CommentMessage) {
196
+ if ("CREATE" === event.type) {
197
+ modifyAnswerNumber(event.comment.commentId);
198
+ } else if ("DELETE" === event.type) {
199
+ modifyAnswerNumber(event.comment.commentId, false);
200
+ }
201
+ eventToHandle.value = event;
202
+ }
203
+ function updateForAnswerDeleted(commentId: number) {
204
+ modifyAnswerNumber(commentId, false);
205
+ }
221
206
  </script>
@@ -26,7 +26,7 @@
26
26
  <button
27
27
  :id="'comment-dropdown' + comment.commentId"
28
28
  class="btn share-btn"
29
- :title="$t('See more')"
29
+ :title="t('See more')"
30
30
  :data-selenium="
31
31
  'comment-dropdown-' + seleniumFormat(comment.poster.userName)
32
32
  "
@@ -57,7 +57,7 @@
57
57
  </div>
58
58
  </template>
59
59
 
60
- <script lang="ts">
60
+ <script setup lang="ts">
61
61
  import DotsVerticalIcon from "vue-material-design-icons/DotsVertical.vue";
62
62
  import {useSelenium} from "../../../composable/useSelenium";
63
63
  import classicApi from "../../../../api/classicApi";
@@ -66,9 +66,9 @@ import { useAuthStore } from "../../../../stores/AuthStore";
66
66
  import { CommentPodcast } from "@/stores/class/general/comment";
67
67
  import { Podcast } from "@/stores/class/general/podcast";
68
68
  import { useCommentStore } from "../../../../stores/CommentStore";
69
- import { mapActions, mapState } from "pinia";
70
- import { defineComponent, defineAsyncComponent } from "vue";
69
+ import { defineAsyncComponent, ref, Ref, computed } from "vue";
71
70
  import { CommentsConfig } from "@/stores/class/config/commentsConfig";
71
+ import { useI18n } from "vue-i18n";
72
72
  const ClassicPopover = defineAsyncComponent(
73
73
  () => import("../../../misc/ClassicPopover.vue"),
74
74
  );
@@ -81,204 +81,189 @@ const EditCommentModal = defineAsyncComponent(
81
81
  const MessageModal = defineAsyncComponent(
82
82
  () => import("../../../misc/modal/MessageModal.vue"),
83
83
  );
84
- export default defineComponent({
85
- name: "CommentMoreActions",
86
84
 
87
- components: {
88
- ClassicPopover,
89
- ReportAbuseModal,
90
- CommentMoreActionsAdmin,
91
- EditCommentModal,
92
- MessageModal,
93
- DotsVerticalIcon,
94
- },
85
+ //Props
86
+ const props = defineProps({
87
+ comment: { default: () => ({}), type: Object as () => CommentPodcast },
88
+ podcast: { default: undefined, type: Object as () => Podcast },
89
+ config: { default: undefined, type: Object as () => CommentsConfig },
90
+ editRight: { default: false, type: Boolean },
91
+ })
95
92
 
96
- props: {
97
- comment: { default: () => ({}), type: Object as () => CommentPodcast },
98
- podcast: { default: undefined, type: Object as () => Podcast },
99
- config: { default: undefined, type: Object as () => CommentsConfig },
100
- editRight: { default: false, type: Boolean },
101
- },
93
+ //Emits
94
+ const emit = defineEmits(["update:comment", "deleteComment"]);
102
95
 
103
- emits: ["update:comment", "deleteComment"],
96
+ //Data
97
+ const isEdit = ref(false);
98
+ const isReportAbuse = ref(false);
99
+ const actionName: Ref<string | undefined> = ref(undefined);
100
+ const actionsAdmin: Ref<string | undefined> = ref(undefined);
101
+ const confirmModal = ref(false);
102
+ const actionInProgress = ref(false);
103
+ const isError = ref(false);
104
104
 
105
- setup(){
106
- const { seleniumFormat } = useSelenium();
107
- return { seleniumFormat }
105
+ //Composables
106
+ const { t } = useI18n();
107
+ const { seleniumFormat } = useSelenium();
108
+ const authStore = useAuthStore();
109
+ const commentStore = useCommentStore();
110
+
111
+ //Computed
112
+ const commentForVmodel = computed({
113
+ get(): CommentPodcast {
114
+ return props.comment;
108
115
  },
109
- data() {
110
- return {
111
- isEdit: false as boolean,
112
- isReportAbuse: false as boolean,
113
- actionName: undefined as string | undefined,
114
- actionsAdmin: undefined as string | undefined,
115
- confirmModal: false as boolean,
116
- actionInProgress: false as boolean,
117
- isError: false as boolean,
118
- };
116
+ set(value: CommentPodcast) {
117
+ emit("update:comment", value);
119
118
  },
120
- computed: {
121
- ...mapState(useAuthStore, ["authProfile", "authOrgaId"]),
122
- ...mapState(useCommentStore, ["commentUser"]),
123
- commentForVmodel: {
124
- get(): CommentPodcast {
125
- return this.comment;
126
- },
127
- set(value: CommentPodcast) {
128
- this.$emit("update:comment", value);
119
+ });
120
+ const isMyComment = computed(() => {
121
+ const uuid = authStore.authProfile?.userId ?? commentStore.commentUser?.uuidHash;
122
+ return uuid === props.comment?.poster.uuid;
123
+ });
124
+ const isAtLeastOneMoreAction = computed(() => {
125
+ return moreActions.value.some((el) => {
126
+ return el.condition;
127
+ });
128
+ });
129
+ const moreActions = computed(() => {
130
+ return [
131
+ {
132
+ title: t("Report abuse"),
133
+ actionClick: () => {
134
+ isReportAbuse.value = true;
129
135
  },
136
+ condition:
137
+ commentStore.getCanReportAbuse(
138
+ props.config,
139
+ undefined !== authStore.authOrgaId,
140
+ ) && !isMyComment.value,
130
141
  },
131
- isMyComment() {
132
- const uuid = this.authProfile?.userId ?? this.commentUser?.uuidHash;
133
- return uuid === this.comment?.poster.uuid;
134
- },
135
- isAtLeastOneMoreAction() {
136
- return this.moreActions.some((el) => {
137
- return el.condition;
138
- });
139
- },
140
- moreActions() {
141
- return [
142
- {
143
- title: this.$t("Report abuse"),
144
- actionClick: () => {
145
- this.isReportAbuse = true;
146
- },
147
- condition:
148
- this.getCanReportAbuse(
149
- this.config,
150
- undefined !== this.authOrgaId,
151
- ) && !this.isMyComment,
152
- },
153
- {
154
- title: this.$t("Managing reported abuses"),
155
- actionClick: () => {
156
- this.actionsAdmin = "abuse";
157
- },
158
- condition: this.editRight && this.comment.abuse,
159
- },
160
- {
161
- title: this.$t("Edit comment"),
162
- actionClick: () => {
163
- this.isEdit = true;
164
- },
165
- condition: this.editRight || this.isMyComment,
166
- },
167
- {
168
- title: this.$t("Comment information"),
169
- actionClick: () => {
170
- this.actionsAdmin = "info";
171
- },
172
- condition: this.editRight && !this.podcast,
173
- },
174
- {
175
- title: this.$t("Validate"),
176
- actionClick: () => {
177
- this.actionName = "validate";
178
- this.isError = false;
179
- this.confirmModal = true;
180
- },
181
- condition:
182
- this.editRight &&
183
- ("PENDING" === this.comment.state ||
184
- "NOT_VALID" === this.comment.state),
185
- },
186
- {
187
- title: this.$t("Invalidate"),
188
- actionClick: () => {
189
- this.actionName = "invalidate";
190
- this.isError = false;
191
- this.confirmModal = true;
192
- },
193
- condition:
194
- this.editRight &&
195
- ("PENDING" === this.comment.state ||
196
- "VALIDATED" === this.comment.state),
197
- },
198
- {
199
- title: this.$t("Delete comment"),
200
- actionClick: () => {
201
- this.actionName = "delete";
202
- this.isError = false;
203
- this.confirmModal = true;
204
- },
205
- condition: this.editRight || this.isMyComment,
206
- },
207
- ];
142
+ {
143
+ title: t("Managing reported abuses"),
144
+ actionClick: () => {
145
+ actionsAdmin.value = "abuse";
146
+ },
147
+ condition: props.editRight && props.comment.abuse,
208
148
  },
209
- validateText(): string | undefined {
210
- if (this.isError) {
211
- return this.$t("Close");
212
- }
213
- return this.actionInProgress ? undefined : this.$t("Yes");
149
+ {
150
+ title: t("Edit comment"),
151
+ actionClick: () => {
152
+ isEdit.value = true;
153
+ },
154
+ condition: props.editRight || isMyComment.value,
214
155
  },
215
- canceltext(): string | undefined {
216
- return this.isError ? undefined : this.$t("No");
156
+ {
157
+ title: t("Comment information"),
158
+ actionClick: () => {
159
+ actionsAdmin.value = "info";
160
+ },
161
+ condition: props.editRight && !props.podcast,
217
162
  },
218
- modalMessage(): string {
219
- if (this.actionInProgress) {
220
- return this.$t("Saving");
221
- }
222
- if (this.isError) {
223
- return this.$t("An error occurred");
224
- }
225
- const name = { name: this.comment.poster.userName };
226
- switch (this.actionName) {
227
- case "delete":
228
- return this.$t("Confirm comment deletion text", name);
229
- case "validate":
230
- return this.$t("Confirm comment valid text", name);
231
- case "invalidate":
232
- return this.$t("Confirm comment invalid text", name);
233
- default:
234
- return "";
235
- }
163
+ {
164
+ title: t("Validate"),
165
+ actionClick: () => {
166
+ actionName.value = "validate";
167
+ isError.value = false;
168
+ confirmModal.value = true;
169
+ },
170
+ condition:
171
+ props.editRight &&
172
+ ("PENDING" === props.comment.state ||
173
+ "NOT_VALID" === props.comment.state),
236
174
  },
237
- modalTitle(): string {
238
- if ("delete" === this.actionName) {
239
- return this.$t("Delete comment");
240
- }
241
- return this.$t("Update comment");
175
+ {
176
+ title: t("Invalidate"),
177
+ actionClick: () => {
178
+ actionName.value = "invalidate";
179
+ isError.value = false;
180
+ confirmModal.value = true;
181
+ },
182
+ condition:
183
+ props.editRight &&
184
+ ("PENDING" === props.comment.state ||
185
+ "VALIDATED" === props.comment.state),
242
186
  },
243
- },
244
- methods: {
245
- ...mapActions(useCommentStore, ["getCanReportAbuse"]),
246
- async actionComment() {
247
- if (!this.comment) {
248
- return;
249
- }
250
- this.actionInProgress = true;
251
- this.isError = false;
252
- try {
253
- if ("delete" === this.actionName) {
254
- await classicApi.deleteData({
255
- api: 2,
256
- path: "comment/" + this.comment.commentId,
257
- parameters: this.editRight
258
- ? undefined
259
- : { uuid: this.commentUser?.uuid },
260
- isNotAuth: !this.editRight,
261
- });
262
- this.$emit("deleteComment");
263
- } else {
264
- const commentUpdated = await classicApi.putData({
265
- api: 2,
266
- path: "comment/",
267
- dataToSend: {
268
- commentId: this.comment.commentId,
269
- content: this.comment.content,
270
- name: this.comment.poster.userName,
271
- state: "validate" === this.actionName ? "VALIDATED" : "NOT_VALID",
272
- },
273
- });
274
- this.$emit("update:comment", commentUpdated);
275
- }
276
- this.confirmModal = false;
277
- } catch {
278
- this.isError = true;
279
- }
280
- this.actionInProgress = false;
187
+ {
188
+ title: t("Delete comment"),
189
+ actionClick: () => {
190
+ actionName.value = "delete";
191
+ isError.value = false;
192
+ confirmModal.value = true;
193
+ },
194
+ condition: props.editRight || isMyComment.value,
281
195
  },
282
- },
196
+ ];
197
+ });
198
+ const validateText = computed(() => {
199
+ if (isError.value) {
200
+ return t("Close");
201
+ }
202
+ return actionInProgress.value ? undefined : t("Yes");
283
203
  });
204
+ const canceltext = computed(() => isError.value ? undefined : t("No"));
205
+ const modalMessage = computed(() => {
206
+ if (actionInProgress.value) {
207
+ return t("Saving");
208
+ }
209
+ if (isError.value) {
210
+ return t("An error occurred");
211
+ }
212
+ const name = { name: props.comment.poster.userName };
213
+ switch (actionName.value) {
214
+ case "delete":
215
+ return t("Confirm comment deletion text", name);
216
+ case "validate":
217
+ return t("Confirm comment valid text", name);
218
+ case "invalidate":
219
+ return t("Confirm comment invalid text", name);
220
+ default:
221
+ return "";
222
+ }
223
+ });
224
+ const modalTitle = computed(() => {
225
+ if ("delete" === actionName.value) {
226
+ return t("Delete comment");
227
+ }
228
+ return t("Update comment");
229
+ });
230
+
231
+
232
+ //Methods
233
+ async function actionComment() {
234
+ if (!props.comment) {
235
+ return;
236
+ }
237
+ actionInProgress.value = true;
238
+ isError.value = false;
239
+ try {
240
+ if ("delete" === actionName.value) {
241
+ await classicApi.deleteData({
242
+ api: 2,
243
+ path: "comment/" + props.comment.commentId,
244
+ parameters: props.editRight
245
+ ? undefined
246
+ : { uuid: commentStore.commentUser?.uuid },
247
+ isNotAuth: !props.editRight,
248
+ });
249
+ emit("deleteComment");
250
+ } else {
251
+ const commentUpdated = await classicApi.putData({
252
+ api: 2,
253
+ path: "comment/",
254
+ dataToSend: {
255
+ commentId: props.comment.commentId,
256
+ content: props.comment.content,
257
+ name: props.comment.poster.userName,
258
+ state: "validate" === actionName.value ? "VALIDATED" : "NOT_VALID",
259
+ },
260
+ });
261
+ emit("update:comment", commentUpdated);
262
+ }
263
+ confirmModal.value = false;
264
+ } catch {
265
+ isError.value = true;
266
+ }
267
+ actionInProgress.value = false;
268
+ }
284
269
  </script>
@@ -4,7 +4,5 @@
4
4
  </div>
5
5
  </template>
6
6
 
7
- <script lang="ts">
8
- import { defineComponent } from "vue";
9
- export default defineComponent({});
7
+ <script setup lang="ts">
10
8
  </script>