Ordered comments like alpha, move HcCommentForm, mobile responsive

- in the first instance, we will be importing posts/comments from the alpha, so to maintain consistency, we've ordered them alike. In the future, we could support user choice of order.
- Gives more space for HcCommentForm, user can see comments added to list, helps with mobile responsiveness

Co-authored-by: Tirokk <wolle.huss@pjannto.com>
Co-authored-by: Mike Aono <aonomike@gmail.com>
This commit is contained in:
Matt Rider 2019-04-26 08:57:29 -03:00
parent 05ad8ccc30
commit 5891129662
6 changed files with 58 additions and 63 deletions

View File

@ -10,7 +10,7 @@ export default {
const session = context.driver.session()
const transactionRes = await session.run(`
MATCH (comment:Comment)-[:COMMENTS]->(post:Post {id: $postId})
RETURN comment {.id, .contentExcerpt, .createdAt}`, {
RETURN comment {.id, .contentExcerpt, .createdAt} ORDER BY comment.createdAt ASC`, {
postId
})

View File

@ -1,45 +1,43 @@
<template>
<ds-flex-item width="80%">
<ds-form
v-model="form"
@submit="handleSubmit"
>
<template slot-scope="{ errors }">
<ds-card>
<no-ssr>
<hc-editor
ref="editor"
:users="users"
:value="form.content"
@input="updateEditorContent"
/>
</no-ssr>
<ds-space />
<ds-flex>
<ds-flex-item width="50%" />
<ds-flex-item width="20%">
<ds-button
:disabled="disabled"
ghost
@click.prevent="clear"
>
{{ $t('actions.cancel') }}
</ds-button>
</ds-flex-item>
<ds-flex-item width="20%">
<ds-button
type="submit"
:disabled="disabled || errors"
primary
>
{{ $t('post.comment.submit') }}
</ds-button>
</ds-flex-item>
</ds-flex>
</ds-card>
</template>
</ds-form>
</ds-flex-item>
<ds-form
v-model="form"
@submit="handleSubmit"
>
<template slot-scope="{ errors }">
<ds-card>
<no-ssr>
<hc-editor
ref="editor"
:users="users"
:value="form.content"
@input="updateEditorContent"
/>
</no-ssr>
<ds-space />
<ds-flex :gutter="{ base: 'small', md: 'small', sm: 'x-large', xs: 'x-large' }" >
<ds-flex-item :width="{ base: '0%', md: '50%', sm: '0%', xs: '0%' }" />
<ds-flex-item :width="{ base: '40%', md: '20%', sm: '30%', xs: '30%' }" >
<ds-button
:disabled="disabled"
ghost
@click.prevent="clear"
>
{{ $t('actions.cancel') }}
</ds-button>
</ds-flex-item>
<ds-flex-item :width="{ base: '40%', md: '20%', sm: '40%', xs: '40%' }" >
<ds-button
type="submit"
:disabled="disabled || errors"
primary
>
{{ $t('post.comment.submit') }}
</ds-button>
</ds-flex-item>
</ds-flex>
</ds-card>
</template>
</ds-form>
</template>
<script>

View File

@ -2,8 +2,8 @@ import gql from 'graphql-tag'
export default app => {
return gql(`
query CommentByPost($postId: ID!) {
CommentByPost(postId: $postId, orderBy: createdAt_desc) {
query CommentByPost($postId: ID!) {
CommentByPost(postId: $postId) {
id
contentExcerpt
createdAt

View File

@ -116,7 +116,7 @@
"name": "Aktiv werden"
},
"comment": {
"submit": "Kommentar Senden",
"submit": "Kommentiere",
"submitted": "Kommentar Gesendet"
}
},

View File

@ -116,7 +116,7 @@
"name": "Take action"
},
"comment": {
"submit": "Submit Comment",
"submit": "Comment",
"submitted": "Comment Submitted"
}
},

View File

@ -96,23 +96,18 @@
<ds-space margin="small" />
<!-- Comments -->
<ds-section slot="footer">
<ds-flex>
<ds-flex-item width="20%">
<h3 style="margin-top: 0;">
<span>
<ds-icon name="comments" />
<ds-tag
v-if="comments"
style="margin-top: -4px; margin-left: -12px; position: absolute;"
color="primary"
size="small"
round
>{{ comments.length }}</ds-tag>&nbsp; Comments
</span>
</h3>
</ds-flex-item>
<hc-comment-form :post="post" @addComment="addComment" />
</ds-flex>
<h3 style="margin-top: -10px;">
<span>
<ds-icon name="comments" />
<ds-tag
v-if="comments"
style="margin-top: -4px; margin-left: -12px; position: absolute;"
color="primary"
size="small"
round
>{{ comments.length }}</ds-tag>&nbsp; Comments
</span>
</h3>
<ds-space margin-bottom="large" />
<div
v-if="comments && comments.length"
@ -129,6 +124,8 @@
v-else
icon="messages"
/>
<ds-space margin-bottom="large" />
<hc-comment-form :post="post" @addComment="addComment" />
</ds-section>
</ds-card>
</transition>