Skip to content

Commit 7f059dc

Browse files
ldmwebirshadshalu
andauthored
feat: add sub price and period to the subcard and subinfo popup on su… (#962)
* feat: add sub price and period to the subcard and subinfo popup on sub page * feat: adding currency, amount and period from backend * fix: lint issues * fix: fixing build by adding return type to computed Co-authored-by: Irshad PI <[email protected]>
1 parent 20e0c77 commit 7f059dc

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/backend/subscription.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export interface ISubscriptionResponse {
44
subscriptionId: string
55
authorID: string
66
username: string
7+
amount: number
8+
period: string
9+
currency: string
710
tier: { name: string; id: string }
811
createdAt: number
912
isActive: boolean

src/components/popups/SubInfosPopup.vue

+11-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<div class="bg-neutral ml-4 bg-opacity-25 rounded-3xl border border-neutral px-3 py-1 text-neutral text-xs">
2828
{{ s.tier.name }}
2929
</div>
30+
<div class="flex justify-center items-end ml-4 text-neutral">
31+
<p class="font-semibold text-lg">{{ currency }}{{ s.amount }}</p>
32+
<p>/</p>
33+
<p>{{ s.period }}</p>
34+
</div>
3035
</div>
3136
<button class="focus:outline-none bg-gray1 dark:bg-gray5 rounded-full p-1" @click="$emit(`close`)">
3237
<CloseIcon />
@@ -124,7 +129,7 @@ import DownloadIcon from '@/components/icons/Download.vue'
124129
import BasicConfirmAlert from '@/components/popups/BasicConfirmAlert.vue'
125130
import { ActionType, ISubscriptionWithProfile, namespace as subscriptionNamespace } from '@/store/subscriptions'
126131
import { getSubscriptionTransactions, SubsTransaction } from '@/backend/subscription'
127-
import { getBillingPortalUrl } from '@/backend/payment'
132+
import { getBillingPortalUrl, getCurrencySymbol } from '@/backend/payment'
128133
129134
interface IData {
130135
avatar: string | ArrayBuffer
@@ -147,6 +152,11 @@ export default Vue.extend({
147152
showAlert: false,
148153
}
149154
},
155+
computed: {
156+
currency(): string {
157+
return getCurrencySymbol(this.s.currency)
158+
},
159+
},
150160
async created() {
151161
if (this.s.avatar) {
152162
this.avatar = await getPhotoFromIPFS(this.s.avatar)

src/components/subscriptions/SubCard.vue

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
>
3333
<CrownIcon class="text-neutral mr-2 w-5 h-5" /><span class="truncate text-neutral">{{ s.tier.name }}</span>
3434
</div>
35+
<div class="flex justify-center items-end mb-4 text-neutral">
36+
<p class="font-semibold text-lg">{{ currency }}{{ s.amount }}</p>
37+
<p>/</p>
38+
<p>{{ s.period }}</p>
39+
</div>
3540
<p class="text-gray5 dark:text-gray3 text-sm w-full mb-2">
3641
Subscribed since <span class="font-semibold">{{ $formatDate(s.createdAt, true) }}</span>
3742
</p>
@@ -55,6 +60,7 @@ import CrownIcon from '@/components/icons/Crown.vue'
5560
import MoreIcon from '@/components/icons/More.vue'
5661
import PenIcon from '@/components/icons/Pencil.vue'
5762
import { ISubscriptionWithProfile } from '@/store/subscriptions'
63+
import { getCurrencySymbol } from '@/backend/payment'
5864
5965
interface IData {
6066
avatar: string | ArrayBuffer
@@ -77,6 +83,11 @@ export default Vue.extend({
7783
showPopup: false,
7884
}
7985
},
86+
computed: {
87+
currency(): string {
88+
return getCurrencySymbol(this.s.currency)
89+
},
90+
},
8091
async created() {
8192
if (this.s.avatar) {
8293
this.avatar = await getPhotoFromIPFS(this.s.avatar)

0 commit comments

Comments
 (0)