Add goals feature for personal goals with filters

This commit is contained in:
Gregor Vostrak
2026-10-02 12:59:44 +02:00
parent 5010a5be3a
commit 38e33b318e
83 changed files with 7702 additions and 105 deletions

View File

@@ -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();
}