@kiva/kv-components 3.65.2 → 3.66.0
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.
- package/CHANGELOG.md +11 -0
- package/package.json +2 -2
- package/tests/fixtures/mockFeedActivityData.js +3 -1
- package/tests/unit/specs/components/KvCommentsListItem.spec.js +11 -0
- package/tests/unit/specs/components/KvCommentsReplyButton.spec.js +0 -8
- package/vue/KvCommentsListItem.vue +36 -14
- package/vue/KvCommentsReplyButton.vue +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.66.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.65.2...@kiva/kv-components@3.66.0) (2024-03-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* collapsable replies list added to commenting component ([#373](https://github.com/kiva/kv-ui-elements/issues/373)) ([612a880](https://github.com/kiva/kv-ui-elements/commit/612a8806ffd74411a774f6bdf5efb30e877abaa1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.65.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.65.1...@kiva/kv-components@3.65.2) (2024-03-19)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.66.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"optional": true
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "89fc529c0f6af234c6996d5556aab15e369093d5"
|
|
79
79
|
}
|
|
@@ -46,6 +46,17 @@ describe('KvCommentsListItem', () => {
|
|
|
46
46
|
getByText(comment.data.text);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
it('should render child comment text if replies list opened', async () => {
|
|
50
|
+
const { getAllByText, getAllByRole } = renderComment({ comment });
|
|
51
|
+
const openRepliesButton = getAllByRole('button', { name: '1 reply' })[0];
|
|
52
|
+
|
|
53
|
+
await userEvent.click(openRepliesButton);
|
|
54
|
+
|
|
55
|
+
const childComment = getAllByText(comment.latest_children.comment[0].data.text)[0];
|
|
56
|
+
|
|
57
|
+
expect(childComment).toBeDefined();
|
|
58
|
+
});
|
|
59
|
+
|
|
49
60
|
it('should not handle like button click for guest user', async () => {
|
|
50
61
|
const { getAllByRole, emitted, getByTestId } = renderComment({ comment });
|
|
51
62
|
const likeButton = getAllByRole('button', { name: 'Like' })[0];
|
|
@@ -12,14 +12,6 @@ describe('KvCommentsReplyButton', () => {
|
|
|
12
12
|
expect(replyButton).toBeDefined();
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
it('should render number of replies', () => {
|
|
16
|
-
const { getByTestId } = render(KvCommentsReplyButton, { props: { numberOfReplies: 6 } });
|
|
17
|
-
const replyCount = getByTestId('reply-count');
|
|
18
|
-
|
|
19
|
-
expect(replyCount).toBeDefined();
|
|
20
|
-
expect(replyCount).toHaveTextContent(6);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
15
|
it('should emit click event when clicked', async () => {
|
|
24
16
|
const { getByRole, emitted } = render(KvCommentsReplyButton);
|
|
25
17
|
const replyButton = getByRole('button', { name: 'Reply' });
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
<div
|
|
22
22
|
v-if="nestLevel < 3"
|
|
23
|
-
class="tw-flex tw-items-center tw-gap-x-
|
|
23
|
+
class="tw-flex tw-items-center tw-gap-x-1"
|
|
24
24
|
>
|
|
25
25
|
<div class="tw-flex tw-items-center tw-gap-0.5">
|
|
26
26
|
<kv-comments-heart-button
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
</div>
|
|
40
40
|
<kv-comments-reply-button
|
|
41
41
|
v-if="userPublicId"
|
|
42
|
-
:number-of-replies="numberOfReplies"
|
|
43
42
|
@click="replyClick"
|
|
44
43
|
/>
|
|
45
44
|
</div>
|
|
@@ -61,25 +60,40 @@
|
|
|
61
60
|
v-if="childComments"
|
|
62
61
|
class="tw-my-1"
|
|
63
62
|
>
|
|
64
|
-
<
|
|
65
|
-
v-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
<button
|
|
64
|
+
v-if="numberOfReplies"
|
|
65
|
+
class="tw-ml-3 tw-text-action tw-font-medium tw-mb-1 tw-flex tw-items-center"
|
|
66
|
+
@click="toggleReplies"
|
|
68
67
|
>
|
|
69
|
-
<kv-
|
|
70
|
-
|
|
71
|
-
:
|
|
72
|
-
:
|
|
73
|
-
:comment="nested_comment"
|
|
74
|
-
:nest-level="nestLevel + 1"
|
|
75
|
-
@add-reaction="$emit(ADD_REACTION_EVENT, $event);"
|
|
68
|
+
<kv-material-icon
|
|
69
|
+
class="tw-h-2.5 tw-w-2.5 tw-transition tw-transform tw-duration-500 tw-ease"
|
|
70
|
+
:class="{ 'tw-rotate-180' : repliesOpened }"
|
|
71
|
+
:icon="mdiChevronDown"
|
|
76
72
|
/>
|
|
77
|
-
|
|
73
|
+
{{ numberOfReplies }} {{ numberOfReplies > 1 ? 'replies' : 'reply' }}
|
|
74
|
+
</button>
|
|
75
|
+
<div v-if="repliesOpened">
|
|
76
|
+
<div
|
|
77
|
+
v-for="nested_comment in childComments"
|
|
78
|
+
:key="nested_comment.id"
|
|
79
|
+
class="tw-ml-3"
|
|
80
|
+
>
|
|
81
|
+
<kv-comments-list-item
|
|
82
|
+
:user-image-url="userImageUrl"
|
|
83
|
+
:user-display-name="userDisplayName"
|
|
84
|
+
:user-public-id="userPublicId"
|
|
85
|
+
:comment="nested_comment"
|
|
86
|
+
:nest-level="nestLevel + 1"
|
|
87
|
+
@add-reaction="$emit(ADD_REACTION_EVENT, $event);"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
78
91
|
</div>
|
|
79
92
|
</div>
|
|
80
93
|
</template>
|
|
81
94
|
|
|
82
95
|
<script>
|
|
96
|
+
import { mdiChevronDown } from '@mdi/js';
|
|
83
97
|
import {
|
|
84
98
|
ref,
|
|
85
99
|
nextTick,
|
|
@@ -88,6 +102,7 @@ import {
|
|
|
88
102
|
onMounted,
|
|
89
103
|
inject,
|
|
90
104
|
} from 'vue-demi';
|
|
105
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
91
106
|
import KvCommentsReplyButton from './KvCommentsReplyButton.vue';
|
|
92
107
|
import KvCommentsHeartButton from './KvCommentsHeartButton.vue';
|
|
93
108
|
import KvCommentsAdd from './KvCommentsAdd.vue';
|
|
@@ -104,6 +119,7 @@ export default {
|
|
|
104
119
|
KvCommentsHeartButton,
|
|
105
120
|
KvCommentsAdd,
|
|
106
121
|
KvUserAvatar,
|
|
122
|
+
KvMaterialIcon,
|
|
107
123
|
},
|
|
108
124
|
props: {
|
|
109
125
|
/**
|
|
@@ -154,6 +170,7 @@ export default {
|
|
|
154
170
|
const showInput = ref(false);
|
|
155
171
|
const commentsAddRef = ref(null);
|
|
156
172
|
const authorInfo = ref();
|
|
173
|
+
const repliesOpened = ref(false);
|
|
157
174
|
|
|
158
175
|
const commentText = computed(() => comment?.value?.data?.text ?? '');
|
|
159
176
|
|
|
@@ -193,6 +210,8 @@ export default {
|
|
|
193
210
|
|
|
194
211
|
const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
|
|
195
212
|
|
|
213
|
+
const toggleReplies = () => { repliesOpened.value = !repliesOpened.value; };
|
|
214
|
+
|
|
196
215
|
// The fetchLenderInfo method must be provided in the parent component
|
|
197
216
|
const fetchLenderInfo = inject('fetchLenderInfo');
|
|
198
217
|
|
|
@@ -219,6 +238,9 @@ export default {
|
|
|
219
238
|
isLiked,
|
|
220
239
|
numberOfLikes,
|
|
221
240
|
numberOfReplies,
|
|
241
|
+
repliesOpened,
|
|
242
|
+
toggleReplies,
|
|
243
|
+
mdiChevronDown,
|
|
222
244
|
};
|
|
223
245
|
},
|
|
224
246
|
};
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
fill="#1C1B1F"
|
|
18
18
|
/>
|
|
19
19
|
</svg>
|
|
20
|
-
<span
|
|
21
|
-
v-if="numberOfReplies"
|
|
22
|
-
data-testid="reply-count"
|
|
23
|
-
>
|
|
24
|
-
{{ numberOfReplies }}
|
|
25
|
-
</span>
|
|
26
20
|
<span>
|
|
27
21
|
reply
|
|
28
22
|
</span>
|
|
@@ -37,15 +31,6 @@ export default {
|
|
|
37
31
|
components: {
|
|
38
32
|
KvButton,
|
|
39
33
|
},
|
|
40
|
-
props: {
|
|
41
|
-
/**
|
|
42
|
-
* The number of replies to the comment.
|
|
43
|
-
*/
|
|
44
|
-
numberOfReplies: {
|
|
45
|
-
type: Number,
|
|
46
|
-
default: 0,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
34
|
emits: [
|
|
50
35
|
'click',
|
|
51
36
|
],
|