@saooti/octopus-sdk 40.2.19 → 41.0.1-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
@@ -32,60 +32,48 @@
32
32
  </div>
33
33
  </template>
34
34
 
35
- <script lang="ts">
35
+ <script setup lang="ts">
36
36
  import { CommentPodcast } from "@/stores/class/general/comment";
37
37
  import {useSelenium} from "../../composable/useSelenium";
38
38
  import { usePlayerStore } from "../../../stores/PlayerStore";
39
- import { mapActions, mapState } from "pinia";
40
- import { defineComponent } from "vue";
39
+ import { computed, Ref, ref, watch } from "vue";
41
40
  import { useCommentStore } from "../../../stores/CommentStore";
42
- export default defineComponent({
43
- name: "CommentPlayer",
44
- setup(){
45
- const { seleniumFormat } = useSelenium();
46
- return { seleniumFormat }
47
- },
48
- data() {
49
- return {
50
- displayContent: undefined as CommentPodcast | undefined,
51
- commentsToDisplay: [] as Array<CommentPodcast>,
52
- };
53
- },
54
- computed: {
55
- ...mapState(usePlayerStore, ["playerPodcast", "playerTotal"]),
56
- podcastId() {
57
- return this.playerPodcast?.podcastId;
58
- },
59
- },
60
- watch: {
61
- podcastId: {
62
- immediate: true,
63
- handler() {
64
- this.initComments();
65
- },
66
- },
67
- },
68
- methods: {
69
- ...mapActions(useCommentStore, ["fetchCommentsForPlayer"]),
70
- async initComments() {
71
- if (this.playerPodcast?.podcastId) {
72
- this.commentsToDisplay = await this.fetchCommentsForPlayer(
73
- this.playerPodcast.podcastId,
74
- );
75
- }
76
- },
77
- percentPosition(time: number): number {
78
- let realDuration = this.playerTotal;
79
- if (this.playerPodcast?.duration) {
80
- realDuration = Math.round(this.playerPodcast.duration / 1000);
81
- }
82
- if (realDuration < this.playerTotal) {
83
- time = time + (this.playerTotal - realDuration);
84
- }
85
- return Math.round((time * 100) / this.playerTotal);
86
- },
87
- },
88
- });
41
+
42
+ //Data
43
+ const displayContent: Ref<CommentPodcast | undefined> = ref(undefined);
44
+ const commentsToDisplay: Ref<Array<CommentPodcast>> = ref([]);
45
+
46
+ //Composables
47
+ const { seleniumFormat } = useSelenium();
48
+ const playerStore = usePlayerStore();
49
+ const commentStore = useCommentStore();
50
+
51
+ //Computed
52
+ const podcastId = computed(() => playerStore.playerPodcast?.podcastId);
53
+
54
+
55
+ //Watch
56
+ watch(podcastId, () => {initComments()}, {immediate: true});
57
+
58
+
59
+ //Methods
60
+ async function initComments() {
61
+ if (playerStore.playerPodcast?.podcastId) {
62
+ commentsToDisplay.value = await commentStore.fetchCommentsForPlayer(
63
+ playerStore.playerPodcast.podcastId,
64
+ );
65
+ }
66
+ }
67
+ function percentPosition(time: number): number {
68
+ let realDuration = playerStore.playerTotal;
69
+ if (playerStore.playerPodcast?.duration) {
70
+ realDuration = Math.round(playerStore.playerPodcast.duration / 1000);
71
+ }
72
+ if (realDuration < playerStore.playerTotal) {
73
+ time = time + (playerStore.playerTotal - realDuration);
74
+ }
75
+ return Math.round((time * 100) / playerStore.playerTotal);
76
+ }
89
77
  </script>
90
78
 
91
79
  <style lang="scss">
@@ -3,9 +3,9 @@
3
3
  <div class="d-flex align-items-center">
4
4
  <component
5
5
  :is="inStudio? 'div':'h3'"
6
- :class="inStudio? 'm-1 fw-bold':'mb-0 me-2'">{{ $t("Podcast's comments") }}</component>
6
+ :class="inStudio? 'm-1 fw-bold':'mb-0 me-2'">{{ t("Podcast's comments") }}</component>
7
7
  <button
8
- :title="$t('Refresh')"
8
+ :title="t('Refresh')"
9
9
  class="btn btn-transparent"
10
10
  @click="reload = !reload"
11
11
  >
@@ -30,11 +30,10 @@
30
30
  </section>
31
31
  </template>
32
32
 
33
- <script lang="ts">
33
+ <script setup lang="ts">
34
34
  import RefreshIcon from "vue-material-design-icons/Refresh.vue";
35
35
  import { Podcast } from "@/stores/class/general/podcast";
36
- import { defineAsyncComponent, defineComponent } from "vue";
37
- import { mapActions, mapState } from "pinia";
36
+ import { computed, defineAsyncComponent, onBeforeMount, ref, Ref, watch } from "vue";
38
37
  import { useCommentStore } from "../../../stores/CommentStore";
39
38
  import { useAuthStore } from "../../../stores/AuthStore";
40
39
  import {
@@ -42,105 +41,88 @@ import {
42
41
  CommentsConfig,
43
42
  } from "@/stores/class/config/commentsConfig";
44
43
  import { CommentPodcast } from "@/stores/class/general/comment";
44
+ import { useI18n } from "vue-i18n";
45
45
  const CommentList = defineAsyncComponent(() => import("./CommentList.vue"));
46
46
  const CommentInput = defineAsyncComponent(() => import("./CommentInput.vue"));
47
- export default defineComponent({
48
- name: "CommentSection",
49
- components: {
50
- CommentList,
51
- CommentInput,
52
- RefreshIcon,
53
- },
54
- props: {
55
- podcast: { default: undefined, type: Object as () => Podcast },
56
- inStudio: { default: false, type: Boolean },
57
- stateFilter: { default: "", type: String },
58
- },
59
- emits:['commentReceived'],
60
- data() {
61
- return {
62
- reload: false as boolean,
63
- configPodcast: undefined as CommentsConfig | undefined,
64
- nbComments: 0 as number,
65
- eventToHandle: undefined as CommentMessage | undefined,
66
- };
67
- },
68
- computed: {
69
- ...mapState(useCommentStore, [
70
- "commentEventToHandle",
71
- "commentInitialized",
72
- "commentPodcastId",
73
- ]),
74
- ...mapState(useAuthStore, ["authOrgaId"]),
75
- displayCommentSection(): boolean {
76
- return this.canPostComment || this.nbComments > 0;
77
- },
78
- canPostComment(): boolean {
79
- return this.getCanPostComment(
80
- this.configPodcast,
81
- this.podcast,
82
- undefined !== this.authOrgaId,
83
- );
84
- },
85
- eventActive(): boolean {
86
- return undefined !== this.podcast?.conferenceId;
87
- },
88
- },
89
- watch: {
90
- commentEventToHandle: {
91
- deep: true,
92
- handler(): void {
93
- if (
94
- !this.commentEventToHandle.length ||
95
- this.commentPodcastId !== this.podcast?.podcastId
96
- ){
97
- return;
98
- }
99
- this.eventToHandle = this.commentEventToHandle[0];
100
- this.commentEventHandled();
101
- this.$emit('commentReceived');
102
- },
103
- },
104
- },
105
- created() {
106
- this.fetchPodcastCommentsConfig();
107
- },
108
- methods: {
109
- ...mapActions(useCommentStore, [
110
- "getCommentsConfig",
111
- "getCanPostComment",
112
- "commentEventHandled",
113
- "initialize",
114
- "initComments",
115
- ]),
116
- async fetchPodcastCommentsConfig() {
117
- if (!this.podcast?.podcastId) {
118
- return;
119
- }
120
- this.configPodcast = await this.getCommentsConfig(this.podcast);
121
- if (!this.eventActive) {
122
- return;
123
- }
124
- this.initLiveComments();
125
- },
126
- async initLiveComments(): Promise<void> {
127
- if (!this.podcast?.podcastId || !this.podcast?.organisation.id) {
128
- return;
129
- }
130
- if (!this.commentInitialized) {
131
- await this.initialize();
132
- }
133
- await this.initComments(
134
- this.podcast.podcastId,
135
- this.podcast.organisation.id,
136
- );
137
- },
138
- newComment(comment: CommentPodcast) {
139
- if (this.eventActive) {
140
- return;
141
- }
142
- this.eventToHandle = { type: "CREATE", comment: comment };
143
- },
144
- },
47
+
48
+ //Props
49
+ const props = defineProps({
50
+ podcast: { default: undefined, type: Object as () => Podcast },
51
+ inStudio: { default: false, type: Boolean },
52
+ stateFilter: { default: "", type: String },
53
+ })
54
+
55
+ //Emits
56
+ const emit = defineEmits(["commentReceived"]);
57
+
58
+ //Data
59
+ const reload = ref(false);
60
+ const configPodcast: Ref<CommentsConfig | undefined> = ref(undefined);
61
+ const nbComments = ref(0);
62
+ const eventToHandle: Ref<CommentMessage | undefined> = ref(undefined);
63
+
64
+ //Composables
65
+ const { t } = useI18n();
66
+ const commentStore = useCommentStore();
67
+ const authStore = useAuthStore();
68
+
69
+
70
+ //Computed
71
+ const displayCommentSection = computed(() => canPostComment.value || nbComments.value > 0);
72
+ const canPostComment = computed(() => {
73
+ return commentStore.getCanPostComment(
74
+ configPodcast.value,
75
+ props.podcast,
76
+ undefined !== authStore.authOrgaId,
77
+ );
145
78
  });
79
+ const eventActive = computed(() => undefined !== props.podcast?.conferenceId);
80
+
81
+
82
+ //Watch
83
+ watch(()=>commentStore.commentEventToHandle, async () => {
84
+ if (
85
+ !commentStore.commentEventToHandle.length ||
86
+ commentStore.commentPodcastId !== props.podcast?.podcastId
87
+ ){
88
+ return;
89
+ }
90
+ eventToHandle.value = commentStore.commentEventToHandle[0];
91
+ commentStore.commentEventHandled();
92
+ emit('commentReceived');
93
+ }, {deep: true});
94
+
95
+
96
+ onBeforeMount(()=>fetchPodcastCommentsConfig())
97
+
98
+
99
+ //Methods
100
+ async function fetchPodcastCommentsConfig() {
101
+ if (!props.podcast?.podcastId) {
102
+ return;
103
+ }
104
+ configPodcast.value = await commentStore.getCommentsConfig(props.podcast);
105
+ if (!eventActive.value) {
106
+ return;
107
+ }
108
+ initLiveComments();
109
+ }
110
+ async function initLiveComments(): Promise<void> {
111
+ if (!props.podcast?.podcastId || !props.podcast?.organisation.id) {
112
+ return;
113
+ }
114
+ if (!commentStore.commentInitialized) {
115
+ await commentStore.initialize();
116
+ }
117
+ await commentStore.initComments(
118
+ props.podcast.podcastId,
119
+ props.podcast.organisation.id,
120
+ );
121
+ }
122
+ function newComment(comment: CommentPodcast) {
123
+ if (eventActive.value) {
124
+ return;
125
+ }
126
+ eventToHandle.value = { type: "CREATE", comment: comment };
127
+ }
146
128
  </script>
@@ -9,7 +9,7 @@
9
9
  <ClassicPopover
10
10
  :disable="isValidComment"
11
11
  :target="'popover-comment' + comment.commentId"
12
- :content="$t('Comment waiting')"
12
+ :content="t('Comment waiting')"
13
13
  />
14
14
  <time :datetime="comment.date" class="me-2">
15
15
  {{ date }}
@@ -19,7 +19,7 @@
19
19
  class="d-flex align-items-center text-danger me-2"
20
20
  >
21
21
  <AlertIcon :size="16" class="me-1" />
22
- {{ $t("abuse denounced", { nb: comment.abuse }) }}
22
+ {{ t("abuse denounced", { nb: comment.abuse }) }}
23
23
  </div>
24
24
  <span v-if="editRight" :class="'status-' + comment.state" />
25
25
  </div>
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </template>
37
37
 
38
- <script lang="ts">
38
+ <script setup lang="ts">
39
39
  import AlertIcon from "vue-material-design-icons/Alert.vue";
40
40
  import dayjs from "dayjs";
41
41
  import relativeTime from "dayjs/plugin/relativeTime";
@@ -43,67 +43,54 @@ dayjs.extend(relativeTime);
43
43
  import displayHelper from "../../../../helper/displayHelper";
44
44
  import { CommentPodcast } from "@/stores/class/general/comment";
45
45
  import ClassicPopover from "../../../misc/ClassicPopover.vue";
46
- import { defineComponent } from "vue";
47
- export default defineComponent({
48
- name: "CommentBasicView",
46
+ import { computed, onMounted, onUnmounted, Ref, ref } from "vue";
47
+ import { useI18n } from "vue-i18n";
49
48
 
50
- components: {
51
- ClassicPopover,
52
- AlertIcon,
53
- },
49
+ //Props
50
+ const props = defineProps({
51
+ comment: { default: () => ({}), type: Object as () => CommentPodcast },
52
+ editRight: { default: false, type: Boolean },
53
+ })
54
54
 
55
- props: {
56
- comment: { default: () => ({}), type: Object as () => CommentPodcast },
57
- editRight: { default: false, type: Boolean },
58
- },
59
- data() {
60
- return {
61
- displayPreview: true as boolean,
62
- dateInterval: undefined as ReturnType<typeof setTimeout> | undefined,
63
- date: "" as string,
64
- };
65
- },
66
- computed: {
67
- commentTooLong() {
68
- return this.comment.content.length > 300;
69
- },
70
- username(): string {
71
- return this.comment.poster.userName;
72
- },
73
- isValidComment() {
74
- return "VALIDATED" === this.comment.state;
75
- },
76
- readMore(): string {
77
- return this.displayPreview ? this.$t("Read more") : this.$t("Read less");
78
- },
79
- contentDisplay(): string {
80
- if (!this.displayPreview || !this.commentTooLong) {
81
- return this.comment.content;
82
- }
83
- return this.comment.content.substring(0, 300) + "...";
84
- },
85
- },
86
- mounted() {
87
- this.defineDateFromNow();
88
- this.dateInterval = setInterval(() => {
89
- this.defineDateFromNow();
90
- }, 60000);
91
- },
92
- unmounted() {
93
- clearInterval(this.dateInterval as unknown as number);
94
- },
95
- methods: {
96
- urlify(text:string|undefined){
97
- return displayHelper.urlify(text);
98
- },
99
- defineDateFromNow() {
100
- if (!this.comment.date) {
101
- this.date = "";
102
- }
103
- this.date = dayjs(this.comment.date).fromNow();
104
- },
105
- },
55
+ //Data
56
+ const displayPreview = ref(true);
57
+ const date = ref("");
58
+ const dateInterval: Ref<ReturnType<typeof setTimeout> | undefined> = ref(undefined);
59
+
60
+ //Composables
61
+ const { t } = useI18n();
62
+
63
+ //Computed
64
+ const commentTooLong = computed(() => props.comment.content.length > 300);
65
+ const username = computed(() => props.comment.poster.userName);
66
+ const isValidComment = computed(() => "VALIDATED" === props.comment.state);
67
+ const readMore = computed(() => displayPreview.value ? t("Read more") : t("Read less"));
68
+ const contentDisplay = computed(() => {
69
+ if (!displayPreview.value || !commentTooLong.value) {
70
+ return props.comment.content;
71
+ }
72
+ return props.comment.content.substring(0, 300) + "...";
106
73
  });
74
+
75
+ onMounted(()=>{
76
+ defineDateFromNow();
77
+ dateInterval.value = setInterval(() => {
78
+ defineDateFromNow();
79
+ }, 60000);
80
+ })
81
+
82
+ onUnmounted(()=>clearInterval(dateInterval.value as unknown as number))
83
+
84
+ //Methods
85
+ function urlify(text:string|undefined){
86
+ return displayHelper.urlify(text);
87
+ }
88
+ function defineDateFromNow() {
89
+ if (!props.comment.date) {
90
+ date.value = "";
91
+ }
92
+ date.value = dayjs(props.comment.date).fromNow();
93
+ }
107
94
  </script>
108
95
  <style lang="scss">
109
96
  @use "../../../../style/comments";