From 460c30bd366db2db332144245c127ad8c37c973e Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 15 Nov 2020 17:17:08 +0100 Subject: [PATCH] Improve comment avatars on mobile --- src/components/input/editor.vue | 53 +++++++++++++++++++++- src/components/tasks/partials/comments.vue | 38 +++++++++++----- src/styles/components/comments.scss | 47 +++++++++++-------- src/styles/theme/variables.scss | 1 + 4 files changed, 107 insertions(+), 32 deletions(-) diff --git a/src/components/input/editor.vue b/src/components/input/editor.vue index bb78ea9b..c7bd95ad 100644 --- a/src/components/input/editor.vue +++ b/src/components/input/editor.vue @@ -1,6 +1,6 @@ @@ -67,6 +81,13 @@ export default { isEditEnabled: { default: true, }, + hasEditBottom: { + type: Boolean, + default: false, + }, + bottomActions: { + default: () => [], + }, }, data() { return { @@ -435,4 +456,34 @@ pre.CodeMirror-line { font-family: $vikunja-font; font-weight: 400; } + +ul.actions { + font-size: .8em; + margin: 0; + + li { + display: inline-block; + + &:after { + content: '·'; + padding: 0 .25rem; + } + + &:last-child:after { + content: ''; + } + } + + &, a { + color: $grey; + } + + a:hover { + text-decoration: underline; + } +} + +.vue-easymde.content { + margin-bottom: 0 !important; +} diff --git a/src/components/tasks/partials/comments.vue b/src/components/tasks/partials/comments.vue index f25e3060..f5445df0 100644 --- a/src/components/tasks/partials/comments.vue +++ b/src/components/tasks/partials/comments.vue @@ -7,19 +7,21 @@ Comments
- Loading - comments... + + Loading comments...
-
+
-
+
+ {{ c.author.username }}  - {{ formatDateSince(c.created) }} - · - edited {{ formatDateSince(c.updated) }} + {{ formatDateSince(c.created) }} + + · edited {{ formatDateSince(c.updated) }} +
-
- Remove -
-
+
@@ -114,6 +115,7 @@ export default { taskCommentService: TaskCommentService, newComment: TaskCommentModel, editorActive: true, + actions: {}, } }, created() { @@ -130,6 +132,9 @@ export default { taskId() { this.loadComments() }, + canWrite() { + this.makeActions() + }, }, computed: { userAvatar() { @@ -141,6 +146,7 @@ export default { this.taskCommentService.getAll({taskId: this.taskId}) .then(r => { this.$set(this, 'comments', r) + this.makeActions() }) .catch(e => { this.error(e, this) @@ -212,6 +218,16 @@ export default { this.showDeleteModal = false }) }, + makeActions() { + if (this.canWrite) { + this.comments.forEach(c => { + this.$set(this.actions, c.id, [{ + action: () => this.toggleDelete(c.id), + title: 'Remove', + }]) + }) + } + } }, } diff --git a/src/styles/components/comments.scss b/src/styles/components/comments.scss index 761ff9af..8cfb1c4b 100644 --- a/src/styles/components/comments.scss +++ b/src/styles/components/comments.scss @@ -5,29 +5,36 @@ margin: 0 1em; } - @media screen and (min-width: $tablet) { - .comment-info.is-pulled-up { - margin-bottom: -3rem; + .comment-info { + display: flex; + align-items: center; + + * { + padding-right: .5rem; + } + + img { + display: none; + } + + @media screen and (max-width: $tablet) { + img { + display: block; + width: 20px; + height: 20px; + padding-right: 0; + margin-right: .5rem; + } + } + + span { + font-size: .75rem; + line-height: 1; } } - .editor .tabs { - margin-bottom: 0; - - ul { - border-bottom: none; - } + .editor { + margin-top: .5rem; } - .comment-actions { - font-size: .8em; - - &, a { - color: $grey; - } - - a:hover { - text-decoration: underline; - } - } } \ No newline at end of file diff --git a/src/styles/theme/variables.scss b/src/styles/theme/variables.scss index 11133a6a..b9dcf591 100644 --- a/src/styles/theme/variables.scss +++ b/src/styles/theme/variables.scss @@ -5,6 +5,7 @@ $red: #ff4136; $blue: #1973ff; $primary: $blue; $dark: lighten($black, 8); +$grey: hsl(0, 0%, 48%); $info-invert: #fff; $family-sans-serif: 'Open Sans', Helvetica, Arial, sans-serif;