@kiva/kv-components 3.60.0 → 3.62.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 +28 -0
- package/package.json +2 -2
- package/tests/unit/specs/components/KvCommentsList.spec.js +14 -1
- package/tests/unit/specs/components/KvCommentsListItem.spec.js +14 -1
- package/vue/KvCommentsListItem.vue +18 -2
- package/vue/KvCommentsReplyButton.vue +23 -4
- package/vue/stories/KvCommentsContainer.stories.js +11 -2
- package/vue/stories/KvCommentsList.stories.js +10 -2
- package/vue/stories/KvCommentsListItem.stories.js +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
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.62.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.61.0...@kiva/kv-components@3.62.0) (2024-03-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add comment regarding inject ([7a98c3b](https://github.com/kiva/kv-ui-elements/commit/7a98c3b017c9472c14ef0a26fdad53864aaf3ada))
|
|
12
|
+
* add provide to commenting stories ([01c1e53](https://github.com/kiva/kv-ui-elements/commit/01c1e5305cda4d2885afa1c4a4784630e7a6047d))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* update reply to match other commenting buttons ([6ad68a3](https://github.com/kiva/kv-ui-elements/commit/6ad68a3ddcce48089d12bd473f8fa3bfd7c30b5f))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# [3.61.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.60.0...@kiva/kv-components@3.61.0) (2024-03-04)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* fetchlenderinfo method injected to comment item component ([#362](https://github.com/kiva/kv-ui-elements/issues/362)) ([2aba5e0](https://github.com/kiva/kv-ui-elements/commit/2aba5e0837d57eec77f2d1bee48ca2c3c127c1d4))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
6
34
|
# [3.60.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.59.1...@kiva/kv-components@3.60.0) (2024-03-04)
|
|
7
35
|
|
|
8
36
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.62.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": "444a69ad972d2eaef7f19c3ca99467aa2d157be7"
|
|
79
79
|
}
|
|
@@ -6,7 +6,20 @@ import { LIKE_COMMENT_EVENT, REPLY_COMMENT_EVENT } from '../../../../vue/KvComme
|
|
|
6
6
|
import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
|
|
7
7
|
|
|
8
8
|
const renderList = (props = {}) => {
|
|
9
|
-
return render(ListComponent,
|
|
9
|
+
return render(ListComponent,
|
|
10
|
+
{
|
|
11
|
+
props,
|
|
12
|
+
// provide function for vue 2 testing
|
|
13
|
+
provide: {
|
|
14
|
+
fetchLenderInfo: () => Promise.resolve({}),
|
|
15
|
+
},
|
|
16
|
+
// provide function for vue 3 testing
|
|
17
|
+
global: {
|
|
18
|
+
provide: {
|
|
19
|
+
fetchLenderInfo: () => Promise.resolve({}),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
10
23
|
};
|
|
11
24
|
|
|
12
25
|
const comments = activityFeed.results[0].latest_reactions;
|
|
@@ -7,7 +7,20 @@ import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
|
|
|
7
7
|
const comment = activityFeed.results[0].latest_reactions.comment[0];
|
|
8
8
|
|
|
9
9
|
const renderComment = (props = {}) => {
|
|
10
|
-
return render(KvCommentsListItem,
|
|
10
|
+
return render(KvCommentsListItem,
|
|
11
|
+
{
|
|
12
|
+
props,
|
|
13
|
+
// provide function for vue 2 testing
|
|
14
|
+
provide: {
|
|
15
|
+
fetchLenderInfo: () => Promise.resolve({}),
|
|
16
|
+
},
|
|
17
|
+
// provide function for vue 3 testing
|
|
18
|
+
global: {
|
|
19
|
+
provide: {
|
|
20
|
+
fetchLenderInfo: () => Promise.resolve({}),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
describe('KvCommentsListItem', () => {
|
|
@@ -83,6 +83,8 @@ import {
|
|
|
83
83
|
nextTick,
|
|
84
84
|
computed,
|
|
85
85
|
toRefs,
|
|
86
|
+
onMounted,
|
|
87
|
+
inject,
|
|
86
88
|
} from 'vue-demi';
|
|
87
89
|
import KvCommentsReplyButton from './KvCommentsReplyButton.vue';
|
|
88
90
|
import KvCommentsHeartButton from './KvCommentsHeartButton.vue';
|
|
@@ -149,10 +151,14 @@ export default {
|
|
|
149
151
|
|
|
150
152
|
const showInput = ref(false);
|
|
151
153
|
const commentsAddRef = ref(null);
|
|
154
|
+
const authorInfo = ref();
|
|
152
155
|
|
|
153
156
|
const commentText = computed(() => comment?.value?.data?.text ?? '');
|
|
154
|
-
|
|
155
|
-
const
|
|
157
|
+
|
|
158
|
+
const authorId = computed(() => comment?.value?.user?.data?.publicLenderId ?? '');
|
|
159
|
+
const authorImage = computed(() => authorInfo?.value?.image?.url ?? '');
|
|
160
|
+
const authorName = computed(() => authorInfo?.value?.name ?? '');
|
|
161
|
+
|
|
156
162
|
const childComments = computed(() => comment?.value?.latest_children?.comment ?? null);
|
|
157
163
|
const childLikes = computed(() => comment?.value?.latest_children?.like ?? []);
|
|
158
164
|
const likedObject = computed(() => childLikes.value.find((child) => child.user.data.publicLenderId === userPublicId.value)); // eslint-disable-line max-len
|
|
@@ -185,6 +191,16 @@ export default {
|
|
|
185
191
|
|
|
186
192
|
const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
|
|
187
193
|
|
|
194
|
+
// The fetchLenderInfo method must be provided in the parent component
|
|
195
|
+
const fetchLenderInfo = inject('fetchLenderInfo');
|
|
196
|
+
|
|
197
|
+
onMounted(async () => {
|
|
198
|
+
if (authorId.value) {
|
|
199
|
+
const authorData = await fetchLenderInfo(authorId.value);
|
|
200
|
+
authorInfo.value = authorData;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
188
204
|
return {
|
|
189
205
|
hideInput,
|
|
190
206
|
showInput,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!-- eslint-disable max-len -->
|
|
2
2
|
<template>
|
|
3
|
-
<button
|
|
3
|
+
<kv-button
|
|
4
|
+
variant="ghost"
|
|
4
5
|
aria-label="Reply"
|
|
5
|
-
class="tw-font-medium tw-flex tw-items-center tw-gap-x-0.5"
|
|
6
6
|
@click="$emit('click')"
|
|
7
7
|
>
|
|
8
8
|
<svg
|
|
@@ -24,14 +24,19 @@
|
|
|
24
24
|
{{ numberOfReplies }}
|
|
25
25
|
</span>
|
|
26
26
|
<span>
|
|
27
|
-
|
|
27
|
+
reply
|
|
28
28
|
</span>
|
|
29
|
-
</button>
|
|
29
|
+
</kv-button>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
+
import KvButton from './KvButton.vue';
|
|
34
|
+
|
|
33
35
|
export default {
|
|
34
36
|
name: 'KvCommentsReplyButton',
|
|
37
|
+
components: {
|
|
38
|
+
KvButton,
|
|
39
|
+
},
|
|
35
40
|
props: {
|
|
36
41
|
/**
|
|
37
42
|
* The number of replies to the comment.
|
|
@@ -46,3 +51,17 @@ export default {
|
|
|
46
51
|
],
|
|
47
52
|
};
|
|
48
53
|
</script>
|
|
54
|
+
|
|
55
|
+
<style lang="postcss" scoped>
|
|
56
|
+
>>> span {
|
|
57
|
+
@apply tw-min-h-0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
>>> span > span {
|
|
61
|
+
@apply tw-py-0 tw-px-0.5 tw-flex tw-items-center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
>>> svg {
|
|
65
|
+
@apply tw-mx-0.5;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -6,11 +6,20 @@ export default {
|
|
|
6
6
|
component: KvCommentsContainer,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
const TEST_USER_NAME = 'Jess';
|
|
10
|
+
const TEST_USER_IMAGE = 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg';
|
|
11
|
+
|
|
9
12
|
const story = (args) => {
|
|
10
13
|
const template = (templateArgs, { argTypes }) => ({
|
|
11
14
|
props: Object.keys(argTypes),
|
|
12
15
|
components: { KvCommentsContainer },
|
|
13
16
|
setup() { return { args: templateArgs }; },
|
|
17
|
+
provide: {
|
|
18
|
+
fetchLenderInfo: () => Promise.resolve({
|
|
19
|
+
name: TEST_USER_NAME,
|
|
20
|
+
image: { url: TEST_USER_IMAGE },
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
14
23
|
template: `
|
|
15
24
|
<div style="max-width: 800px;">
|
|
16
25
|
<KvCommentsContainer v-bind="args" />
|
|
@@ -28,8 +37,8 @@ export const Default = story({ comments });
|
|
|
28
37
|
export const UserData = story(
|
|
29
38
|
{
|
|
30
39
|
comments,
|
|
31
|
-
userDisplayName:
|
|
32
|
-
userImageUrl:
|
|
40
|
+
userDisplayName: TEST_USER_NAME,
|
|
41
|
+
userImageUrl: TEST_USER_IMAGE,
|
|
33
42
|
userPublicId: 'Jess1234',
|
|
34
43
|
},
|
|
35
44
|
);
|
|
@@ -5,12 +5,20 @@ export default {
|
|
|
5
5
|
title: 'KvCommentsList',
|
|
6
6
|
component: KvCommentsList,
|
|
7
7
|
};
|
|
8
|
+
const TEST_USER_NAME = 'Jess';
|
|
9
|
+
const TEST_USER_IMAGE = 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg';
|
|
8
10
|
|
|
9
11
|
const story = (args) => {
|
|
10
12
|
const template = (templateArgs, { argTypes }) => ({
|
|
11
13
|
props: Object.keys(argTypes),
|
|
12
14
|
components: { KvCommentsList },
|
|
13
15
|
setup() { return { args: templateArgs }; },
|
|
16
|
+
provide: {
|
|
17
|
+
fetchLenderInfo: () => Promise.resolve({
|
|
18
|
+
name: TEST_USER_NAME,
|
|
19
|
+
image: { url: TEST_USER_IMAGE },
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
14
22
|
template: `
|
|
15
23
|
<KvCommentsList v-bind="args" />
|
|
16
24
|
`,
|
|
@@ -26,8 +34,8 @@ export const Default = story({ comments });
|
|
|
26
34
|
export const UserData = story(
|
|
27
35
|
{
|
|
28
36
|
comments,
|
|
29
|
-
userDisplayName:
|
|
30
|
-
userImageUrl:
|
|
37
|
+
userDisplayName: TEST_USER_NAME,
|
|
38
|
+
userImageUrl: TEST_USER_IMAGE,
|
|
31
39
|
userPublicId: 'Jess1234',
|
|
32
40
|
},
|
|
33
41
|
);
|
|
@@ -6,11 +6,20 @@ export default {
|
|
|
6
6
|
component: KvCommentsListItem,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
const TEST_USER_NAME = 'Jess';
|
|
10
|
+
const TEST_USER_IMAGE = 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg';
|
|
11
|
+
|
|
9
12
|
const story = (args) => {
|
|
10
13
|
const template = (templateArgs, { argTypes }) => ({
|
|
11
14
|
props: Object.keys(argTypes),
|
|
12
15
|
components: { KvCommentsListItem },
|
|
13
16
|
setup() { return { args: templateArgs }; },
|
|
17
|
+
provide: {
|
|
18
|
+
fetchLenderInfo: () => Promise.resolve({
|
|
19
|
+
name: TEST_USER_NAME,
|
|
20
|
+
image: { url: TEST_USER_IMAGE },
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
14
23
|
template: `
|
|
15
24
|
<KvCommentsListItem v-bind="args" />
|
|
16
25
|
`,
|
|
@@ -29,8 +38,8 @@ export const ChildComments = story({ comment: childComments });
|
|
|
29
38
|
export const UserData = story(
|
|
30
39
|
{
|
|
31
40
|
comment: childComments,
|
|
32
|
-
userDisplayName:
|
|
33
|
-
userImageUrl:
|
|
41
|
+
userDisplayName: TEST_USER_NAME,
|
|
42
|
+
userImageUrl: TEST_USER_IMAGE,
|
|
34
43
|
userPublicId: 'Jess1234',
|
|
35
44
|
},
|
|
36
45
|
);
|