mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 04:02:15 +01:00
add trial expiry day countdown to billing banner
This commit is contained in:
committed by
Constantin Graf
parent
d211e962f5
commit
845f0d19d8
@@ -8,6 +8,7 @@ import {
|
|||||||
import { Link } from '@inertiajs/vue3';
|
import { Link } from '@inertiajs/vue3';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import {
|
import {
|
||||||
|
daysLeftInTrial,
|
||||||
isBillingActivated,
|
isBillingActivated,
|
||||||
isBlocked,
|
isBlocked,
|
||||||
isFreePlan,
|
isFreePlan,
|
||||||
@@ -45,7 +46,9 @@ const showFreeUpgradeBanner = computed(
|
|||||||
<MainContainer class="flex items-center justify-between">
|
<MainContainer class="flex items-center justify-between">
|
||||||
<div class="flex items-center space-x-1.5">
|
<div class="flex items-center space-x-1.5">
|
||||||
<CheckBadgeIcon class="w-4 text-white/50"></CheckBadgeIcon>
|
<CheckBadgeIcon class="w-4 text-white/50"></CheckBadgeIcon>
|
||||||
<span class="font-medium"> Your trial expires in X days. </span>
|
<span class="font-medium">
|
||||||
|
Your trial expires in {{ daysLeftInTrial() }} days.
|
||||||
|
</span>
|
||||||
<span>
|
<span>
|
||||||
To continue using all features & support the development of
|
To continue using all features & support the development of
|
||||||
solidtime, please upgrade your plan.
|
solidtime, please upgrade your plan.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { usePage } from '@inertiajs/vue3';
|
import { usePage } from '@inertiajs/vue3';
|
||||||
|
import { getDayJsInstance } from '@/packages/ui/src/utils/time';
|
||||||
|
|
||||||
export function isBillingActivated() {
|
export function isBillingActivated() {
|
||||||
const page = usePage<{
|
const page = usePage<{
|
||||||
@@ -17,6 +18,22 @@ export function isInTrial() {
|
|||||||
|
|
||||||
return page.props.billing.has_trial;
|
return page.props.billing.has_trial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function daysLeftInTrial() {
|
||||||
|
const page = usePage<{
|
||||||
|
billing: {
|
||||||
|
trial_until: string;
|
||||||
|
};
|
||||||
|
}>();
|
||||||
|
|
||||||
|
return (
|
||||||
|
getDayJsInstance()(page.props.billing.trial_until).diff(
|
||||||
|
getDayJsInstance()(),
|
||||||
|
'days'
|
||||||
|
) + 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function isBlocked() {
|
export function isBlocked() {
|
||||||
const page = usePage<{
|
const page = usePage<{
|
||||||
billing: {
|
billing: {
|
||||||
|
|||||||
Reference in New Issue
Block a user