@kiva/kv-components 3.65.1 → 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 +22 -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 +40 -15
- package/vue/KvCommentsReplyButton.vue +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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
|
+
|
|
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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* revert level 3 reactions and more specific error src ([dc8acac](https://github.com/kiva/kv-ui-elements/commit/dc8acaca403b438d34daca49e85442627883b08f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [3.65.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.65.0...@kiva/kv-components@3.65.1) (2024-03-19)
|
|
7
29
|
|
|
8
30
|
|
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' });
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
{{ commentText }}
|
|
19
19
|
</p>
|
|
20
20
|
</div>
|
|
21
|
-
<div
|
|
21
|
+
<div
|
|
22
|
+
v-if="nestLevel < 3"
|
|
23
|
+
class="tw-flex tw-items-center tw-gap-x-1"
|
|
24
|
+
>
|
|
22
25
|
<div class="tw-flex tw-items-center tw-gap-0.5">
|
|
23
26
|
<kv-comments-heart-button
|
|
24
27
|
:is-small="true"
|
|
@@ -35,8 +38,7 @@
|
|
|
35
38
|
</p>
|
|
36
39
|
</div>
|
|
37
40
|
<kv-comments-reply-button
|
|
38
|
-
v-if="userPublicId
|
|
39
|
-
:number-of-replies="numberOfReplies"
|
|
41
|
+
v-if="userPublicId"
|
|
40
42
|
@click="replyClick"
|
|
41
43
|
/>
|
|
42
44
|
</div>
|
|
@@ -58,25 +60,40 @@
|
|
|
58
60
|
v-if="childComments"
|
|
59
61
|
class="tw-my-1"
|
|
60
62
|
>
|
|
61
|
-
<
|
|
62
|
-
v-
|
|
63
|
-
|
|
64
|
-
|
|
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"
|
|
65
67
|
>
|
|
66
|
-
<kv-
|
|
67
|
-
|
|
68
|
-
:
|
|
69
|
-
:
|
|
70
|
-
:comment="nested_comment"
|
|
71
|
-
:nest-level="nestLevel + 1"
|
|
72
|
-
@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"
|
|
73
72
|
/>
|
|
74
|
-
|
|
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>
|
|
75
91
|
</div>
|
|
76
92
|
</div>
|
|
77
93
|
</template>
|
|
78
94
|
|
|
79
95
|
<script>
|
|
96
|
+
import { mdiChevronDown } from '@mdi/js';
|
|
80
97
|
import {
|
|
81
98
|
ref,
|
|
82
99
|
nextTick,
|
|
@@ -85,6 +102,7 @@ import {
|
|
|
85
102
|
onMounted,
|
|
86
103
|
inject,
|
|
87
104
|
} from 'vue-demi';
|
|
105
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
88
106
|
import KvCommentsReplyButton from './KvCommentsReplyButton.vue';
|
|
89
107
|
import KvCommentsHeartButton from './KvCommentsHeartButton.vue';
|
|
90
108
|
import KvCommentsAdd from './KvCommentsAdd.vue';
|
|
@@ -101,6 +119,7 @@ export default {
|
|
|
101
119
|
KvCommentsHeartButton,
|
|
102
120
|
KvCommentsAdd,
|
|
103
121
|
KvUserAvatar,
|
|
122
|
+
KvMaterialIcon,
|
|
104
123
|
},
|
|
105
124
|
props: {
|
|
106
125
|
/**
|
|
@@ -151,6 +170,7 @@ export default {
|
|
|
151
170
|
const showInput = ref(false);
|
|
152
171
|
const commentsAddRef = ref(null);
|
|
153
172
|
const authorInfo = ref();
|
|
173
|
+
const repliesOpened = ref(false);
|
|
154
174
|
|
|
155
175
|
const commentText = computed(() => comment?.value?.data?.text ?? '');
|
|
156
176
|
|
|
@@ -190,6 +210,8 @@ export default {
|
|
|
190
210
|
|
|
191
211
|
const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
|
|
192
212
|
|
|
213
|
+
const toggleReplies = () => { repliesOpened.value = !repliesOpened.value; };
|
|
214
|
+
|
|
193
215
|
// The fetchLenderInfo method must be provided in the parent component
|
|
194
216
|
const fetchLenderInfo = inject('fetchLenderInfo');
|
|
195
217
|
|
|
@@ -216,6 +238,9 @@ export default {
|
|
|
216
238
|
isLiked,
|
|
217
239
|
numberOfLikes,
|
|
218
240
|
numberOfReplies,
|
|
241
|
+
repliesOpened,
|
|
242
|
+
toggleReplies,
|
|
243
|
+
mdiChevronDown,
|
|
219
244
|
};
|
|
220
245
|
},
|
|
221
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
|
],
|