-
{name}
-
-
- $
- {monthlyOrYearly === 'on'
- ? values.year_price
- : values.month_price}
-
-
- {monthlyOrYearly === 'on' ? '/year' : '/month'}
-
-
-
- {currentPackage === name.toUpperCase() &&
- subscription?.cancelAt ? (
-
-
-
-
+ {Object.entries(pricing)
+ .filter((f) => !isGeneral() || f[0] !== 'FREE')
+ .map(([name, values]) => (
+
+
{name}
+
+
+ $
+ {monthlyOrYearly === 'on'
+ ? values.year_price
+ : values.month_price}
- ) : (
-
- )}
- {subscription &&
- currentPackage !== name.toUpperCase() &&
- name !== 'FREE' &&
- !!name && (
-
+
+ {monthlyOrYearly === 'on' ? '/year' : '/month'}
+
+
+
+ {currentPackage === name.toUpperCase() &&
+ subscription?.cancelAt ? (
+
+
+
+
+
+ ) : (
+
)}
+ {subscription &&
+ currentPackage !== name.toUpperCase() &&
+ name !== 'FREE' &&
+ !!name && (
+
+ )}
+
+
-
-
- ))}
+ ))}
{!!subscription?.id && (
-
+
+ {isGeneral() && !subscription?.cancelAt && (
+
+ )}
+
+ )}
+ {subscription?.cancelAt && isGeneral() && (
+
+ Your subscription will be cancel at {dayjs(subscription.cancelAt).local().format('D MMM, YYYY')}
+ You will never be charged again
)}
diff --git a/apps/frontend/src/components/layout/layout.settings.tsx b/apps/frontend/src/components/layout/layout.settings.tsx
index 8569bd32..582d2b15 100644
--- a/apps/frontend/src/components/layout/layout.settings.tsx
+++ b/apps/frontend/src/components/layout/layout.settings.tsx
@@ -29,6 +29,7 @@ import { isGeneral } from '@gitroom/react/helpers/is.general';
import { CopilotKit } from '@copilotkit/react-core';
import { Impersonate } from '@gitroom/frontend/components/layout/impersonate';
import clsx from 'clsx';
+import { BillingComponent } from '@gitroom/frontend/components/billing/billing.component';
dayjs.extend(utc);
dayjs.extend(weekOfYear);
@@ -49,6 +50,8 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
refreshWhenHidden: false,
});
+ if (!user) return null;
+
return (
{
-
+ {(user.tier !== 'FREE' || !isGeneral()) && }
@@ -92,7 +95,11 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
)}
- {user?.orgId ? : }
+ {user?.orgId && (user.tier !== 'FREE' || !isGeneral()) ? (
+
+ ) : (
+
+ )}
@@ -101,8 +108,25 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
-
-
{children}
+ {user.tier === 'FREE' && isGeneral() ? (
+ <>
+
+
+ PLEASE SELECT A PLAN TO CONTINUE
+
+
+ You will not be charged today.
+
+ You can cancel anytime.
+
+
+ >
+ ) : (
+ <>
+
+
{children}
+ >
+ )}
diff --git a/apps/frontend/src/components/layout/settings.component.tsx b/apps/frontend/src/components/layout/settings.component.tsx
index eb694f27..a8854ae2 100644
--- a/apps/frontend/src/components/layout/settings.component.tsx
+++ b/apps/frontend/src/components/layout/settings.component.tsx
@@ -15,6 +15,7 @@ import { TeamsComponent } from '@gitroom/frontend/components/settings/teams.comp
import { isGeneral } from '@gitroom/react/helpers/is.general';
import { useUser } from '@gitroom/frontend/components/layout/user.context';
import { LogoutComponent } from '@gitroom/frontend/components/layout/logout.component';
+import { useSearchParams } from 'next/navigation';
export const SettingsPopup: FC<{ getRef?: Ref
}> = (props) => {
const { getRef } = props;
@@ -33,6 +34,9 @@ export const SettingsPopup: FC<{ getRef?: Ref }> = (props) => {
return modal.closeAll();
}, []);
+ const url = useSearchParams();
+ const showLogout = !url.get('onboarding');
+
const loadProfile = useCallback(async () => {
const personal = await (await fetch('/user/personal')).json();
form.setValue('fullname', personal.name || '');
@@ -188,7 +192,7 @@ export const SettingsPopup: FC<{ getRef?: Ref }> = (props) => {