@saooti/octopus-sdk 1.0.0 → 29.0.2

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 (230) hide show
  1. package/README.md +73 -0
  2. package/index.d.ts +4 -0
  3. package/index.ts +12 -0
  4. package/package.json +61 -39
  5. package/public/css/fonts/saooti-ui.eot +0 -0
  6. package/public/css/fonts/saooti-ui.svg +30 -19
  7. package/public/css/fonts/saooti-ui.ttf +0 -0
  8. package/public/css/fonts/saooti-ui.woff +0 -0
  9. package/public/css/fonts/style.css +48 -5
  10. package/public/img/ACPM.png +0 -0
  11. package/public/img/article.png +0 -0
  12. package/src/App.vue +97 -31
  13. package/src/api/comments.ts +3 -1
  14. package/src/api/emissions.ts +5 -2
  15. package/src/api/initialize.ts +3 -2
  16. package/src/api/podcasts.ts +5 -2
  17. package/src/api/profile.ts +4 -2
  18. package/src/api/studio.ts +12 -1
  19. package/src/assets/bootstrap-diff.scss +265 -0
  20. package/src/assets/form.scss +23 -0
  21. package/src/assets/general.scss +47 -20
  22. package/src/assets/modal.scss +9 -10
  23. package/src/assets/multiselect.scss +19 -2
  24. package/src/assets/octopus-library.scss +16 -4
  25. package/src/assets/share.scss +343 -0
  26. package/src/components/display/aggregator/RssSection.vue +4 -4
  27. package/src/components/display/categories/CategoryChooser.vue +152 -105
  28. package/src/components/display/categories/CategoryFilter.vue +108 -0
  29. package/src/components/display/categories/CategoryList.vue +138 -109
  30. package/src/components/display/comments/AddCommentModal.vue +104 -87
  31. package/src/components/display/comments/CommentInput.vue +137 -118
  32. package/src/components/display/comments/CommentItem.vue +155 -137
  33. package/src/components/display/comments/CommentList.vue +142 -120
  34. package/src/components/display/comments/CommentParentInfo.vue +39 -35
  35. package/src/components/display/comments/CommentPlayer.vue +54 -48
  36. package/src/components/display/comments/CommentSection.vue +57 -58
  37. package/src/components/display/edit/EditBox.vue +4 -4
  38. package/src/components/display/edit/EditCommentBox.vue +25 -31
  39. package/src/components/display/emission/EmissionChooser.vue +82 -80
  40. package/src/components/display/emission/EmissionInlineList.vue +118 -105
  41. package/src/components/display/emission/EmissionItem.vue +66 -167
  42. package/src/components/display/emission/EmissionList.vue +96 -122
  43. package/src/components/display/emission/EmissionPlayerItem.vue +131 -126
  44. package/src/components/display/filter/AdvancedSearch.vue +306 -372
  45. package/src/components/display/filter/CategoryFilter.vue +117 -0
  46. package/src/components/display/filter/MonetizableFilter.vue +24 -10
  47. package/src/components/display/filter/ProductorSearch.vue +131 -135
  48. package/src/components/display/filter/RubriqueChoice.vue +104 -0
  49. package/src/components/display/filter/RubriqueFilter.vue +235 -0
  50. package/src/components/display/live/CountDown.vue +30 -29
  51. package/src/components/display/live/LiveHorizontalList.vue +40 -34
  52. package/src/components/display/live/LiveItem.vue +146 -158
  53. package/src/components/display/live/LiveList.vue +167 -154
  54. package/src/components/display/organisation/OrganisationChooser.vue +125 -124
  55. package/src/components/display/organisation/OrganisationChooserLight.vue +40 -47
  56. package/src/components/display/participant/ParticipantItem.vue +92 -108
  57. package/src/components/display/participant/ParticipantList.vue +76 -69
  58. package/src/components/display/playlist/PlaylistItem.vue +45 -56
  59. package/src/components/display/playlist/PlaylistList.vue +57 -48
  60. package/src/components/display/playlist/PodcastList.vue +94 -70
  61. package/src/components/display/podcasts/AnimatorsItem.vue +26 -23
  62. package/src/components/display/podcasts/ParticipantDescription.vue +115 -0
  63. package/src/components/display/podcasts/PodcastFilterList.vue +84 -85
  64. package/src/components/display/podcasts/PodcastImage.vue +244 -208
  65. package/src/components/display/podcasts/PodcastInlineList.vue +145 -207
  66. package/src/components/display/podcasts/PodcastItem.vue +150 -132
  67. package/src/components/display/podcasts/PodcastList.vue +89 -110
  68. package/src/components/display/podcasts/TagList.vue +23 -16
  69. package/src/components/display/rubriques/RubriqueChooser.vue +137 -123
  70. package/src/components/display/rubriques/RubriqueList.vue +227 -0
  71. package/src/components/display/sharing/PlayerParameters.vue +154 -106
  72. package/src/components/display/sharing/QrCode.vue +58 -0
  73. package/src/components/display/sharing/ShareButtons.vue +214 -92
  74. package/src/components/display/sharing/ShareDistribution.vue +110 -121
  75. package/src/components/display/sharing/SharePlayer.vue +245 -190
  76. package/src/components/display/sharing/SubscribeButtons.vue +130 -66
  77. package/src/components/display/studio/RecordingItemButton.vue +4 -4
  78. package/src/components/misc/ErrorMessage.vue +21 -16
  79. package/src/components/misc/Footer.vue +131 -66
  80. package/src/components/misc/HomeDropdown.vue +166 -123
  81. package/src/components/misc/LeftMenu.vue +151 -134
  82. package/src/components/misc/Player.vue +332 -328
  83. package/src/components/misc/Snackbar.vue +27 -29
  84. package/src/components/misc/TopBar.vue +204 -174
  85. package/src/components/misc/modal/ClipboardModal.vue +46 -26
  86. package/src/components/misc/modal/MessageModal.vue +67 -51
  87. package/src/components/misc/modal/NewsletterModal.vue +179 -136
  88. package/src/components/misc/modal/QrCodeModal.vue +83 -0
  89. package/src/components/misc/modal/ShareModalPlayer.vue +133 -74
  90. package/src/components/mixins/functions.ts +21 -18
  91. package/src/components/mixins/init.ts +24 -0
  92. package/src/components/mixins/organisationFilter.ts +24 -0
  93. package/src/components/pages/Category.vue +26 -26
  94. package/src/components/pages/Emission.vue +120 -92
  95. package/src/components/pages/Emissions.vue +109 -86
  96. package/src/components/pages/Home.vue +70 -16
  97. package/src/components/pages/Lives.vue +57 -47
  98. package/src/components/pages/Participant.vue +93 -77
  99. package/src/components/pages/Participants.vue +44 -31
  100. package/src/components/pages/Playlist.vue +63 -52
  101. package/src/components/pages/Playlists.vue +41 -39
  102. package/src/components/pages/Podcast.vue +265 -251
  103. package/src/components/pages/Podcasts.vue +135 -104
  104. package/src/components/pages/Rubrique.vue +25 -19
  105. package/src/components/pages/Search.vue +71 -67
  106. package/src/helper/dom.ts +2 -2
  107. package/src/helper/duration.ts +18 -8
  108. package/src/locale/educationen.ts +14 -0
  109. package/src/locale/en.ts +299 -1
  110. package/src/locale/fr.ts +25 -10
  111. package/src/locale/messages.ts +3 -2
  112. package/src/main.ts +54 -32
  113. package/src/router/router.ts +184 -159
  114. package/src/shims-tsx.d.ts +13 -0
  115. package/src/shims-vue-recaptcha-v3.d.ts +9 -0
  116. package/src/shims-vue.d.ts +5 -6
  117. package/src/store/AppStore.ts +36 -171
  118. package/src/store/class/category.ts +8 -0
  119. package/src/store/class/comment.ts +17 -0
  120. package/src/store/class/conference.ts +27 -0
  121. package/src/store/class/customPlayer.ts +8 -0
  122. package/src/store/class/emission.ts +20 -0
  123. package/src/store/class/fetchParam.ts +16 -0
  124. package/src/store/class/media.ts +13 -0
  125. package/src/store/class/organisation.ts +19 -0
  126. package/src/store/class/participant.ts +12 -0
  127. package/src/store/class/person.ts +13 -0
  128. package/src/store/class/player.ts +12 -0
  129. package/src/store/class/playlist.ts +15 -0
  130. package/src/store/class/podcast.ts +37 -0
  131. package/src/store/class/rubriquage.ts +9 -0
  132. package/src/store/class/rubriquageFilter.ts +5 -0
  133. package/src/store/class/rubrique.ts +8 -0
  134. package/src/store/paramStore.ts +70 -29
  135. package/src/store/typeAppStore.ts +171 -237
  136. package/src/vuex-shim.d.ts +8 -0
  137. package/tsconfig.json +4 -0
  138. package/vue.config.js +14 -0
  139. package/public/img/ACPM.PNG +0 -0
  140. package/src/assets/bootstrap_scss/_alert.scss +0 -51
  141. package/src/assets/bootstrap_scss/_badge.scss +0 -54
  142. package/src/assets/bootstrap_scss/_breadcrumb.scss +0 -42
  143. package/src/assets/bootstrap_scss/_button-group.scss +0 -164
  144. package/src/assets/bootstrap_scss/_buttons.scss +0 -291
  145. package/src/assets/bootstrap_scss/_card.scss +0 -278
  146. package/src/assets/bootstrap_scss/_carousel.scss +0 -197
  147. package/src/assets/bootstrap_scss/_close.scss +0 -41
  148. package/src/assets/bootstrap_scss/_code.scss +0 -48
  149. package/src/assets/bootstrap_scss/_custom-forms.scss +0 -522
  150. package/src/assets/bootstrap_scss/_dropdown.scss +0 -201
  151. package/src/assets/bootstrap_scss/_forms.scss +0 -352
  152. package/src/assets/bootstrap_scss/_functions.scss +0 -134
  153. package/src/assets/bootstrap_scss/_grid.scss +0 -69
  154. package/src/assets/bootstrap_scss/_images.scss +0 -42
  155. package/src/assets/bootstrap_scss/_input-group.scss +0 -191
  156. package/src/assets/bootstrap_scss/_jumbotron.scss +0 -17
  157. package/src/assets/bootstrap_scss/_list-group.scss +0 -158
  158. package/src/assets/bootstrap_scss/_media.scss +0 -8
  159. package/src/assets/bootstrap_scss/_mixins.scss +0 -47
  160. package/src/assets/bootstrap_scss/_modal.scss +0 -243
  161. package/src/assets/bootstrap_scss/_nav.scss +0 -120
  162. package/src/assets/bootstrap_scss/_navbar.scss +0 -324
  163. package/src/assets/bootstrap_scss/_pagination.scss +0 -74
  164. package/src/assets/bootstrap_scss/_popover.scss +0 -170
  165. package/src/assets/bootstrap_scss/_print.scss +0 -141
  166. package/src/assets/bootstrap_scss/_progress.scss +0 -46
  167. package/src/assets/bootstrap_scss/_reboot.scss +0 -482
  168. package/src/assets/bootstrap_scss/_root.scss +0 -20
  169. package/src/assets/bootstrap_scss/_spinners.scss +0 -55
  170. package/src/assets/bootstrap_scss/_tables.scss +0 -185
  171. package/src/assets/bootstrap_scss/_toasts.scss +0 -44
  172. package/src/assets/bootstrap_scss/_tooltip.scss +0 -115
  173. package/src/assets/bootstrap_scss/_transitions.scss +0 -20
  174. package/src/assets/bootstrap_scss/_type.scss +0 -125
  175. package/src/assets/bootstrap_scss/_utilities.scss +0 -17
  176. package/src/assets/bootstrap_scss/_variables.scss +0 -1145
  177. package/src/assets/bootstrap_scss/bootstrap-grid.scss +0 -29
  178. package/src/assets/bootstrap_scss/bootstrap-reboot.scss +0 -12
  179. package/src/assets/bootstrap_scss/bootstrap.scss +0 -44
  180. package/src/assets/bootstrap_scss/mixins/_alert.scss +0 -13
  181. package/src/assets/bootstrap_scss/mixins/_background-variant.scss +0 -22
  182. package/src/assets/bootstrap_scss/mixins/_badge.scss +0 -17
  183. package/src/assets/bootstrap_scss/mixins/_border-radius.scss +0 -63
  184. package/src/assets/bootstrap_scss/mixins/_box-shadow.scss +0 -20
  185. package/src/assets/bootstrap_scss/mixins/_breakpoints.scss +0 -123
  186. package/src/assets/bootstrap_scss/mixins/_buttons.scss +0 -110
  187. package/src/assets/bootstrap_scss/mixins/_caret.scss +0 -62
  188. package/src/assets/bootstrap_scss/mixins/_clearfix.scss +0 -7
  189. package/src/assets/bootstrap_scss/mixins/_deprecate.scss +0 -10
  190. package/src/assets/bootstrap_scss/mixins/_float.scss +0 -14
  191. package/src/assets/bootstrap_scss/mixins/_forms.scss +0 -177
  192. package/src/assets/bootstrap_scss/mixins/_gradients.scss +0 -45
  193. package/src/assets/bootstrap_scss/mixins/_grid-framework.scss +0 -71
  194. package/src/assets/bootstrap_scss/mixins/_grid.scss +0 -69
  195. package/src/assets/bootstrap_scss/mixins/_hover.scss +0 -37
  196. package/src/assets/bootstrap_scss/mixins/_image.scss +0 -36
  197. package/src/assets/bootstrap_scss/mixins/_list-group.scss +0 -21
  198. package/src/assets/bootstrap_scss/mixins/_lists.scss +0 -7
  199. package/src/assets/bootstrap_scss/mixins/_nav-divider.scss +0 -11
  200. package/src/assets/bootstrap_scss/mixins/_pagination.scss +0 -22
  201. package/src/assets/bootstrap_scss/mixins/_reset-text.scss +0 -17
  202. package/src/assets/bootstrap_scss/mixins/_resize.scss +0 -6
  203. package/src/assets/bootstrap_scss/mixins/_screen-reader.scss +0 -34
  204. package/src/assets/bootstrap_scss/mixins/_size.scss +0 -7
  205. package/src/assets/bootstrap_scss/mixins/_table-row.scss +0 -39
  206. package/src/assets/bootstrap_scss/mixins/_text-emphasis.scss +0 -17
  207. package/src/assets/bootstrap_scss/mixins/_text-hide.scss +0 -11
  208. package/src/assets/bootstrap_scss/mixins/_text-truncate.scss +0 -8
  209. package/src/assets/bootstrap_scss/mixins/_transition.scss +0 -16
  210. package/src/assets/bootstrap_scss/mixins/_visibility.scss +0 -8
  211. package/src/assets/bootstrap_scss/utilities/_align.scss +0 -8
  212. package/src/assets/bootstrap_scss/utilities/_background.scss +0 -19
  213. package/src/assets/bootstrap_scss/utilities/_borders.scss +0 -75
  214. package/src/assets/bootstrap_scss/utilities/_clearfix.scss +0 -3
  215. package/src/assets/bootstrap_scss/utilities/_display.scss +0 -26
  216. package/src/assets/bootstrap_scss/utilities/_embed.scss +0 -39
  217. package/src/assets/bootstrap_scss/utilities/_flex.scss +0 -51
  218. package/src/assets/bootstrap_scss/utilities/_float.scss +0 -11
  219. package/src/assets/bootstrap_scss/utilities/_overflow.scss +0 -5
  220. package/src/assets/bootstrap_scss/utilities/_position.scss +0 -32
  221. package/src/assets/bootstrap_scss/utilities/_screenreaders.scss +0 -11
  222. package/src/assets/bootstrap_scss/utilities/_shadows.scss +0 -6
  223. package/src/assets/bootstrap_scss/utilities/_sizing.scss +0 -20
  224. package/src/assets/bootstrap_scss/utilities/_spacing.scss +0 -73
  225. package/src/assets/bootstrap_scss/utilities/_stretched-link.scss +0 -19
  226. package/src/assets/bootstrap_scss/utilities/_text.scss +0 -72
  227. package/src/assets/bootstrap_scss/utilities/_visibility.scss +0 -13
  228. package/src/assets/bootstrap_scss/vendor/_rfs.scss +0 -204
  229. package/src/shims-vuex.d.ts +0 -7
  230. package/src/views/Home.vue +0 -18
@@ -1,19 +1,27 @@
1
1
  <template>
2
- <div class="d-flex flex-column comment-input-container mt-3" v-if="isPresent">
2
+ <div
3
+ v-if="isPresent"
4
+ class="d-flex flex-column comment-input-container mt-3"
5
+ >
3
6
  <b
7
+ v-if="knownIdentity && !editName"
4
8
  class="small-Text mt-1 c-hand"
5
9
  @click="changeIdentity"
6
- v-if="knownIdentity && !editName"
7
- >{{ knownIdentity }}</b
10
+ >{{ knownIdentity }}</b>
11
+ <div
12
+ v-if="knownIdentity && editName"
13
+ class="d-flex"
8
14
  >
9
- <div class="d-flex" v-if="knownIdentity && editName">
10
15
  <input
16
+ v-model="temporaryName"
11
17
  class="small-Text mt-1"
12
18
  type="text"
13
- v-model="temporaryName"
14
- v-bind:class="{ 'border border-danger': temporaryName.length < 2 }"
15
- />
16
- <button class="btn btn-light p-1 m-1" @click="editName = false">
19
+ :class="{ 'border border-danger': temporaryName.length < 2 }"
20
+ >
21
+ <button
22
+ class="btn btn-light p-1 m-1"
23
+ @click="editName = false"
24
+ >
17
25
  {{ $t('Cancel') }}
18
26
  </button>
19
27
  <button
@@ -24,7 +32,7 @@
24
32
  {{ $t('Validate') }}
25
33
  </button>
26
34
  </div>
27
- <b-form-textarea
35
+ <textarea
28
36
  ref="textarea"
29
37
  v-model="newComment"
30
38
  :placeholder="placeholder"
@@ -32,15 +40,21 @@
32
40
  :class="{ short: isOneLine && !newComment.includes('\n') }"
33
41
  @focus="textareaFocus = true"
34
42
  @blur="textareaFocus = false"
35
- ></b-form-textarea>
36
- <div class="d-flex justify-content-end mt-1" v-if="textareaFocus">
37
- <button class="btn mr-2" @mousedown="cancelAction">
43
+ />
44
+ <div
45
+ v-if="textareaFocus"
46
+ class="d-flex justify-content-end mt-1"
47
+ >
48
+ <button
49
+ class="btn me-2"
50
+ @mousedown="cancelAction"
51
+ >
38
52
  {{ $t('Cancel') }}
39
53
  </button>
40
54
  <button
41
55
  class="btn btn-primary"
42
- @mousedown="requestToSend"
43
56
  :disabled="0 === newComment.trim().length"
57
+ @mousedown="requestToSend"
44
58
  >
45
59
  {{ placeholder }}
46
60
  </button>
@@ -52,90 +66,58 @@
52
66
  />
53
67
  <MessageModal
54
68
  v-if="postError"
55
- @close="postError = false"
56
- @validate="postError = false"
57
69
  :validatetext="$t('Close')"
58
70
  :title="$t('Error')"
59
71
  :message="$t('Error occurs while post your comment...')"
72
+ @close="postError = false"
73
+ @validate="postError = false"
60
74
  />
61
75
  </div>
62
76
  </template>
63
77
 
64
- <style lang="scss">
65
- @import '../../../sass/_variables.scss';
66
- .comment-input-container {
67
- textarea::placeholder {
68
- color: $octopus-primary-color;
69
- }
70
- textarea:focus::placeholder {
71
- color: black;
72
- }
73
- textarea {
74
- border-top: 0;
75
- border-right: 0;
76
- border-left: 0;
77
- border-bottom: 0.1rem solid #ddd !important;
78
- overflow: hidden !important;
79
- box-shadow: unset !important;
80
- background: transparent !important;
81
- height: 40px;
82
- }
83
- textarea.short {
84
- max-height: 38px;
85
- }
86
- }
87
- </style>
88
-
89
78
  <script lang="ts">
90
- import AddCommentModal from './AddCommentModal.vue';
91
- import MessageModal from '../../misc/modal/MessageModal.vue';
92
79
  const octopusApi = require('@saooti/octopus-api');
93
80
  import commentApi from '@/api/comments';
94
-
95
81
  import { cookies } from '../../mixins/functions';
96
82
  import { state } from '../../../store/paramStore';
83
+ import { Podcast } from '@/store/class/podcast';
84
+ import { Conference } from '@/store/class/conference';
85
+ import { CommentPodcast } from '@/store/class/comment';
97
86
 
98
- import { defineComponent, ref } from 'vue';
87
+ import { defineComponent, defineAsyncComponent } from 'vue';
88
+ const AddCommentModal = defineAsyncComponent(() => import('./AddCommentModal.vue'));
89
+ const MessageModal = defineAsyncComponent(() => import('../../misc/modal/MessageModal.vue'));
99
90
  export default defineComponent({
100
91
  name: 'CommentInput',
101
-
102
- props: {
103
- podcast: { default: undefined as any },
104
- knownIdentity: { default: null as any },
105
- focus: { default: false },
106
- comId: { default: undefined as any },
107
- fetchConference: { default: undefined as any },
108
- },
109
- emits: ['update:knownIdentity', 'cancelAction', 'newComment'],
110
-
111
- mixins: [cookies],
112
-
113
92
  components: {
114
93
  AddCommentModal,
115
94
  MessageModal,
116
95
  },
96
+ mixins:[cookies],
117
97
 
118
- setup() {
119
- const textarea : any = ref(null);
120
- return {
121
- textarea,
122
- };
98
+ props: {
99
+ podcast: { default: undefined, type: Object as ()=>Podcast },
100
+ knownIdentity: { default: undefined, type: String },
101
+ focus: { default: false, type: Boolean },
102
+ comment: { default: undefined, type: Object as ()=>CommentPodcast },
103
+ fetchConference: { default: undefined, type: Object as ()=>Conference },
123
104
  },
105
+ emits: ['update:knownIdentity', 'cancelAction', 'newComment'],
124
106
 
125
107
  data() {
126
108
  return {
127
- newComment: '',
128
- textareaFocus: false,
129
- checkIdentityModal: false,
130
- postError: false,
131
- isOneLine: true,
132
- editName: false,
133
- temporaryName: '',
109
+ newComment: '' as string,
110
+ textareaFocus: false as boolean,
111
+ checkIdentityModal: false as boolean,
112
+ postError: false as boolean,
113
+ isOneLine: true as boolean,
114
+ editName: false as boolean,
115
+ temporaryName: '' as string,
134
116
  };
135
117
  },
136
118
 
137
119
  computed: {
138
- isPresent() {
120
+ isPresent(): boolean {
139
121
  if (!this.podcast) return true;
140
122
  let podcastComment = 'INHERIT';
141
123
  if (this.podcast.annotations && this.podcast.annotations.COMMENTS) {
@@ -156,30 +138,33 @@ export default defineComponent({
156
138
  }
157
139
  return true;
158
140
  },
159
- placeholder():string {
160
- if (this.comId) return this.$t('Answer a comment');
161
- return this.$t('Write a comment');
141
+ placeholder(): string {
142
+ if (this.comment && this.comment.comId) return this.$t('Answer a comment').toString();
143
+ return this.$t('Write a comment').toString();
162
144
  },
163
- organisationId() {
145
+ organisationId(): string {
164
146
  return state.generalParameters.organisationId;
165
147
  },
166
- authenticated():boolean {
148
+ authenticated(): boolean {
167
149
  return state.generalParameters.authenticated;
168
150
  },
169
- isCertified() {
151
+ isCertified(): boolean {
170
152
  if (
171
153
  (state.generalParameters.isCommments &&
172
- this.organisationId === this.podcast.organisation.id) ||
154
+ this.organisationId === this.podcastOrga) ||
173
155
  state.generalParameters.isAdmin
174
156
  )
175
157
  return true;
176
158
  return false;
177
159
  },
178
- userId():any {
160
+ userId(): string|undefined {
179
161
  if (this.authenticated) return this.$store.state.profile.userId;
180
162
  return undefined;
181
163
  },
182
- phase() {
164
+ phase(): string|undefined {
165
+ if(undefined === this.podcast){
166
+ return this.comment ? this.comment.phase : '';
167
+ }
183
168
  if (
184
169
  !this.podcast.conferenceId ||
185
170
  0 === this.podcast.conferenceId ||
@@ -194,55 +179,82 @@ export default defineComponent({
194
179
  return 'Prelive';
195
180
  return 'Live';
196
181
  },
182
+ podcastOrga(): string|undefined{
183
+ const commentOrga = this.comment ? this.comment.organisationId : '';
184
+ return this.podcast ? this.podcast.organisation.id : commentOrga;
185
+ }
186
+ },
187
+ watch: {
188
+ textareaFocus(): void {
189
+ this.newComment = this.newComment.trim();
190
+ },
191
+ focus(): void {
192
+ (this.$refs.textarea as HTMLElement).focus();
193
+ },
194
+ newComment(): void {
195
+ const padding =
196
+ 1.5 * parseFloat(getComputedStyle(document.documentElement).fontSize);
197
+ this.isOneLine =
198
+ (this.$refs.textarea as any).$el.clientWidth -
199
+ this.inputExceeded(
200
+ this.newComment,
201
+ '18px Montserrat, sans-serif, Helvetica Neue'
202
+ ) >
203
+ padding;
204
+ },
197
205
  },
198
-
199
206
  methods: {
200
- changeIdentity() {
207
+ changeIdentity(): void {
208
+ if(!this.knownIdentity){return}
201
209
  this.temporaryName = this.knownIdentity;
202
210
  this.editName = true;
203
211
  },
204
- validEdit() {
212
+ validEdit(): void {
205
213
  this.setCookie('comment-octopus-name', this.temporaryName);
206
214
  this.$emit('update:knownIdentity', this.temporaryName);
207
215
  this.editName = false;
208
216
  },
209
- inputExceeded(text: string, font: string) {
210
- let element = document.createElement('canvas');
211
- let context = element.getContext('2d');
212
- context!.font = font;
213
- return context!.measureText(text).width;
217
+ inputExceeded(text: string, font: string): number {
218
+ const element = document.createElement('canvas');
219
+ const context = element.getContext('2d');
220
+ if(null === context){
221
+ return 0;
222
+ }
223
+ context.font = font;
224
+ return context.measureText(text).width;
214
225
  },
215
- requestToSend() {
226
+ requestToSend(): void {
216
227
  if (this.knownIdentity) {
217
228
  this.postComment();
218
229
  } else {
219
230
  this.checkIdentityModal = true;
220
231
  }
221
232
  },
222
- cancelAction() {
233
+ cancelAction(): void {
223
234
  this.$emit('cancelAction');
224
235
  },
225
- async postComment(name?: string) {
236
+ async postComment(name?: string): Promise<void> {
226
237
  if (name) {
227
238
  this.setCookie('comment-octopus-name', name);
228
239
  this.$emit('update:knownIdentity', name);
229
240
  }
230
241
  let timeline = 0;
231
242
  if (
243
+ undefined !== this.podcast &&(
232
244
  (this.$store.state.player.podcast &&
233
245
  this.$store.state.player.podcast.podcastId ===
234
246
  this.podcast.podcastId) ||
235
247
  (this.$store.state.player.live &&
236
248
  this.$store.state.player.live.livePodcastId ===
237
- this.podcast.podcastId)
249
+ this.podcast.podcastId))
238
250
  ) {
239
251
  timeline = Math.round(
240
- this.$store.state.player.elapsed! * this.$store.state.player.total!
252
+ this.$store.state.player.elapsed * this.$store.state.player.total
241
253
  );
242
254
  if (this.podcast.duration && this.$store.state.player.podcast) {
243
255
  timeline = Math.round(
244
256
  timeline -
245
- (this.$store.state.player.total! - this.podcast.duration / 1000)
257
+ (this.$store.state.player.total - this.podcast.duration / 1000)
246
258
  );
247
259
  }
248
260
  if (timeline < 0) {
@@ -253,13 +265,14 @@ export default defineComponent({
253
265
  if (null === sendName && name) {
254
266
  sendName = name;
255
267
  }
256
- let comment:any = {
268
+ const commentPodcastId = this.comment ? this.comment.podcastId : 0;
269
+ const comment: any = {
257
270
  content: this.newComment,
258
271
  name: sendName,
259
- podcastId: this.podcast.podcastId,
272
+ podcastId: this.podcast ? this.podcast.podcastId : commentPodcastId,
260
273
  timeline: timeline,
261
- organisationId: this.podcast.organisation.id,
262
- commentIdReferer: this.comId,
274
+ organisationId: this.podcastOrga,
275
+ commentIdReferer: this.comment ? this.comment.comId : undefined,
263
276
  certified: this.isCertified,
264
277
  userId: this.userId,
265
278
  phase: this.phase,
@@ -268,7 +281,7 @@ export default defineComponent({
268
281
  let data;
269
282
  if (this.isCertified) {
270
283
  comment.status = 'Valid';
271
- data = await commentApi.postComment(this.$store, comment);
284
+ data = await commentApi.postComment(this.$store.state, comment);
272
285
  } else {
273
286
  data = await octopusApi.postComment(comment);
274
287
  }
@@ -281,25 +294,31 @@ export default defineComponent({
281
294
  }
282
295
  },
283
296
  },
284
-
285
- watch: {
286
- textareaFocus() {
287
- this.newComment = this.newComment.trim();
288
- },
289
- focus() {
290
- this.textarea.focus();
291
- },
292
- newComment() {
293
- let padding =
294
- 1.5 * parseFloat(getComputedStyle(document.documentElement).fontSize);
295
- this.isOneLine =
296
- this.textarea.$el.clientWidth -
297
- this.inputExceeded(
298
- this.newComment,
299
- '18px Montserrat, sans-serif, Helvetica Neue'
300
- ) >
301
- padding;
302
- },
303
- },
304
- });
297
+ })
305
298
  </script>
299
+
300
+ <style lang="scss">
301
+ @import '../../../sass/_variables.scss';
302
+ .comment-input-container {
303
+ textarea::placeholder {
304
+ color: $octopus-primary-color;
305
+ }
306
+ textarea:focus::placeholder {
307
+ color: black;
308
+ }
309
+ textarea {
310
+ outline-width: 0 !important;
311
+ border-top: 0;
312
+ border-right: 0;
313
+ border-left: 0;
314
+ border-bottom: 0.1rem solid #ddd !important;
315
+ overflow: hidden !important;
316
+ box-shadow: unset !important;
317
+ background: transparent !important;
318
+ height: 40px;
319
+ }
320
+ textarea.short {
321
+ max-height: 38px;
322
+ }
323
+ }
324
+ </style>