+
diff --git a/src/routes/community/profile/+page.svelte b/src/routes/community/profile/+page.svelte
index 53a1ef8e..10367d76 100644
--- a/src/routes/community/profile/+page.svelte
+++ b/src/routes/community/profile/+page.svelte
@@ -7,7 +7,7 @@
import { onMount, onDestroy } from 'svelte';
import {getImageURL } from '$lib/utils';
- import {screenWidth, userRegion, setCache, getCache, newAvatar, clientSideCache, numberOfUnreadNotification, postIdDeleted } from '$lib/store';
+ import {userRegion, setCache, getCache, newAvatar, numberOfUnreadNotification, postIdDeleted } from '$lib/store';
import toast from 'svelte-french-toast';
import InfiniteLoading from '$lib/components/InfiniteLoading.svelte';
@@ -499,6 +499,18 @@ const changeTab = (state) => {
}
};
+// Function to add days to a given date
+function addDays(days) {
+ // Original date from the data object
+ const createdDate = new Date(data?.user?.created);
+
+ const result = new Date(createdDate);
+ result.setDate(result.getDate() + days);
+ return result;
+}
+
+
+const trialEndDate = addDays(7);
onMount(async () => {
@@ -548,7 +560,6 @@ onDestroy(async () => {
-
@@ -556,7 +567,6 @@ onDestroy(async () => {
-
@@ -887,12 +897,16 @@ onDestroy(async () => {
-
-
+
+
+ {#if data?.user?.freeTrial === true}
+ Active
+ {:else}
{subscriptionData?.status_formatted ?? 'Inactive'}
+ {/if}
@@ -905,6 +919,8 @@ onDestroy(async () => {
Your trial will end on {new Date(subscriptionData?.trial_ends_at)?.toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}.
+ {:else if data?.user?.freeTrial === true}
+ Your trial will end on {trialEndDate?.toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}.
{:else if subscriptionData?.status_formatted === 'Cancelled'}
Your subscription will remain active until {new Date(subscriptionData?.ends_at)?.toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}
@@ -917,7 +933,7 @@ onDestroy(async () => {
Current Plan:
- {['Active', 'Paid', 'On Trial', 'Cancelled']?.includes(subscriptionData?.status_formatted) ? subscriptionData?.product_name : 'Free Subscription'}
+ {['Active', 'Paid', 'On Trial', 'Cancelled']?.includes(subscriptionData?.status_formatted) ? subscriptionData?.product_name : data?.user?.freeTrial === true ? 'Free Trial Subscription' : 'Free Subscription'}
{subscriptionData?.product_name?.includes('Monthly') ? '$9.99 billed every month' : '$90 billed every year'}
@@ -945,6 +961,7 @@ onDestroy(async () => {
Please wait a moment; you will be updated to Pro in a second.
+ {:else if data?.user?.freeTrial}
{:else}
Get Full Access with Pro Subscription.