mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-16 01:33:18 +01:00
Add goals feature for personal goals with filters
This commit is contained in:
@@ -17,6 +17,14 @@ export function isInvoicingActivated() {
|
||||
return page.props.has_invoicing_extension;
|
||||
}
|
||||
|
||||
export function isGoalsExtensionActivated() {
|
||||
const page = usePage<{
|
||||
has_goals_extension: boolean;
|
||||
}>();
|
||||
|
||||
return page.props.has_goals_extension;
|
||||
}
|
||||
|
||||
export function isInTrial() {
|
||||
const page = usePage<{
|
||||
billing: {
|
||||
@@ -49,6 +57,26 @@ export function isBlocked() {
|
||||
return page.props.billing.is_blocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of goals the organization can have, null means unlimited.
|
||||
* Archived goals count towards the limit as well.
|
||||
*/
|
||||
export function goalLimit(): number | null {
|
||||
const page = usePage<{
|
||||
billing: {
|
||||
goal_limit: number | null;
|
||||
} | null;
|
||||
}>();
|
||||
|
||||
return page.props.billing?.goal_limit ?? null;
|
||||
}
|
||||
|
||||
export function canCreateMoreGoals(goalCount: number): boolean {
|
||||
const limit = goalLimit();
|
||||
|
||||
return limit === null || goalCount < limit;
|
||||
}
|
||||
|
||||
export function isFreePlan() {
|
||||
return !hasActiveSubscription() && !isInTrial();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user