@kiva/kv-components 3.62.1 → 3.63.1
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/vue/KvCommentsListItem.vue +1 -1
- package/vue/KvInlineActivityCard.vue +60 -0
- package/vue/KvInlineActivityFeed.vue +38 -0
- package/vue/stories/KvInlineActivityCard.stories.js +69 -0
- package/vue/stories/KvInlineActivityFeed.stories.js +76 -0
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.63.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.63.0...@kiva/kv-components@3.63.1) (2024-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix data reference for comment list item ([0955f28](https://github.com/kiva/kv-ui-elements/commit/0955f28b8deeb067e8d393c2365dbdcab79e92df))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.63.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.62.1...@kiva/kv-components@3.63.0) (2024-03-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* inline activity feed components added ([#367](https://github.com/kiva/kv-ui-elements/issues/367)) ([32c782a](https://github.com/kiva/kv-ui-elements/commit/32c782a39d39100dcf24a7a322488d5e25b86d8b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [3.62.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.62.0...@kiva/kv-components@3.62.1) (2024-03-07)
|
|
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.63.1",
|
|
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": "1738a3cf8256bc15231d79008d3a23533a78fdeb"
|
|
79
79
|
}
|
|
@@ -161,7 +161,7 @@ export default {
|
|
|
161
161
|
|
|
162
162
|
const childComments = computed(() => comment?.value?.latest_children?.comment ?? null);
|
|
163
163
|
const childLikes = computed(() => comment?.value?.latest_children?.like ?? []);
|
|
164
|
-
const likedObject = computed(() => childLikes.value.find((child) => child
|
|
164
|
+
const likedObject = computed(() => childLikes.value.find((child) => child?.user?.data?.publicLenderId === userPublicId.value)); // eslint-disable-line max-len
|
|
165
165
|
const isLiked = computed(() => likedObject.value !== undefined);
|
|
166
166
|
|
|
167
167
|
const replyClick = () => {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="tw-flex tw-items-center tw-gap-1 tw-py-0.5 tw-px-1 tw-shadow-lg tw-rounded-sm"
|
|
4
|
+
>
|
|
5
|
+
<KvUserAvatar
|
|
6
|
+
:lender-image-url="lenderImageUrl"
|
|
7
|
+
:lender-name="lenderName"
|
|
8
|
+
is-small
|
|
9
|
+
class="activity-avatar"
|
|
10
|
+
/>
|
|
11
|
+
<p class="tw-text-base tw-whitespace-nowrap">
|
|
12
|
+
<span class="data-hj-suppress">{{ lenderName }}</span> contributed ${{ amountLent }}
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { computed, toRefs } from 'vue-demi';
|
|
19
|
+
import KvUserAvatar from './KvUserAvatar.vue';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'KvInlineActivityCard',
|
|
23
|
+
components: {
|
|
24
|
+
KvUserAvatar,
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
/**
|
|
28
|
+
* Activity data object
|
|
29
|
+
*/
|
|
30
|
+
activity: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => ({}),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
const {
|
|
37
|
+
activity,
|
|
38
|
+
} = toRefs(props);
|
|
39
|
+
|
|
40
|
+
const lenderName = computed(() => activity?.value?.lender?.name ?? '');
|
|
41
|
+
const lenderImageUrl = computed(() => activity?.value?.lender?.image?.url ?? '');
|
|
42
|
+
const amountLent = computed(() => {
|
|
43
|
+
const amount = activity?.value?.shareAmount ?? '';
|
|
44
|
+
return parseFloat(amount).toFixed();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
lenderImageUrl,
|
|
49
|
+
lenderName,
|
|
50
|
+
amountLent,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped lang="postcss">
|
|
57
|
+
.activity-avatar, .activity-avatar >>> img, .activity-avatar >>> div {
|
|
58
|
+
@apply tw-w-4 tw-h-4;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tw-flex tw-gap-x-0.5 tw-overflow-x-auto tw-py-2 tw-px-1 hide-scrollbar">
|
|
3
|
+
<KvInlineActivityCard
|
|
4
|
+
v-for="(activity, index) in activities"
|
|
5
|
+
:key="index"
|
|
6
|
+
:activity="activity"
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import KvInlineActivityCard from './KvInlineActivityCard.vue';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'KvInlineActivityFeed',
|
|
16
|
+
components: { KvInlineActivityCard },
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Activities data array
|
|
20
|
+
*/
|
|
21
|
+
activities: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => ([]),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style scoped lang="postcss">
|
|
30
|
+
.hide-scrollbar {
|
|
31
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
32
|
+
scrollbar-width: none; /* Firefox */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.hide-scrollbar::-webkit-scrollbar {
|
|
36
|
+
@apply tw-hidden;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import KvInlineActivityCard from '../KvInlineActivityCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvInlineActivityCard',
|
|
5
|
+
component: KvInlineActivityCard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const story = (args) => {
|
|
9
|
+
const template = (templateArgs, { argTypes }) => ({
|
|
10
|
+
props: Object.keys(argTypes),
|
|
11
|
+
components: { KvInlineActivityCard },
|
|
12
|
+
setup() { return { args: templateArgs }; },
|
|
13
|
+
template: `
|
|
14
|
+
<div style="max-width: 320px;">
|
|
15
|
+
<KvInlineActivityCard v-bind="args" />
|
|
16
|
+
</div>
|
|
17
|
+
`,
|
|
18
|
+
});
|
|
19
|
+
template.args = args;
|
|
20
|
+
return template;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Default = story({
|
|
24
|
+
activity: {
|
|
25
|
+
lender: {
|
|
26
|
+
image: {
|
|
27
|
+
url: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
|
|
28
|
+
},
|
|
29
|
+
name: 'Roger',
|
|
30
|
+
},
|
|
31
|
+
shareAmount: '125.00',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const NoImage = story({
|
|
36
|
+
activity: {
|
|
37
|
+
lender: {
|
|
38
|
+
image: {
|
|
39
|
+
url: '',
|
|
40
|
+
},
|
|
41
|
+
name: 'Roger',
|
|
42
|
+
},
|
|
43
|
+
shareAmount: '75.00',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Anonymous = story({
|
|
48
|
+
activity: {
|
|
49
|
+
lender: {
|
|
50
|
+
image: {
|
|
51
|
+
url: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
|
|
52
|
+
},
|
|
53
|
+
name: 'Anonymous',
|
|
54
|
+
},
|
|
55
|
+
shareAmount: '5.00',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const DefaultProfile = story({
|
|
60
|
+
activity: {
|
|
61
|
+
lender: {
|
|
62
|
+
image: {
|
|
63
|
+
url: 'https://www.development.kiva.org/img/s100/4d844ac2c0b77a8a522741b908ea5c32.jpg',
|
|
64
|
+
},
|
|
65
|
+
name: 'Default Profile',
|
|
66
|
+
},
|
|
67
|
+
shareAmount: '25.00',
|
|
68
|
+
},
|
|
69
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import KvInlineActivityFeed from '../KvInlineActivityFeed.vue';
|
|
2
|
+
|
|
3
|
+
const activities = [
|
|
4
|
+
{
|
|
5
|
+
lender: {
|
|
6
|
+
id: 723174,
|
|
7
|
+
name: 'TonyB',
|
|
8
|
+
image: {
|
|
9
|
+
url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
shareAmount: '25.00',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
lender: {
|
|
16
|
+
id: 723174,
|
|
17
|
+
name: 'Roger',
|
|
18
|
+
image: {
|
|
19
|
+
url: '',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
shareAmount: '25.00',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
lender: {
|
|
26
|
+
id: 723174,
|
|
27
|
+
name: 'Anonymous',
|
|
28
|
+
image: {
|
|
29
|
+
url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
shareAmount: '25.00',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
lender: {
|
|
36
|
+
id: 723174,
|
|
37
|
+
name: 'Default user',
|
|
38
|
+
image: {
|
|
39
|
+
url: 'https://www-0.development.kiva.org/img/s100/4d844ac2c0b77a8a522741b908ea5c32.jpg',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
shareAmount: '25.00',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
lender: {
|
|
46
|
+
id: 723174,
|
|
47
|
+
name: 'Jessica',
|
|
48
|
+
image: {
|
|
49
|
+
url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
shareAmount: '25.00',
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
title: 'KvInlineActivityFeed',
|
|
58
|
+
component: KvInlineActivityFeed,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const story = (args) => {
|
|
62
|
+
const template = (templateArgs, { argTypes }) => ({
|
|
63
|
+
props: Object.keys(argTypes),
|
|
64
|
+
components: { KvInlineActivityFeed },
|
|
65
|
+
setup() { return { args: templateArgs }; },
|
|
66
|
+
template: `
|
|
67
|
+
<div style="max-width: 1200px;">
|
|
68
|
+
<KvInlineActivityFeed v-bind="args" />
|
|
69
|
+
</div>
|
|
70
|
+
`,
|
|
71
|
+
});
|
|
72
|
+
template.args = args;
|
|
73
|
+
return template;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Default = story({ activities });
|