Improve comment tree
Closes #862 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
b1a9c28a97
commit
4a8284fa6d
@ -45,8 +45,8 @@
|
|||||||
type="is-primary"
|
type="is-primary"
|
||||||
class="comment-button-submit"
|
class="comment-button-submit"
|
||||||
icon-left="send"
|
icon-left="send"
|
||||||
:aria-label="$t('Post a comment')"
|
>{{ $t("Send") }}</b-button
|
||||||
/>
|
>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</form>
|
</form>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
<transition-group
|
<transition-group
|
||||||
key="list"
|
key="list"
|
||||||
name="comment-list"
|
name="comment-list"
|
||||||
v-if="comments.length"
|
v-if="filteredOrderedComments.length"
|
||||||
class="comment-list"
|
class="comment-list"
|
||||||
tag="ul"
|
tag="ul"
|
||||||
>
|
>
|
||||||
@ -77,9 +77,9 @@
|
|||||||
@delete-comment="deleteComment"
|
@delete-comment="deleteComment"
|
||||||
/>
|
/>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
<div v-else class="no-comments" key="no-comments">
|
<empty-content v-else icon="comment" key="no-comments" :inline="true">
|
||||||
<span>{{ $t("No comments yet") }}</span>
|
<span>{{ $t("No comments yet") }}</span>
|
||||||
</div>
|
</empty-content>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -99,6 +99,7 @@ import { CURRENT_ACTOR_CLIENT } from "../../graphql/actor";
|
|||||||
import { IPerson } from "../../types/actor";
|
import { IPerson } from "../../types/actor";
|
||||||
import { IEvent } from "../../types/event.model";
|
import { IEvent } from "../../types/event.model";
|
||||||
import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
|
import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
|
||||||
|
import EmptyContent from "@/components/Utils/EmptyContent.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
apollo: {
|
apollo: {
|
||||||
@ -119,6 +120,7 @@ import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
|
|||||||
components: {
|
components: {
|
||||||
Comment,
|
Comment,
|
||||||
IdentityPickerWrapper,
|
IdentityPickerWrapper,
|
||||||
|
EmptyContent,
|
||||||
editor: () =>
|
editor: () =>
|
||||||
import(/* webpackChunkName: "editor" */ "@/components/Editor.vue"),
|
import(/* webpackChunkName: "editor" */ "@/components/Editor.vue"),
|
||||||
},
|
},
|
||||||
@ -364,13 +366,25 @@ export default class CommentTree extends Vue {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@use "@/styles/_mixins" as *;
|
@use "@/styles/_mixins" as *;
|
||||||
|
@import "~bulma/sass/utilities/mixins.sass";
|
||||||
form.new-comment {
|
form.new-comment {
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
|
|
||||||
|
.media {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
.media-left {
|
||||||
|
@include mobile {
|
||||||
|
@include margin-right(0.5rem);
|
||||||
|
@include margin-left(0.5rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.media-content {
|
.media-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
width: min-content;
|
||||||
|
|
||||||
.field {
|
.field {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -382,6 +396,7 @@ form.new-comment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-comments {
|
.no-comments {
|
||||||
|
@ -162,7 +162,9 @@ describe("CommentTree", () => {
|
|||||||
requestHandlers.eventCommentThreadsQueryHandler
|
requestHandlers.eventCommentThreadsQueryHandler
|
||||||
).toHaveBeenCalledWith({ eventUUID: eventData.uuid });
|
).toHaveBeenCalledWith({ eventUUID: eventData.uuid });
|
||||||
|
|
||||||
expect(wrapper.find(".no-comments").text()).toBe("No comments yet");
|
expect(wrapper.findComponent({ name: "EmptyContent" }).text()).toBe(
|
||||||
|
"No comments yet"
|
||||||
|
);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,7 @@ exports[`CommentTree renders a comment tree with comments 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="send-comment">
|
<div class="send-comment">
|
||||||
<b-button-stub type="is-primary" iconleft="send" nativetype="submit" tag="button" aria-label="Post a comment" class="comment-button-submit"></b-button-stub>
|
<b-button-stub type="is-primary" iconleft="send" nativetype="submit" tag="button" class="comment-button-submit">Send</b-button-stub>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</form>
|
</form>
|
||||||
@ -62,12 +62,12 @@ exports[`CommentTree renders an empty comment tree 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="send-comment">
|
<div class="send-comment">
|
||||||
<b-button-stub type="is-primary" iconleft="send" nativetype="submit" tag="button" aria-label="Post a comment" class="comment-button-submit"></b-button-stub>
|
<b-button-stub type="is-primary" iconleft="send" nativetype="submit" tag="button" class="comment-button-submit">Send</b-button-stub>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</form>
|
</form>
|
||||||
<transition-group-stub tag="div" name="comment-empty-list">
|
<transition-group-stub tag="div" name="comment-empty-list">
|
||||||
<div class="no-comments"><span>No comments yet</span></div>
|
<empty-content-stub icon="comment" inline="true"><span>No comments yet</span></empty-content-stub>
|
||||||
</transition-group-stub>
|
</transition-group-stub>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user