Skip to content

Commit

Permalink
Merge pull request #1198 from NicoPennec/fix/comments
Browse files Browse the repository at this point in the history
Improve comments
  • Loading branch information
frankrousseau authored Sep 25, 2023
2 parents 2100b82 + 62310ea commit 042a0b7
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/components/cells/MetadataHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@click="$emit('show-metadata-header-menu', $event)"
v-if="!noMenu"
>
<chevron-down-icon :size="'12'" />
<chevron-down-icon size="12" />
</span>
</div>
</th>
Expand Down
1 change: 0 additions & 1 deletion src/components/mixins/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,6 @@ export const playerMixin = {

watch: {
isCommentsHidden() {
if (!this.isCommentsHidden) this.$refs['task-info'].loadTaskData()
if (this.isCurrentPreviewSound) {
this.soundPlayer.redraw()
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/pages/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,14 @@
</div>
<task-info
ref="task-info"
:class="{
'flexrow-item': true,
'task-info-column': true,
hidden: isCommentsHidden
}"
class="flexrow-item task-info-column"
:task="task"
:is-preview="false"
:silent="isCommentsHidden"
:current-time-raw="currentTimeRaw - frameDuration"
:current-parent-preview="currentPreview"
@time-code-clicked="onTimeCodeClicked"
v-show="!isCommentsHidden"
/>
</div>

Expand Down Expand Up @@ -421,6 +418,7 @@
<div class="separator"></div>
<button-simple
class="button player-button flexrow-item"
:active="!isCommentsHidden"
:title="$t('playlists.actions.comments')"
@click="onCommentClicked"
icon="comment"
Expand Down
12 changes: 5 additions & 7 deletions src/components/pages/playlists/PlaylistPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,14 @@

<task-info
ref="task-info"
:class="{
'flexrow-item': true,
'task-info-column': true,
hidden: isCommentsHidden
}"
class="flexrow-item task-info-column"
:task="task"
:is-preview="false"
:silent="isCommentsHidden"
:current-time-raw="currentTimeRaw"
:current-parent-preview="currentPreview"
panel-name="playlist-side-panel"
@time-code-clicked="onTimeCodeClicked"
v-show="!isCommentsHidden"
/>
</div>

Expand Down Expand Up @@ -670,13 +666,15 @@
<div class="separator"></div>
<button-simple
class="button playlist-button flexrow-item"
:active="!isCommentsHidden"
:title="$t('playlists.actions.comments')"
@click="onCommentClicked"
icon="comment"
/>
<button-simple
class="playlist-button flexrow-item"
:title="$t('playlists.actions.entity_list')"
:active="!isEntitiesHidden"
@click="onFilmClicked"
icon="film"
/>
Expand Down Expand Up @@ -1425,7 +1423,7 @@ export default {
if (this.$refs['video-container']) {
this.$refs['video-container'].style.height = `${height}px`
}
if (!this.isCommentsHidden) {
if (this.$refs['task-info'] && !this.isCommentsHidden) {
this.$refs['task-info'].$el.style.height = `${height}px`
}
if (this.$refs['picture-preview-wrapper']) {
Expand Down
12 changes: 4 additions & 8 deletions src/components/previews/PreviewPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,16 @@
</div>

<task-info
name="task-info"
ref="task-info-player"
:class="{
'flexrow-item': true,
'task-info-column': true,
hidden: isCommentsHidden
}"
class="flexrow-item task-info-column"
:task="task"
:is-preview="false"
:silent="isCommentsHidden"
:current-time-raw="currentTimeRaw"
:current-parent-preview="currentPreview"
@comment-added="$emit('comment-added')"
@time-code-clicked="timeCodeClicked"
v-show="!isCommentsHidden"
/>
</div>
</div>
Expand Down Expand Up @@ -348,6 +345,7 @@
<button-simple
class="button playlist-button flexrow-item"
icon="comment"
:active="!isCommentsHidden"
:title="$t('playlists.actions.comments')"
@click="onCommentClicked"
v-if="!readOnly && fullScreen"
Expand Down Expand Up @@ -1590,8 +1588,6 @@ export default {
this.$nextTick(() => {
if (!this.isCommentsHidden) {
this.$refs['task-info-player'].$el.style.height = `${height}px`
}
if (this.$refs['task-info-player']) {
this.$refs['task-info-player'].focusCommentTextarea()
}
this.previewViewer.resetVideo()
Expand Down
17 changes: 10 additions & 7 deletions src/components/sides/TaskInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@ export default {
type: Boolean,
default: false
},
panelName: {
type: String,
default: 'todefine'
},
withActions: {
type: Boolean,
default: false
Expand Down Expand Up @@ -408,7 +404,6 @@ export default {
},
mounted() {
this.loadTaskData()
if (this.$refs['add-comment']) {
const draft = drafts.getTaskDraft(this.task.id)
if (draft) {
Expand Down Expand Up @@ -804,7 +799,7 @@ export default {
},
focusCommentTextarea() {
if (this.$refs['add-comment']) this.$refs['add-comment'].focus()
this.$refs['add-comment']?.focus()
},
getOriginalPath() {
Expand Down Expand Up @@ -1278,6 +1273,14 @@ export default {
if (!this.silent) {
this.loadTaskData()
}
},
silent: {
immediate: true,
handler() {
if (!this.silent) {
this.loadTaskData()
}
}
}
},
Expand Down Expand Up @@ -1568,7 +1571,7 @@ export default {
.side {
flex: 1;
overflow: scroll;
overflow: auto;
}
.extend-bar {
Expand Down
1 change: 1 addition & 0 deletions src/components/widgets/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ article.comment {
.date {
font-size: 0.8em;
margin-right: 0.5em;
white-space: nowrap;
}
.preview-info {
Expand Down
12 changes: 3 additions & 9 deletions src/store/api/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export default {
return client.pput(`/api/data/tasks/${taskId}`, data, callback)
},

getTaskStatuses(callback) {
client.get('/api/data/task-status', callback)
},

getTaskSubscribed(taskId, callback) {
return client.pget(`/api/data/user/tasks/${taskId}/subscribed`)
},
Expand All @@ -39,12 +35,10 @@ export default {
comment: data.comment,
checklist: data.checklist || []
}
if (data.attachment && data.attachment.length > 0) {
if (data.attachment?.length) {
commentData = new FormData()
let i = 0
data.attachment.forEach(attachment => {
commentData.append('file-' + i, attachment.get('file'))
i++
data.attachment.forEach((attachment, index) => {
commentData.append(`file-${index}`, attachment.get('file'))
})
commentData.set('task_status_id', data.taskStatusId)
commentData.set('comment', data.comment)
Expand Down

0 comments on commit 042a0b7

Please sign in to comment.