@saooti/octopus-sdk 39.0.53 → 39.0.55

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 (91) hide show
  1. package/index.ts +4 -0
  2. package/package.json +7 -2
  3. package/public/config.ts +2 -2
  4. package/src/App.vue +0 -1
  5. package/src/api/classicCrud.ts +5 -0
  6. package/src/assets/bootstrap.scss +2 -2
  7. package/src/assets/comments.scss +18 -0
  8. package/src/assets/general.scss +7 -1
  9. package/src/assets/share.scss +0 -15
  10. package/src/assets/videoPlayer.scss +16 -0
  11. package/src/components/display/comments/CommentInput.vue +102 -218
  12. package/src/components/display/comments/CommentList.vue +209 -198
  13. package/src/components/display/comments/CommentName.vue +88 -0
  14. package/src/components/display/comments/CommentParentInfo.vue +5 -5
  15. package/src/components/display/comments/CommentPlayer.vue +45 -29
  16. package/src/components/display/comments/CommentSection.vue +81 -75
  17. package/src/components/display/comments/item/CommentBasicView.vue +111 -0
  18. package/src/components/display/comments/item/CommentItem.vue +235 -0
  19. package/src/components/display/comments/item/CommentMoreActions.vue +270 -0
  20. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +10 -0
  21. package/src/components/display/comments/like/LikeButton.vue +160 -0
  22. package/src/components/display/comments/like/LikeSection.vue +173 -0
  23. package/src/components/display/comments/like/ThumbIcon.vue +38 -0
  24. package/src/components/display/comments/modal/CheckIdentityModal.vue +61 -0
  25. package/src/components/display/comments/modal/EditCommentModal.vue +161 -0
  26. package/src/components/display/comments/modal/RecaptchaModal.vue +115 -0
  27. package/src/components/display/comments/modal/ReportAbuseModal.vue +113 -0
  28. package/src/components/display/emission/EmissionInlineList.vue +4 -5
  29. package/src/components/display/emission/EmissionItem.vue +4 -5
  30. package/src/components/display/emission/EmissionList.vue +5 -5
  31. package/src/components/display/emission/EmissionPlayerItem.vue +4 -5
  32. package/src/components/display/list/ListPaginate.vue +5 -0
  33. package/src/components/display/list/PaginateSection.vue +1 -4
  34. package/src/components/display/live/CountDown.vue +8 -47
  35. package/src/components/display/live/CountdownOctopus.vue +206 -0
  36. package/src/components/display/live/LiveHorizontalList.vue +5 -5
  37. package/src/components/display/organisation/OrganisationChooser.vue +4 -5
  38. package/src/components/display/participant/ParticipantItem.vue +4 -5
  39. package/src/components/display/participant/ParticipantList.vue +5 -5
  40. package/src/components/display/playlist/PlaylistList.vue +5 -5
  41. package/src/components/display/playlist/PodcastList.vue +1 -0
  42. package/src/components/display/podcasts/PodcastInlineListClassic.vue +4 -5
  43. package/src/components/display/podcasts/PodcastList.vue +5 -5
  44. package/src/components/display/podcasts/PodcastModuleBox.vue +18 -60
  45. package/src/components/display/podcasts/PodcastPlayButton.vue +4 -0
  46. package/src/components/display/podcasts/PodcastSwiperList.vue +4 -5
  47. package/src/components/display/podcasts/VideoModuleBox.vue +59 -0
  48. package/src/components/form/ClassicCheckbox.vue +7 -8
  49. package/src/components/form/ClassicContentEditable.vue +60 -0
  50. package/src/components/form/ClassicEmojiPicker.vue +82 -0
  51. package/src/components/form/ClassicInputText.vue +24 -1
  52. package/src/components/form/ClassicSelect.vue +3 -2
  53. package/src/components/misc/ClassicNav.vue +1 -1
  54. package/src/components/misc/ClassicPopover.vue +3 -0
  55. package/src/components/misc/modal/MessageModal.vue +44 -26
  56. package/src/components/misc/player/PlayerCompact.vue +0 -11
  57. package/src/components/misc/player/PlayerComponent.vue +5 -6
  58. package/src/components/misc/player/PlayerLarge.vue +1 -7
  59. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +2 -5
  60. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +2 -8
  61. package/src/components/misc/player/video/PlayerVideo.vue +5 -2
  62. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +14 -26
  63. package/src/components/misc/player/video/PlayerVideoHls.vue +3 -1
  64. package/src/components/mixins/player/playerLive.ts +2 -6
  65. package/src/components/mixins/player/playerLogic.ts +1 -3
  66. package/src/components/mixins/podcast/countdown.ts +45 -0
  67. package/src/components/mixins/podcast/podcastView.ts +54 -0
  68. package/src/components/pages/PodcastPage.vue +11 -41
  69. package/src/components/pages/VideoPage.vue +299 -0
  70. package/src/helper/string.ts +13 -0
  71. package/src/helper/uuidGenerator.ts +7 -0
  72. package/src/locale/de.ts +29 -5
  73. package/src/locale/en.ts +29 -5
  74. package/src/locale/es.ts +29 -5
  75. package/src/locale/fr.ts +29 -5
  76. package/src/locale/it.ts +29 -4
  77. package/src/locale/sl.ts +29 -5
  78. package/src/router/router.ts +10 -0
  79. package/src/stores/CommentStore.ts +198 -25
  80. package/src/stores/ParamSdkStore.ts +21 -21
  81. package/src/stores/class/config/commentsConfig.ts +52 -0
  82. package/src/stores/class/general/comment.ts +75 -11
  83. package/src/stores/class/general/listReturn.ts +7 -0
  84. package/src/websocket/commentWebsocket.ts +67 -0
  85. package/src/websocket/wss.ts +182 -0
  86. package/src/components/display/comments/AddCommentModal.vue +0 -142
  87. package/src/components/display/comments/CommentBasicView.vue +0 -102
  88. package/src/components/display/comments/CommentItem.vue +0 -363
  89. package/src/components/display/edit/EditCommentBox.vue +0 -151
  90. package/src/components/misc/player/elements/PlayerTimeline.vue +0 -57
  91. package/src/components/mixins/player/playerComment.ts +0 -105
package/index.ts CHANGED
@@ -77,6 +77,8 @@ export const getPaginateParams = () => import("./src/components/display/list/Pag
77
77
  export const getListPaginate = () => import("./src/components/display/list/ListPaginate.vue");
78
78
  export const getClassicMultiselect = () => import("./src/components/form/ClassicMultiselect.vue");
79
79
  export const getClassicInputText = () => import("./src/components/form/ClassicInputText.vue");
80
+ export const getClassicEmojiPicker = () => import("./src/components/form/ClassicEmojiPicker.vue");
81
+ export const getClassicContentEditable = () => import("./src/components/form/ClassicContentEditable.vue");
80
82
 
81
83
  //mixins
82
84
 
@@ -88,6 +90,7 @@ import orgaFilter from "./src/components/mixins/organisationFilter.ts";
88
90
  import initSDK from "./src/components/mixins/init.ts";
89
91
  import tagOfMixins from "./src/components/mixins/tagOfMixins.ts";
90
92
  import resizePhone from "./src/components/mixins/resizePhone.ts";
93
+ import commentWebsocket from "./src/websocket/commentWebsocket.ts";
91
94
 
92
95
 
93
96
  import TopBar from "./src/components/misc/TopBar.vue";
@@ -101,5 +104,6 @@ export {
101
104
  initSDK,
102
105
  tagOfMixins,
103
106
  resizePhone,
107
+ commentWebsocket,
104
108
  TopBar
105
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "39.0.53",
3
+ "version": "39.0.55",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -14,8 +14,10 @@
14
14
  "test": "jest --coverage"
15
15
  },
16
16
  "dependencies": {
17
+ "@multiformats/murmur3": "^2.1.8",
17
18
  "@popperjs/core": "^2.11.8",
18
- "@saooti/octopus-api": "^0.39.1",
19
+ "@saooti/octopus-api": "^0.39.2",
20
+ "@stomp/stompjs": "^7.0.0",
19
21
  "@tiptap/extension-link": "^2.4.0",
20
22
  "@tiptap/extension-underline": "^2.4.0",
21
23
  "@tiptap/pm": "^2.4.0",
@@ -28,6 +30,7 @@
28
30
  "autoprefixer": "^10.4.19",
29
31
  "axios": "^1.7.2",
30
32
  "dayjs": "^1.11.11",
33
+ "emoji-mart-vue-fast": "^15.0.2",
31
34
  "eslint-config-prettier": "^9.1.0",
32
35
  "eslint-plugin-prettier": "^5.1.3",
33
36
  "express": "^4.19.2",
@@ -37,6 +40,7 @@
37
40
  "pinia": "^2.1.7",
38
41
  "qrcode.vue": "^3.4.1",
39
42
  "sass": "^1.77.6",
43
+ "sockjs-client": "^1.6.1",
40
44
  "sonarqube-scanner": "^3.3.0",
41
45
  "swiper": "^11.1.4",
42
46
  "video.js": "^8.12.0",
@@ -51,6 +55,7 @@
51
55
  "vue3-swatches": "^1.2.4"
52
56
  },
53
57
  "devDependencies": {
58
+ "@types/sockjs-client": "^1.5.4",
54
59
  "@types/vue-select": "^3.16.8",
55
60
  "@typescript-eslint/eslint-plugin": "^7.14.1",
56
61
  "@typescript-eslint/parser": "^7.14.1",
package/public/config.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export default Object.freeze({
2
- MAX_COMMENT : 4096,
3
- MAX_COMMENT_NAME : 127
2
+ MAX_COMMENT : 4095,
3
+ MAX_COMMENT_NAME : 255
4
4
  });
package/src/App.vue CHANGED
@@ -12,7 +12,6 @@
12
12
  </template>
13
13
  </div>
14
14
  </template>
15
-
16
15
  <script lang="ts">
17
16
  import TopBar from "@/components/misc/TopBar.vue";
18
17
  import PlayerComponent from "@/components/misc/player/PlayerComponent.vue";
@@ -29,5 +29,10 @@ export default {
29
29
  console.log(moduleName,wsPath);
30
30
  await axios.delete('/mock');
31
31
  },
32
+ async updateData<Type>(moduleName: ModuleApi,wsPath:string, elementToUpdate: Type): Promise<Type>{
33
+ console.log(moduleName,wsPath,elementToUpdate);
34
+ const response = await axios.get('/mock');
35
+ return response.data;
36
+ },
32
37
  };
33
38
  /* eslint-enable */
@@ -3,7 +3,7 @@
3
3
  -webkit-box-sizing: border-box;
4
4
  box-sizing: border-box;
5
5
  }
6
- input:not([class^="vs__"]), button:not([class^="vs__"]), select:not([class^="vs__"]), optgroup, textarea {
6
+ input:not([class^="vs__"]), button:not([class^="vs__"]), select:not([class^="vs__"]), optgroup, textarea, pre {
7
7
  margin: 0;
8
8
  font-family: inherit;
9
9
  font-size: inherit;
@@ -209,7 +209,7 @@ input:not([class^="vs__"]), button:not([class^="vs__"]), select:not([class^="vs_
209
209
  border: 0;
210
210
  }
211
211
  .share-btn {
212
- font-size: 1.3rem;
212
+ font-size: 1rem;
213
213
  width: 2.5rem !important;
214
214
  height: 2.5rem !important;
215
215
  padding: 0.5rem;
@@ -0,0 +1,18 @@
1
+ @import '@scss/_variables.scss';
2
+
3
+ .octopus-app{
4
+ .status-PENDING {
5
+ background: #eb7d22;
6
+ }
7
+ .status-NOT_VALID {
8
+ background: #d40303;
9
+ }
10
+ .status-VALIDATED {
11
+ background: $octopus-primary-color;
12
+ }
13
+ .status-comment, .status-VALIDATED, .status-NOT_VALID, .status-PENDING {
14
+ width: 14px;
15
+ height: 14px;
16
+ border-radius: 50%;
17
+ }
18
+ }
@@ -64,12 +64,18 @@ body{
64
64
  .secondary-bg{
65
65
  background: $octopus-background;
66
66
  }
67
+ .really-light-secondary-bg{
68
+ background: #f7f7f7;
69
+ }
67
70
  .light-primary-bg{
68
71
  background-color: $primaryColorTransparent !important;
69
72
  }
70
73
  .really-light-primary-bg{
71
74
  background-color: $primaryColorReallyTransparent !important;
72
75
  }
76
+ .blue-bg{
77
+ background-color: $blue-octopus;
78
+ }
73
79
  .width-fit-content{
74
80
  width: fit-content !important;
75
81
  }
@@ -78,7 +84,7 @@ body{
78
84
  }
79
85
  .page-box{
80
86
  background-color: $octopus-background;
81
- padding: 1rem 5rem 5rem 5rem;
87
+ padding: 1rem 3rem 3rem 3rem;
82
88
  flex-grow: 1;
83
89
  display: flex;
84
90
  flex-direction: column;
@@ -228,21 +228,6 @@
228
228
  }
229
229
  }
230
230
  }
231
- .status-Pending {
232
- background: #eb7d22;
233
- }
234
- .status-Invalid {
235
- background: #d40303;
236
- }
237
- .status-Valid {
238
- background: $octopus-primary-color;
239
- }
240
- .status-Valid, .status-Invalid, .status-Pending {
241
- width: 14px;
242
- height: 14px;
243
- border-radius: 50%;
244
- }
245
-
246
231
  .logo-octopus{
247
232
  width: 250px;
248
233
  @media (max-width: 960px) {
@@ -0,0 +1,16 @@
1
+ .octopus-app {
2
+ .video-responsive-wrapper {
3
+ position:relative;
4
+ padding-bottom:56.25%;
5
+ height:0;
6
+ width: 100%;
7
+ iframe, #video-element-hls {
8
+ position:absolute;
9
+ top:0;
10
+ left:0;
11
+ width:100% !important;
12
+ height:100%;
13
+ margin:0 !important;
14
+ }
15
+ }
16
+ }
@@ -1,70 +1,41 @@
1
1
  <template>
2
- <div v-if="isPresent" class="d-flex flex-column comment-input-container mt-3">
3
- <strong
4
- v-if="knownIdentity && !editName"
5
- class="h6 mt-1 c-hand"
6
- @click="changeIdentity"
7
- >{{ knownIdentity }}</strong
8
- >
9
- <div v-if="editName" class="d-flex">
10
- <div class="d-flex flex-column">
11
- <input
12
- v-model="temporaryName"
13
- class="h6 mt-1"
14
- type="text"
15
- :class="{ 'border border-danger': 0 === countName || !validName }"
16
- />
17
- <p
18
- class="d-flex justify-content-end h6 mb-0"
19
- :class="{ 'text-danger': !validName }"
20
- >
21
- {{ countName + " / " + maxName }}
22
- </p>
23
- </div>
24
- <button class="btn m-1" @click="editName = false">
25
- {{ $t("Cancel") }}
26
- </button>
27
- <button
28
- class="btn btn-primary m-1"
29
- :disabled="0 === countName || !validName"
30
- @click="validEdit"
31
- >
32
- {{ $t("Validate") }}
33
- </button>
34
- </div>
35
- <textarea
2
+ <div class="d-flex flex-column comment-input-container mt-3">
3
+ <CommentName v-if="commentUser?.name" />
4
+ <ClassicContentEditable
36
5
  ref="textarea"
37
6
  v-model="newComment"
7
+ class="comment-input"
38
8
  :placeholder="placeholder"
39
- max-rows="10"
40
- :class="{ short: isOneLine && !newComment.includes('\n') }"
41
- @focus="textareaFocus = true"
42
- @blur="textareaFocus = false"
9
+ @focus="isTextareaActive = true"
43
10
  />
44
- <template v-if="textareaFocus">
45
- <p
46
- class="d-flex justify-content-end h6"
47
- :class="{ 'text-danger': !validComment }"
48
- >
49
- {{ countComment + " / " + maxComment }}
50
- </p>
51
- <div class="d-flex justify-content-end mt-1">
11
+ <div v-if="isTextareaActive" class="d-flex justify-content-between mt-1">
12
+ <ClassicEmojiPicker
13
+ popover-relative-class="page-element"
14
+ @emoji-selected="addEmojiSelected"
15
+ />
16
+ <div class="d-flex ms-auto">
17
+ <p
18
+ class="d-flex justify-content-end h6 me-3"
19
+ :class="{ 'text-danger': !commentTooLong }"
20
+ >
21
+ {{ countComment + " / " + maxComment }}
22
+ </p>
52
23
  <button class="btn me-2" @mousedown="cancelAction">
53
24
  {{ $t("Cancel") }}
54
25
  </button>
55
26
  <button
56
27
  class="btn btn-primary"
57
- :disabled="0 === countComment || !validComment"
28
+ :disabled="0 === countComment || !commentTooLong"
58
29
  @mousedown="requestToSend"
59
30
  >
60
31
  {{ placeholder }}
61
32
  </button>
62
33
  </div>
63
- </template>
64
- <AddCommentModal
65
- v-if="checkIdentityModal"
34
+ </div>
35
+ <CheckIdentityModal
36
+ v-if="isCheckIdentity"
66
37
  @validate="postComment"
67
- @close="checkIdentityModal = false"
38
+ @close="isCheckIdentity = false"
68
39
  />
69
40
  <MessageModal
70
41
  v-if="postError"
@@ -78,52 +49,58 @@
78
49
  </template>
79
50
 
80
51
  <script lang="ts">
81
- import octopusApi from "@saooti/octopus-api";
82
52
  import crudApi from "@/api/classicCrud";
53
+ import octopusApi from "@saooti/octopus-api";
83
54
  import cookies from "../../mixins/cookies";
84
55
  import { state } from "../../../stores/ParamSdkStore";
85
56
  import { Podcast } from "@/stores/class/general/podcast";
86
- import { Conference } from "@/stores/class/conference/conference";
87
- import { CommentPodcast } from "@/stores/class/general/comment";
57
+ import { CommentCreate, CommentPodcast } from "@/stores/class/general/comment";
88
58
  import Constants from "../../../../public/config";
89
- import { usePlayerStore } from "@/stores/PlayerStore";
90
- import { useAuthStore } from "@/stores/AuthStore";
91
59
  import { mapState } from "pinia";
92
60
  import { defineComponent, defineAsyncComponent } from "vue";
93
- const AddCommentModal = defineAsyncComponent(
94
- () => import("./AddCommentModal.vue"),
61
+ import { useCommentStore } from "@/stores/CommentStore";
62
+ import { usePlayerStore } from "@/stores/PlayerStore";
63
+ const CheckIdentityModal = defineAsyncComponent(
64
+ () => import("./modal/CheckIdentityModal.vue"),
95
65
  );
66
+ const CommentName = defineAsyncComponent(() => import("./CommentName.vue"));
96
67
  const MessageModal = defineAsyncComponent(
97
68
  () => import("../../misc/modal/MessageModal.vue"),
98
69
  );
70
+ const ClassicEmojiPicker = defineAsyncComponent(
71
+ () => import("../../form/ClassicEmojiPicker.vue"),
72
+ );
73
+ const ClassicContentEditable = defineAsyncComponent(
74
+ () => import("../../form/ClassicContentEditable.vue"),
75
+ );
99
76
  export default defineComponent({
100
77
  name: "CommentInput",
101
78
  components: {
102
- AddCommentModal,
79
+ CheckIdentityModal,
103
80
  MessageModal,
81
+ ClassicEmojiPicker,
82
+ ClassicContentEditable,
83
+ CommentName,
104
84
  },
105
85
  mixins: [cookies],
106
86
 
107
87
  props: {
108
88
  podcast: { default: undefined, type: Object as () => Podcast },
109
- knownIdentity: { default: undefined, type: String },
110
89
  focus: { default: false, type: Boolean },
111
- comment: { default: undefined, type: Object as () => CommentPodcast },
112
- fetchConference: { default: undefined, type: Object as () => Conference },
90
+ inAnswerComment: {
91
+ default: undefined,
92
+ type: Object as () => CommentPodcast,
93
+ },
113
94
  },
114
- emits: ["update:knownIdentity", "cancelAction", "newComment"],
95
+ emits: ["cancelAction", "newComment"],
115
96
 
116
97
  data() {
117
98
  return {
118
99
  newComment: "" as string,
119
- textareaFocus: false as boolean,
120
- checkIdentityModal: false as boolean,
121
- postError: false as boolean,
122
- isOneLine: true as boolean,
123
- editName: false as boolean,
124
- temporaryName: "" as string,
125
100
  maxComment: Constants.MAX_COMMENT as number,
126
- maxName: Constants.MAX_COMMENT_NAME as number,
101
+ isTextareaActive: false as boolean,
102
+ isCheckIdentity: false as boolean,
103
+ postError: false as boolean,
127
104
  };
128
105
  },
129
106
 
@@ -134,117 +111,76 @@ export default defineComponent({
134
111
  "playerElapsed",
135
112
  "playerTotal",
136
113
  ]),
137
- ...mapState(useAuthStore, ["authProfile"]),
138
- validName(): boolean {
139
- return this.countName <= this.maxName;
140
- },
141
- countName(): number {
142
- return this.temporaryName.length;
143
- },
144
- validComment(): boolean {
114
+ ...mapState(useCommentStore, ["commentUser"]),
115
+ commentTooLong(): boolean {
145
116
  return this.countComment <= this.maxComment;
146
117
  },
147
118
  countComment(): number {
148
119
  return this.newComment.length;
149
120
  },
150
- isPresent(): boolean {
151
- if (!this.podcast) return true;
152
- let podcastComment = this.podcast.annotations?.COMMENTS ?? "INHERIT";
153
- let organisationComment =
154
- this.podcast.organisation.comments ?? "LIVE_ONLY";
155
- return !(
156
- ("LIVE_ONLY" === podcastComment &&
157
- "READY_TO_RECORD" !== this.podcast.processingStatus) ||
158
- ("INHERIT" === podcastComment &&
159
- "LIVE_ONLY" === organisationComment &&
160
- "READY_TO_RECORD" !== this.podcast.processingStatus)
161
- );
121
+ authenticated(): boolean {
122
+ return state.generalParameters.authenticated as boolean;
162
123
  },
163
124
  placeholder(): string {
164
- return this.comment?.comId
125
+ return this.inAnswerComment?.commentId
165
126
  ? this.$t("Answer a comment")
166
127
  : this.$t("Write a comment");
167
128
  },
168
- isCertified(): boolean {
169
- return (
170
- (true === state.generalParameters.isCommments &&
171
- state.generalParameters.organisationId === this.podcastOrga) ||
172
- true === state.generalParameters.isAdmin
173
- );
174
- },
175
- phase(): string | undefined {
176
- if (undefined === this.podcast) {
177
- return this.comment ? this.comment.phase : undefined;
178
- }
179
- if (
180
- !this.podcast.conferenceId ||
181
- 0 === this.podcast.conferenceId ||
182
- "READY_TO_RECORD" !== this.podcast.processingStatus
183
- )
184
- return "Podcast";
185
- if (
186
- this.fetchConference &&
187
- ("PLANNED" === this.fetchConference.status ||
188
- "PENDING" === this.fetchConference.status)
189
- )
190
- return "Prelive";
191
- return "Live";
192
- },
193
- podcastOrga(): string | undefined {
194
- const commentOrga = this.comment?.organisationId ?? "";
195
- return this.podcast?.organisation.id ?? commentOrga;
196
- },
197
129
  },
198
130
  watch: {
199
- textareaFocus(): void {
200
- this.newComment = this.newComment.trim();
201
- },
202
131
  focus(): void {
203
132
  (this.$refs.textarea as HTMLElement).focus();
204
133
  },
205
- newComment(): void {
206
- const padding =
207
- 1.5 * parseFloat(getComputedStyle(document.documentElement).fontSize);
208
- this.isOneLine =
209
- (this.$refs.textarea as HTMLElement).clientWidth -
210
- this.inputExceeded(
211
- this.newComment,
212
- "18px Montserrat, sans-serif, Helvetica Neue",
213
- ) >
214
- padding;
215
- },
216
134
  },
217
135
  methods: {
218
- changeIdentity(): void {
219
- if (!this.knownIdentity) {
220
- return;
221
- }
222
- this.temporaryName = this.knownIdentity;
223
- this.editName = true;
224
- },
225
- validEdit(): void {
226
- this.setCookie("comment-octopus-name", this.temporaryName);
227
- this.$emit("update:knownIdentity", this.temporaryName);
228
- this.editName = false;
229
- },
230
- inputExceeded(text: string, font: string): number {
231
- const context = document.createElement("canvas").getContext("2d");
232
- if (null === context) {
233
- return 0;
234
- }
235
- context.font = font;
236
- return context.measureText(text).width;
136
+ addEmojiSelected(emoji: string) {
137
+ this.newComment += emoji;
237
138
  },
238
139
  requestToSend(): void {
239
- if (this.knownIdentity) {
140
+ if (this.commentUser?.name) {
240
141
  this.postComment();
241
142
  } else {
242
- this.checkIdentityModal = true;
143
+ this.isCheckIdentity = true;
243
144
  }
244
145
  },
245
146
  cancelAction(): void {
147
+ this.newComment = "";
148
+ this.isTextareaActive = false;
246
149
  this.$emit("cancelAction");
247
150
  },
151
+ async postComment(): Promise<void> {
152
+ const comment: CommentCreate = {
153
+ answerTo: this.inAnswerComment?.commentId,
154
+ content: this.newComment.trim(),
155
+ name: this.commentUser?.name ?? "",
156
+ podcastId:
157
+ this.podcast?.podcastId ?? this.inAnswerComment?.podcastId ?? 0,
158
+ uuid: this.commentUser?.uuid ?? "",
159
+ timeline: this.defineTimelineValue(),
160
+ };
161
+ try {
162
+ var commentReceived;
163
+ if (!this.authenticated) {
164
+ commentReceived = await octopusApi.postDataPublic<CommentPodcast>(
165
+ 2,
166
+ "comment/",
167
+ comment,
168
+ );
169
+ } else {
170
+ commentReceived = await crudApi.postData<CommentPodcast>(
171
+ 2,
172
+ "comment/",
173
+ comment,
174
+ );
175
+ }
176
+ this.$emit("newComment", commentReceived);
177
+ this.newComment = "";
178
+ this.isTextareaActive = false;
179
+ } catch (error) {
180
+ this.postError = true;
181
+ }
182
+ this.isCheckIdentity = false;
183
+ },
248
184
  defineTimelineValue(): number {
249
185
  let timeline = 0;
250
186
  if (
@@ -261,75 +197,23 @@ export default defineComponent({
261
197
  }
262
198
  return timeline < 0 ? 0 : timeline;
263
199
  },
264
- async postComment(name?: string): Promise<void> {
265
- if (name) {
266
- this.setCookie("comment-octopus-name", name);
267
- this.$emit("update:knownIdentity", name);
268
- }
269
- const sendName = name ?? this.knownIdentity;
270
- const commentPodcastId = this.comment?.podcastId ?? 0;
271
- const comment: CommentPodcast = {
272
- content: this.newComment,
273
- name: sendName ?? "",
274
- podcastId: this.podcast?.podcastId ?? commentPodcastId,
275
- timeline: this.defineTimelineValue(),
276
- organisationId: this.podcastOrga,
277
- commentIdReferer: this.comment?.comId,
278
- certified: this.isCertified,
279
- userId: this.authProfile?.userId,
280
- phase: this.phase,
281
- };
282
- try {
283
- let data;
284
- if (this.isCertified) {
285
- comment.status = "Valid";
286
- data = await crudApi.postData<CommentPodcast>(
287
- 2,
288
- "registeredComment/" + comment.userId,
289
- { ...comment, ...{ userId: undefined } },
290
- );
291
- } else {
292
- data = await octopusApi.postDataPublic<CommentPodcast>(
293
- 2,
294
- "unregisteredComment",
295
- comment,
296
- );
297
- }
298
- this.$emit("newComment", data);
299
- this.newComment = "";
300
- } catch (error) {
301
- this.postError = true;
302
- }
303
- this.checkIdentityModal = false;
304
- },
305
200
  },
306
201
  });
307
202
  </script>
308
203
 
309
204
  <style lang="scss">
310
205
  @import "@scss/_variables.scss";
311
- .octopus-app {
312
- .comment-input-container {
313
- textarea::placeholder {
314
- color: $octopus-primary-color;
315
- }
316
- textarea:focus::placeholder {
317
- color: black;
318
- }
319
- textarea {
320
- border-top: 0;
321
- border-right: 0;
322
- border-left: 0;
323
- border-bottom: 0.1rem solid #ddd !important;
324
- overflow: hidden !important;
325
- box-shadow: unset !important;
326
- background: transparent !important;
327
- height: 50px;
328
- resize: none;
329
- &.short {
330
- max-height: 38px;
331
- }
332
- }
206
+ .octopus-app .comment-input-container {
207
+ .comment-input {
208
+ border-top: 0;
209
+ border-right: 0;
210
+ border-left: 0;
211
+ border-bottom: 0.1rem solid #ddd !important;
212
+ overflow: hidden !important;
213
+ box-shadow: unset !important;
214
+ background: transparent !important;
215
+ min-height: 36px;
216
+ resize: none;
333
217
  }
334
218
  }
335
219
  </style>