@saooti/octopus-sdk 40.2.19 → 41.0.0

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 (214) hide show
  1. package/index.ts +2 -1
  2. package/package.json +4 -3
  3. package/src/App.vue +71 -95
  4. package/src/components/composable/player/usePlayerLive.ts +13 -4
  5. package/src/components/composable/player/usePlayerLogic.ts +6 -6
  6. package/src/components/composable/player/usePlayerVast.ts +7 -7
  7. package/src/components/composable/podcasts/usePodcastView.ts +3 -3
  8. package/src/components/composable/route/useAdvancedParamInit.ts +1 -1
  9. package/src/components/composable/route/useRouteUpdateParams.ts +4 -4
  10. package/src/components/composable/route/useSimplePageParam.ts +15 -8
  11. package/src/components/composable/useInit.ts +2 -2
  12. package/src/components/composable/useMetaTitleWatch.ts +2 -2
  13. package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
  14. package/src/components/display/categories/CategoryChooser.vue +144 -145
  15. package/src/components/display/categories/CategoryFilter.vue +172 -198
  16. package/src/components/display/categories/CategoryList.vue +122 -147
  17. package/src/components/display/comments/CommentInput.vue +100 -122
  18. package/src/components/display/comments/CommentList.vue +169 -191
  19. package/src/components/display/comments/CommentName.vue +35 -45
  20. package/src/components/display/comments/CommentParentInfo.vue +28 -34
  21. package/src/components/display/comments/CommentPlayer.vue +38 -50
  22. package/src/components/display/comments/CommentSection.vue +85 -103
  23. package/src/components/display/comments/item/CommentBasicView.vue +48 -61
  24. package/src/components/display/comments/item/CommentItem.vue +104 -115
  25. package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
  26. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
  27. package/src/components/display/comments/like/LikeButton.vue +36 -41
  28. package/src/components/display/comments/like/LikeSection.vue +128 -136
  29. package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
  30. package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
  31. package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
  32. package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
  33. package/src/components/display/edit/EditBox.vue +9 -8
  34. package/src/components/display/edit/EditBoxRadio.vue +1 -5
  35. package/src/components/display/emission/EmissionInlineList.vue +82 -97
  36. package/src/components/display/emission/EmissionItem.vue +57 -69
  37. package/src/components/display/emission/EmissionList.vue +189 -218
  38. package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
  39. package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
  40. package/src/components/display/emission/EmissionPresentationList.vue +51 -61
  41. package/src/components/display/filter/AdvancedSearch.vue +151 -176
  42. package/src/components/display/filter/CategorySearchFilter.vue +43 -46
  43. package/src/components/display/filter/DateFilter.vue +76 -91
  44. package/src/components/display/filter/MonetizableFilter.vue +27 -30
  45. package/src/components/display/filter/ProductorSearch.vue +87 -90
  46. package/src/components/display/filter/RubriqueChoice.vue +58 -63
  47. package/src/components/display/filter/RubriqueFilter.vue +154 -169
  48. package/src/components/display/filter/SearchOrder.vue +35 -35
  49. package/src/components/display/list/ListPaginate.vue +72 -93
  50. package/src/components/display/list/PaginateParams.vue +36 -40
  51. package/src/components/display/list/PaginateSection.vue +113 -124
  52. package/src/components/display/list/SwiperList.vue +97 -109
  53. package/src/components/display/live/CountDown.vue +15 -9
  54. package/src/components/display/live/CountdownOctopus.vue +16 -10
  55. package/src/components/display/live/LiveHorizontalList.vue +95 -103
  56. package/src/components/display/live/LiveItem.vue +64 -73
  57. package/src/components/display/live/LiveList.vue +125 -137
  58. package/src/components/display/live/RadioCurrently.vue +66 -73
  59. package/src/components/display/live/RadioImage.vue +39 -50
  60. package/src/components/display/live/RadioItem.vue +9 -14
  61. package/src/components/display/live/RadioList.vue +39 -53
  62. package/src/components/display/live/RadioPlanning.vue +210 -222
  63. package/src/components/display/organisation/OrganisationChooser.vue +116 -122
  64. package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
  65. package/src/components/display/participant/ParticipantInlineList.vue +42 -58
  66. package/src/components/display/participant/ParticipantItem.vue +66 -74
  67. package/src/components/display/participant/ParticipantList.vue +116 -141
  68. package/src/components/display/playlist/PlaylistItem.vue +33 -46
  69. package/src/components/display/playlist/PlaylistList.vue +115 -144
  70. package/src/components/display/playlist/PodcastList.vue +90 -103
  71. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
  72. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
  73. package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
  74. package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
  75. package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
  76. package/src/components/display/podcasts/PodcastFilterList.vue +62 -56
  77. package/src/components/display/podcasts/PodcastImage.vue +96 -99
  78. package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
  79. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
  80. package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
  81. package/src/components/display/podcasts/PodcastItem.vue +48 -63
  82. package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
  83. package/src/components/display/podcasts/PodcastList.vue +182 -206
  84. package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
  85. package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
  86. package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
  87. package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
  88. package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
  89. package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
  90. package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
  91. package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
  92. package/src/components/display/podcasts/TagList.vue +48 -50
  93. package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
  94. package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
  95. package/src/components/display/rubriques/RubriqueList.vue +140 -160
  96. package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
  97. package/src/components/display/sharing/FormatSwitch.vue +16 -11
  98. package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
  99. package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
  100. package/src/components/display/sharing/PlayerParameters.vue +69 -71
  101. package/src/components/display/sharing/QrCode.vue +55 -67
  102. package/src/components/display/sharing/ShareAnonymous.vue +160 -178
  103. package/src/components/display/sharing/ShareDistribution.vue +103 -117
  104. package/src/components/display/sharing/ShareNewsletter.vue +154 -161
  105. package/src/components/display/sharing/SharePlayer.vue +273 -295
  106. package/src/components/display/sharing/SharePlayerColors.vue +25 -16
  107. package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
  108. package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
  109. package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
  110. package/src/components/display/sharing/SubscribeButtons.vue +184 -207
  111. package/src/components/display/studio/RecordingItemButton.vue +1 -4
  112. package/src/components/form/ClassicCheckbox.vue +26 -30
  113. package/src/components/form/ClassicContentEditable.vue +37 -33
  114. package/src/components/form/ClassicCopyButton.vue +40 -44
  115. package/src/components/form/ClassicDatePicker.vue +114 -114
  116. package/src/components/form/ClassicEmojiPicker.vue +20 -28
  117. package/src/components/form/ClassicInputText.vue +116 -120
  118. package/src/components/form/ClassicLoading.vue +7 -12
  119. package/src/components/form/ClassicMultiselect.vue +115 -117
  120. package/src/components/form/ClassicRadio.vue +21 -16
  121. package/src/components/form/ClassicRadioLabel.vue +23 -22
  122. package/src/components/form/ClassicSearch.vue +24 -19
  123. package/src/components/form/ClassicSelect.vue +47 -38
  124. package/src/components/form/ClassicWysiwyg.vue +116 -123
  125. package/src/components/icons/AmazonMusicIcon.vue +7 -10
  126. package/src/components/icons/ApplePodcastIcon.vue +7 -11
  127. package/src/components/icons/BlueSkyIcon.vue +8 -11
  128. package/src/components/icons/DeezerIcon.vue +8 -11
  129. package/src/components/icons/EditFtpIcon.vue +8 -11
  130. package/src/components/icons/IHeartIcon.vue +8 -11
  131. package/src/components/icons/PlayVideoIcon.vue +7 -10
  132. package/src/components/icons/PlayerFmIcon.vue +7 -10
  133. package/src/components/icons/PocketCastIcon.vue +8 -11
  134. package/src/components/icons/PodcastAddictIcon.vue +7 -10
  135. package/src/components/icons/RadiolineIcon.vue +8 -11
  136. package/src/components/icons/TuninIcon.vue +8 -11
  137. package/src/components/icons/XIcon.vue +7 -10
  138. package/src/components/misc/AcpmImage.vue +6 -7
  139. package/src/components/misc/ClassicAccordion.vue +26 -31
  140. package/src/components/misc/ClassicLazy.vue +86 -90
  141. package/src/components/misc/ClassicNav.vue +16 -20
  142. package/src/components/misc/ClassicPopover.vue +271 -282
  143. package/src/components/misc/ClassicSpinner.vue +5 -27
  144. package/src/components/misc/ErrorMessage.vue +11 -12
  145. package/src/components/misc/FooterGarSection.vue +33 -41
  146. package/src/components/misc/FooterSection.vue +94 -131
  147. package/src/components/misc/HomeDropdown.vue +83 -105
  148. package/src/components/misc/MobileMenu.vue +101 -111
  149. package/src/components/misc/ProgressBar.vue +53 -62
  150. package/src/components/misc/TopBar.vue +98 -120
  151. package/src/components/misc/TopBarMainContent.vue +114 -133
  152. package/src/components/misc/modal/ClassicModal.vue +40 -33
  153. package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
  154. package/src/components/misc/modal/ClipboardModal.vue +27 -30
  155. package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
  156. package/src/components/misc/modal/MessageModal.vue +50 -47
  157. package/src/components/misc/modal/NewsletterModal.vue +30 -31
  158. package/src/components/misc/modal/QrCodeModal.vue +21 -21
  159. package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
  160. package/src/components/misc/player/PlayerCompact.vue +6 -4
  161. package/src/components/misc/player/PlayerComponent.vue +8 -9
  162. package/src/components/misc/player/PlayerLarge.vue +9 -8
  163. package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
  164. package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
  165. package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
  166. package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
  167. package/src/components/misc/player/elements/PlayerImage.vue +51 -57
  168. package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
  169. package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
  170. package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
  171. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
  172. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
  173. package/src/components/misc/player/radio/RadioHistory.vue +80 -99
  174. package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
  175. package/src/components/misc/player/video/PlayerVideo.vue +27 -40
  176. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
  177. package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
  178. package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
  179. package/src/components/pages/CategoryPage.vue +28 -33
  180. package/src/components/pages/EmissionPage.vue +113 -132
  181. package/src/components/pages/EmissionsPage.vue +2 -0
  182. package/src/components/pages/Error403Page.vue +21 -20
  183. package/src/components/pages/HomePage.vue +91 -100
  184. package/src/components/pages/LivesPage.vue +35 -37
  185. package/src/components/pages/MapPage.vue +209 -241
  186. package/src/components/pages/PageLogout.vue +8 -11
  187. package/src/components/pages/PageNotFound.vue +9 -5
  188. package/src/components/pages/ParticipantPage.vue +96 -110
  189. package/src/components/pages/ParticipantsPage.vue +3 -0
  190. package/src/components/pages/PlaylistPage.vue +112 -117
  191. package/src/components/pages/PlaylistsPage.vue +9 -2
  192. package/src/components/pages/PodcastPage.vue +224 -238
  193. package/src/components/pages/PodcastsPage.vue +9 -2
  194. package/src/components/pages/RadioPage.vue +56 -70
  195. package/src/components/pages/RubriquePage.vue +7 -3
  196. package/src/components/pages/SearchPage.vue +31 -36
  197. package/src/components/pages/TagPage.vue +11 -9
  198. package/src/components/pages/VideoPage.vue +14 -11
  199. package/src/helper/displayHelper.ts +1 -1
  200. package/src/helper/loadScript.ts +4 -4
  201. package/src/i18n.ts +2 -2
  202. package/src/main.ts +1 -1
  203. package/src/router/router.ts +17 -4
  204. package/src/stores/AuthStore.ts +12 -12
  205. package/src/stores/FilterStore.ts +1 -1
  206. package/src/stores/VastStore.ts +2 -2
  207. package/src/stores/class/general/player.ts +1 -0
  208. package/public/css/fonts/icomoon.eot +0 -0
  209. package/public/css/fonts/icomoon.svg +0 -113
  210. package/public/css/fonts/icomoon.ttf +0 -0
  211. package/public/css/fonts/icomoon.woff +0 -0
  212. package/public/css/fonts/icomoon.woff2 +0 -0
  213. package/public/css/fonts/style.css +0 -352
  214. package/sonarqube-scanner.js +0 -10
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <section v-if="!isLoading && !isGarRole && (authOrgaId || !noSharing)" id="share-buttons-podcast-section" class="module-box">
2
+ <section v-if="!isLoading && !authStore.isGarRole && (authStore.authOrgaId || !noSharing)" id="share-buttons-podcast-section" class="module-box">
3
3
  <h3 class="mb-2">
4
- {{ $t("Share in one click") }}
4
+ {{ t("Share in one click") }}
5
5
  </h3>
6
6
  <div class="d-flex align-items-center">
7
7
  <template v-for="button in arrayShareButtons" :key="button.title">
@@ -11,7 +11,7 @@
11
11
  target="_blank"
12
12
  :href="button.url"
13
13
  class="btn share-btn mb-2 text-dark me-2"
14
- :title="$t('New window', {text: button.title})"
14
+ :title="t('New window', {text: button.title})"
15
15
  >
16
16
  <component :is="button.icon" :size="34" />
17
17
  </a>
@@ -21,90 +21,78 @@
21
21
  </section>
22
22
  </template>
23
23
 
24
- <script lang="ts">
24
+ <script setup lang="ts">
25
25
  import XIcon from "../../icons/XIcon.vue";
26
26
  import BlueSkyIcon from "../../icons/BlueSkyIcon.vue";
27
27
  import WhatsappIcon from "vue-material-design-icons/Whatsapp.vue";
28
28
  import LinkedinIcon from "vue-material-design-icons/Linkedin.vue";
29
29
  import FacebookIcon from "vue-material-design-icons/Facebook.vue";
30
30
  import { useSaveFetchStore } from "../../../stores/SaveFetchStore";
31
- import { mapActions, mapState } from "pinia";
32
31
  import { useAuthStore } from "../../../stores/AuthStore";
33
- import { defineComponent } from "vue";
32
+ import { computed, onMounted, ref } from "vue";
33
+ import { useI18n } from "vue-i18n";
34
34
 
35
- export default defineComponent({
36
- components: {
37
- FacebookIcon,
38
- LinkedinIcon,
39
- WhatsappIcon,
40
- XIcon,
41
- BlueSkyIcon
42
- },
43
- props: {
44
- organisationId: { default: undefined, type: String },
35
+ //Props
36
+ const props = defineProps({
37
+ organisationId: { default: undefined, type: String },
38
+ })
39
+
40
+ //Data
41
+ const noSharing = ref(true);
42
+ const isLoading = ref(true);
43
+
44
+ //Composables
45
+ const { t } = useI18n();
46
+ const authStore = useAuthStore();
47
+ const saveFetchStore =useSaveFetchStore();
48
+
49
+ //Computed
50
+ const arrayShareButtons = computed(() => {
51
+ return [
52
+ {
53
+ title: "Facebook",
54
+ icon: FacebookIcon,
55
+ url: `https://www.facebook.com/sharer/sharer.php?u=${urlPage.value}`,
56
+ condition: true,
45
57
  },
46
- data() {
47
- return {
48
- noSharing: true as boolean,
49
- isLoading: true as boolean,
50
- };
58
+ {
59
+ title: "X",
60
+ icon: XIcon,
61
+ url: `https://twitter.com/intent/tweet?text=${urlPage.value}`,
62
+ condition: true,
51
63
  },
52
- computed: {
53
- ...mapState(useAuthStore, [
54
- "isGarRole",
55
- "authOrgaId"
56
- ]),
57
- arrayShareButtons() {
58
- return [
59
- {
60
- title: "Facebook",
61
- icon: "FacebookIcon",
62
- url: `https://www.facebook.com/sharer/sharer.php?u=${this.urlPage}`,
63
- condition: true,
64
- },
65
- {
66
- title: "X",
67
- icon: "XIcon",
68
- url: `https://twitter.com/intent/tweet?text=${this.urlPage}`,
69
- condition: true,
70
- },
71
- {
72
- title: "Linkedin",
73
- icon: "LinkedinIcon",
74
- url: `https://www.linkedin.com/sharing/share-offsite/?url=${this.urlPage}`,
75
- condition: true,
76
- },
77
- {
78
- title: "Bluesky",
79
- icon: "BlueSkyIcon",
80
- url: `https://bsky.app/intent/compose?text=${this.urlPage}`,
81
- condition: true,
82
- },
83
- {
84
- title: "Whatsapp",
85
- icon: "WhatsappIcon",
86
- url: `whatsapp://send?text=${this.urlPage}`,
87
- condition: window.matchMedia("(hover: none)").matches,
88
- },
89
- ];
90
- },
91
- urlPage(): string {
92
- return window.location.href;
93
- },
64
+ {
65
+ title: "Linkedin",
66
+ icon: LinkedinIcon,
67
+ url: `https://www.linkedin.com/sharing/share-offsite/?url=${urlPage.value}`,
68
+ condition: true,
94
69
  },
95
- created() {
96
- this.initShareButtons();
70
+ {
71
+ title: "Bluesky",
72
+ icon: BlueSkyIcon,
73
+ url: `https://bsky.app/intent/compose?text=${urlPage.value}`,
74
+ condition: true,
97
75
  },
98
- methods: {
99
- ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
100
- async initShareButtons() {
101
- if (!this.organisationId) {
102
- return;
103
- }
104
- const attributes = await this.getOrgaAttributes(this.organisationId);
105
- this.noSharing = "true" === attributes.noSharing;
106
- this.isLoading = false;
107
- },
76
+ {
77
+ title: "Whatsapp",
78
+ icon: WhatsappIcon,
79
+ url: `whatsapp://send?text=${urlPage.value}`,
80
+ condition: window.matchMedia("(hover: none)").matches,
108
81
  },
82
+ ];
109
83
  });
84
+ const urlPage = computed(() =>window.location.href);
85
+
86
+ onMounted(()=>initShareButtons())
87
+
88
+
89
+ //Methods
90
+ async function initShareButtons() {
91
+ if (!props.organisationId) {
92
+ return;
93
+ }
94
+ const attributes = await saveFetchStore.getOrgaAttributes(props.organisationId);
95
+ noSharing.value = "true" === attributes.noSharing;
96
+ isLoading.value = false;
97
+ }
110
98
  </script>
@@ -6,8 +6,8 @@
6
6
  <div ref="subscribeButtonsContainer">
7
7
  <a
8
8
  v-for="(sub, index) in subscriptionsDisplay"
9
+ :id="'subLink' + sub.name"
9
10
  :key="sub.name"
10
- :ref="'subLink' + sub.name"
11
11
  rel="noreferrer noopener"
12
12
  target="_blank"
13
13
  :class="[
@@ -16,7 +16,7 @@
16
16
  ]"
17
17
  class="btn share-btn mx-2"
18
18
  :href="sub.url"
19
- :title="$t('New window', {text: sub.title})"
19
+ :title="t('New window', {text: sub.title})"
20
20
  >
21
21
  <component :is="sub.icon" :fill-color="sub?.color" />
22
22
  </a>
@@ -27,7 +27,7 @@
27
27
  target="_blank"
28
28
  class="btn share-btn mx-2"
29
29
  :href="rssUrl"
30
- :title="$t('New window', {text: $t('Rss feed')})"
30
+ :title="t('New window', {text: t('Rss feed')})"
31
31
  >
32
32
  <RssIcon />
33
33
  </a>
@@ -35,7 +35,7 @@
35
35
  v-show="hiddenLinks.length"
36
36
  id="subscribe-buttons-dropdown"
37
37
  class="btn share-btn mx-2"
38
- :title="$t('See more')"
38
+ :title="t('See more')"
39
39
  >
40
40
  <PlusIcon />
41
41
  </button>
@@ -52,7 +52,7 @@
52
52
  target="_blank"
53
53
  class="octopus-dropdown-item justify-content-start d-flex align-items-center realLink"
54
54
  :href="link.url"
55
- :title="$t('New window', {text: link.title})"
55
+ :title="t('New window', {text: link.title})"
56
56
  >
57
57
  <component :is="link.icon" :fill-color="link.color" class="me-1" />
58
58
  {{ link.title }}
@@ -61,7 +61,7 @@
61
61
  </div>
62
62
  </template>
63
63
 
64
- <script lang="ts">
64
+ <script setup lang="ts">
65
65
  import RadiolineIcon from "../../icons/RadiolineIcon.vue";
66
66
  import TuninIcon from "../../icons/TuninIcon.vue";
67
67
  import PodcastAddictIcon from "../../icons/PodcastAddictIcon.vue";
@@ -75,11 +75,11 @@ import YoutubeIcon from "vue-material-design-icons/Youtube.vue";
75
75
  import SpotifyIcon from "vue-material-design-icons/Spotify.vue";
76
76
  import PlusIcon from "vue-material-design-icons/Plus.vue";
77
77
  import RssIcon from "vue-material-design-icons/Rss.vue";
78
- import { mapState } from "pinia";
79
78
  import { useApiStore } from "../../../stores/ApiStore";
80
79
  import ClassicPopover from "../../misc/ClassicPopover.vue";
81
80
  import { Emission } from "@/stores/class/general/emission";
82
- import { defineComponent } from "vue";
81
+ import { computed, Ref, ref, useTemplateRef, watch } from "vue";
82
+ import { useI18n } from "vue-i18n";
83
83
  type Link = {
84
84
  name: string;
85
85
  icon: string;
@@ -87,216 +87,193 @@ type Link = {
87
87
  color?: string;
88
88
  url: string | undefined;
89
89
  };
90
- export default defineComponent({
91
- name: "SubscribeButtons",
92
- components: {
93
- ClassicPopover,
94
- RssIcon,
95
- PlusIcon,
96
- SpotifyIcon,
97
- YoutubeIcon,
98
- ApplePodcastIcon,
99
- DeezerIcon,
100
- AmazonMusicIcon,
101
- IHeartIcon,
102
- PlayerFmIcon,
103
- PocketCastIcon,
104
- PodcastAddictIcon,
105
- TuninIcon,
106
- RadiolineIcon,
107
- },
108
- props: {
109
- emission: { default: undefined, type: Object as () => Emission },
110
- playlistId: { default: undefined, type: Number },
111
- windowWidth: { default: 0, type: Number },
112
- justifyCenter: { default: true, type: Boolean },
113
- },
114
- data() {
115
- return {
116
- hiddenLinks: [] as Array<Link>,
117
- lastWindowWidth: 420 as number,
118
- exclusive: false as boolean,
119
- notExclusive: false as boolean,
120
- };
121
- },
122
- computed: {
123
- ...mapState(useApiStore, ["apiUrl"]),
124
- subscriptionsDisplay(): Array<Link> {
125
- const sub = [
126
- {
127
- name: "applePodcast",
128
- icon: "ApplePodcastIcon",
129
- title: "Apple Podcast | iTunes",
130
- url: this.getUrl("applePodcast"),
131
- color:"#aa1dd3"
132
- },
133
- {
134
- name: "deezer",
135
- icon: "DeezerIcon",
136
- title: "Deezer",
137
- color:"#a238ff",
138
- url: this.getUrl("deezer"),
139
- },
140
- {
141
- name: "spotify",
142
- icon: "SpotifyIcon",
143
- title: "Spotify",
144
- color: "#1ed760",
145
- url: this.getUrl("spotify"),
146
- },
147
- {
148
- name: "amazon",
149
- icon: "AmazonMusicIcon",
150
- title: "Amazon Music",
151
- color: "#0c6cb3",
152
- url: this.getUrl("amazon"),
153
- },
154
90
 
155
- {
156
- name: "iHeart",
157
- icon: "IHeartIcon",
158
- title: "iHeart",
159
- url: this.getUrl("iHeart"),
160
- color:"#e11b22"
161
- },
162
- {
163
- name: "playerFm",
164
- icon: "PlayerFmIcon",
165
- title: "PlayerFM",
166
- url: this.getUrl("playerFm"),
167
- color:"#bb202a"
168
- },
169
- {
170
- name: "pocketCasts",
171
- icon: "PocketCastIcon",
172
- title: "Pocket Casts",
173
- url: this.getUrl("pocketCasts"),
174
- color:"#f43e37"
175
- },
176
- {
177
- name: "podcastAddict",
178
- icon: "PodcastAddictIcon",
179
- title: "Podcast Addict",
180
- url: this.getUrl("podcastAddict"),
181
- color:"#f4842d"
182
- },
183
- {
184
- name: "radioline",
185
- icon: "RadiolineIcon",
186
- title: "Radioline",
187
- url: this.getUrl("radioline"),
188
- color:"#1678bd"
189
- },
91
+ //Props
92
+ const props = defineProps({
93
+ emission: { default: undefined, type: Object as () => Emission },
94
+ playlistId: { default: undefined, type: Number },
95
+ windowWidth: { default: 0, type: Number },
96
+ justifyCenter: { default: true, type: Boolean },
97
+ })
190
98
 
191
- {
192
- name: "tunein",
193
- icon: "TuninIcon",
194
- title: "TuneIn",
195
- url: this.getUrl("tunein"),
196
- color:"#36b4a7"
197
- },
198
- {
199
- name: "youtube",
200
- icon: "YoutubeIcon",
201
- title: "YouTube Music",
202
- color: "#fe0000",
203
- url: this.getUrl("youtube"),
204
- },
205
- ];
206
- return sub.filter((item) => item.url);
99
+ //Data
100
+ const lastWindowWidth = ref(420);
101
+ const hiddenLinks: Ref<Array<Link>> = ref([]);
102
+ const subscribeButtonsContainerRef = useTemplateRef('subscribeButtonsContainer');
103
+
104
+
105
+ //Composables
106
+ const { t } = useI18n();
107
+ const apiStore = useApiStore();
108
+
109
+ //Computed
110
+ const subscriptionsDisplay = computed(() => {
111
+ const sub = [
112
+ {
113
+ name: "applePodcast",
114
+ icon: ApplePodcastIcon,
115
+ title: "Apple Podcast | iTunes",
116
+ url: getUrl("applePodcast"),
117
+ color:"#aa1dd3"
118
+ },
119
+ {
120
+ name: "deezer",
121
+ icon: DeezerIcon,
122
+ title: "Deezer",
123
+ color:"#a238ff",
124
+ url: getUrl("deezer"),
207
125
  },
208
- rssUrl(): string | undefined {
209
- const api = this.apiUrl + "rss/";
210
- if (this.emission) {
211
- return api + "emission/" + this.emission?.emissionId + ".rss";
212
- }
213
- if (this.playlistId) {
214
- return api + "playlist/" + this.playlistId + ".rss";
215
- }
216
- return undefined;
126
+ {
127
+ name: "spotify",
128
+ icon: SpotifyIcon,
129
+ title: "Spotify",
130
+ color: "#1ed760",
131
+ url: getUrl("spotify"),
132
+ },
133
+ {
134
+ name: "amazon",
135
+ icon: AmazonMusicIcon,
136
+ title: "Amazon Music",
137
+ color: "#0c6cb3",
138
+ url: getUrl("amazon"),
139
+ },
140
+
141
+ {
142
+ name: "iHeart",
143
+ icon: IHeartIcon,
144
+ title: "iHeart",
145
+ url: getUrl("iHeart"),
146
+ color:"#e11b22"
217
147
  },
218
- },
219
- watch: {
220
- windowWidth() {
221
- this.resizeWindow();
148
+ {
149
+ name: "playerFm",
150
+ icon: PlayerFmIcon,
151
+ title: "PlayerFM",
152
+ url: getUrl("playerFm"),
153
+ color:"#bb202a"
222
154
  },
223
- },
224
- mounted() {
225
- this.resizeWindow();
226
- },
227
- methods: {
228
- getUrl(sub: string): string | undefined {
229
- return this.externaliseLinks(
230
- this.emission?.annotations?.[sub] as string | undefined,
231
- );
155
+ {
156
+ name: "pocketCasts",
157
+ icon: PocketCastIcon,
158
+ title: "Pocket Casts",
159
+ url: getUrl("pocketCasts"),
160
+ color:"#f43e37"
232
161
  },
233
- externaliseLinks(link?: string): string | undefined {
234
- if (!link) return link;
235
- link = link.trim();
236
- return !link.startsWith("http") && !link.startsWith("//")
237
- ? "//" + link
238
- : link;
162
+ {
163
+ name: "podcastAddict",
164
+ icon: PodcastAddictIcon,
165
+ title: "Podcast Addict",
166
+ url: getUrl("podcastAddict"),
167
+ color:"#f4842d"
239
168
  },
240
- showAllElements() {
241
- this.subscriptionsDisplay.forEach((element: Link) => {
242
- const el = (
243
- this.$refs["subLink" + element.name] as Array<HTMLElement>
244
- )[0];
245
- if (!el) return;
246
- if (el.classList.contains("hid")) {
247
- el.classList.remove("hid");
248
- }
249
- });
169
+ {
170
+ name: "radioline",
171
+ icon: RadiolineIcon,
172
+ title: "Radioline",
173
+ url: getUrl("radioline"),
174
+ color:"#1678bd"
250
175
  },
251
- hideOnlyNecessaryElements() {
252
- let parentWidth = 0;
253
- this.subscriptionsDisplay.forEach((element: Link) => {
254
- const el = (
255
- this.$refs["subLink" + element.name] as Array<HTMLElement>
256
- )[0];
257
- if (!el) return;
258
- if (!parentWidth) {
259
- const buttonMoreWidth = el.clientWidth + 20;
260
- parentWidth =
261
- (el.parentElement?.clientWidth ?? 0) +
262
- (el.parentElement?.offsetLeft ?? 0) -
263
- buttonMoreWidth;
264
- }
265
- if (el.offsetLeft + el.clientWidth + 20 < parentWidth) {
266
- return;
267
- }
268
- this.hiddenLinks.push(element);
269
- if (!el.classList.contains("hid")) {
270
- el.className += " hid";
271
- }
272
- });
176
+
177
+ {
178
+ name: "tunein",
179
+ icon: TuninIcon,
180
+ title: "TuneIn",
181
+ url: getUrl("tunein"),
182
+ color:"#36b4a7"
273
183
  },
274
- resizeWindow() {
275
- if (this.windowWidth > 420 && this.lastWindowWidth > 420) {
276
- this.lastWindowWidth = this.windowWidth;
277
- return;
278
- }
279
- const subscribeList = this.$refs.subscribeButtonsContainer as HTMLElement;
280
- if (
281
- null === subscribeList ||
282
- !subscribeList ||
283
- "none" === subscribeList?.parentElement?.style.display
284
- ) {
285
- return;
286
- }
287
- this.lastWindowWidth = this.windowWidth;
288
- subscribeList.style.justifyContent = "flex-start";
289
- subscribeList.style.flexGrow = "1";
290
- this.hiddenLinks.length = 0;
291
- this.showAllElements();
292
- this.hideOnlyNecessaryElements();
293
- if (!this.hiddenLinks.length && this.justifyCenter) {
294
- subscribeList.style.justifyContent = "center";
295
- }
296
- subscribeList.style.flexGrow = "0";
184
+ {
185
+ name: "youtube",
186
+ icon: YoutubeIcon,
187
+ title: "YouTube Music",
188
+ color: "#fe0000",
189
+ url: getUrl("youtube"),
297
190
  },
298
- },
191
+ ];
192
+ return sub.filter((item) => item.url);
193
+ });
194
+ const rssUrl = computed(() => {
195
+ const api = apiStore.apiUrl + "rss/";
196
+ if (props.emission) {
197
+ return api + "emission/" + props.emission?.emissionId + ".rss";
198
+ }
199
+ if (props.playlistId) {
200
+ return api + "playlist/" + props.playlistId + ".rss";
201
+ }
202
+ return undefined;
299
203
  });
204
+
205
+
206
+ //Watch
207
+ watch(()=>props.windowWidth, () =>resizeWindow(), {immediate: true});
208
+
209
+
210
+ //Methods
211
+ function getUrl(sub: string): string | undefined {
212
+ return externaliseLinks(
213
+ props.emission?.annotations?.[sub] as string | undefined,
214
+ );
215
+ }
216
+ function externaliseLinks(link?: string): string | undefined {
217
+ if (!link) return link;
218
+ link = link.trim();
219
+ return !link.startsWith("http") && !link.startsWith("//")
220
+ ? "//" + link
221
+ : link;
222
+ }
223
+ function showAllElements() {
224
+ subscriptionsDisplay.value.forEach((element: Link) => {
225
+ const el = subscribeButtonsContainerRef?.value?.querySelector('#subLink' + element.name);
226
+ if (!el) return;
227
+ if (el.classList.contains("hid")) {
228
+ el.classList.remove("hid");
229
+ }
230
+ });
231
+ }
232
+ function hideOnlyNecessaryElements() {
233
+ let parentWidth = 0;
234
+ subscriptionsDisplay.value.forEach((element: Link) => {
235
+ const el = subscribeButtonsContainerRef?.value?.querySelector('#subLink' + element.name);
236
+ if (!el) return;
237
+ if (!parentWidth) {
238
+ const buttonMoreWidth = el.clientWidth + 20;
239
+ parentWidth =
240
+ (el.parentElement?.clientWidth ?? 0) +
241
+ (el.parentElement?.offsetLeft ?? 0) -
242
+ buttonMoreWidth;
243
+ }
244
+ if (el.offsetLeft + el.clientWidth + 20 < parentWidth) {
245
+ return;
246
+ }
247
+ hiddenLinks.value.push(element);
248
+ if (!el.classList.contains("hid")) {
249
+ el.className += " hid";
250
+ }
251
+ });
252
+ }
253
+ function resizeWindow() {
254
+ if (props.windowWidth > 420 && lastWindowWidth.value > 420) {
255
+ lastWindowWidth.value = props.windowWidth;
256
+ return;
257
+ }
258
+ const subscribeList = subscribeButtonsContainerRef?.value as HTMLElement;
259
+ if (
260
+ null === subscribeList ||
261
+ !subscribeList ||
262
+ "none" === subscribeList?.parentElement?.style.display
263
+ ) {
264
+ return;
265
+ }
266
+ lastWindowWidth.value = props.windowWidth;
267
+ subscribeList.style.justifyContent = "flex-start";
268
+ subscribeList.style.flexGrow = "1";
269
+ hiddenLinks.value.length = 0;
270
+ showAllElements();
271
+ hideOnlyNecessaryElements();
272
+ if (!hiddenLinks.value.length && props.justifyCenter) {
273
+ subscribeList.style.justifyContent = "center";
274
+ }
275
+ subscribeList.style.flexGrow = "0";
276
+ }
300
277
  </script>
301
278
  <style lang="scss">
302
279
  .octopus-app {
@@ -2,7 +2,4 @@
2
2
  <div />
3
3
  </template>
4
4
 
5
- <script lang="ts">
6
- import { defineComponent } from "vue";
7
- export default defineComponent({});
8
- </script>
5
+ <script setup lang="ts"></script>