diff --git a/frontend/src/proprietary/components/shared/config/configSections/AdminPlanSection.tsx b/frontend/src/proprietary/components/shared/config/configSections/AdminPlanSection.tsx index 15eb01275..86d4dac54 100644 --- a/frontend/src/proprietary/components/shared/config/configSections/AdminPlanSection.tsx +++ b/frontend/src/proprietary/components/shared/config/configSections/AdminPlanSection.tsx @@ -5,8 +5,7 @@ import { usePlans } from '@app/hooks/usePlans'; import licenseService, { PlanTierGroup, LicenseInfo } from '@app/services/licenseService'; import { useCheckout } from '@app/contexts/CheckoutContext'; import AvailablePlansSection from '@app/components/shared/config/configSections/plan/AvailablePlansSection'; -import ActivePlanSection from '@app/components/shared/config/configSections/plan//ActivePlanSection'; -import StaticPlanSection from '@app/components/shared/config/configSections/plan//StaticPlanSection'; +import StaticPlanSection from '@app/components/shared/config/configSections/plan/StaticPlanSection'; import { useAppConfig } from '@app/contexts/AppConfigContext'; import { alert } from '@app/components/toast'; import LocalIcon from '@app/components/shared/LocalIcon'; @@ -98,6 +97,11 @@ const AdminPlanSection: React.FC = () => { const handleUpgradeClick = useCallback( (planGroup: PlanTierGroup) => { + // Only allow upgrades for server and enterprise tiers + if (planGroup.tier === 'free') { + return; + } + // Use checkout context to open checkout modal openCheckout(planGroup.tier, { currency, @@ -121,7 +125,7 @@ const AdminPlanSection: React.FC = () => { // Show static version if Stripe is not configured or there's an error if (useStaticVersion) { - return ; + return ; } // Early returns after all hooks are called @@ -135,7 +139,7 @@ const AdminPlanSection: React.FC = () => { if (error) { // Fallback to static version on error - return ; + return ; } if (!plans || plans.length === 0) { diff --git a/frontend/src/proprietary/components/shared/config/configSections/plan/StaticPlanSection.tsx b/frontend/src/proprietary/components/shared/config/configSections/plan/StaticPlanSection.tsx index 97baf69ae..bef21168f 100644 --- a/frontend/src/proprietary/components/shared/config/configSections/plan/StaticPlanSection.tsx +++ b/frontend/src/proprietary/components/shared/config/configSections/plan/StaticPlanSection.tsx @@ -7,6 +7,7 @@ import { useRestartServer } from '@app/components/shared/config/useRestartServer import { useAdminSettings } from '@app/hooks/useAdminSettings'; import PendingBadge from '@app/components/shared/config/PendingBadge'; import { alert } from '@app/components/toast'; +import { LicenseInfo } from '@app/services/licenseService'; interface PremiumSettingsData { key?: string; @@ -14,11 +15,7 @@ interface PremiumSettingsData { } interface StaticPlanSectionProps { - currentLicenseInfo?: { - planName: string; - maxUsers: number; - grandfathered: boolean; - }; + currentLicenseInfo?: LicenseInfo; } const StaticPlanSection: React.FC = ({ currentLicenseInfo }) => { @@ -122,7 +119,7 @@ const StaticPlanSection: React.FC = ({ currentLicenseInf const getCurrentPlan = () => { if (!currentLicenseInfo) return staticPlans[0]; - if (currentLicenseInfo.planName === 'Enterprise') return staticPlans[2]; + if (currentLicenseInfo.licenseType === 'ENTERPRISE') return staticPlans[2]; if (currentLicenseInfo.maxUsers > 5) return staticPlans[1]; return staticPlans[0]; }; @@ -160,8 +157,6 @@ const StaticPlanSection: React.FC = ({ currentLicenseInf {currentLicenseInfo && ( {t('plan.static.maxUsers', 'Max Users')}: {currentLicenseInfo.maxUsers} - {currentLicenseInfo.grandfathered && - ` (${t('workspace.people.license.grandfathered', 'Grandfathered')})`} )} diff --git a/frontend/src/proprietary/services/licenseService.ts b/frontend/src/proprietary/services/licenseService.ts index 65e50bf87..c879a10be 100644 --- a/frontend/src/proprietary/services/licenseService.ts +++ b/frontend/src/proprietary/services/licenseService.ts @@ -284,8 +284,7 @@ const licenseService = { const allPlans = [freePlan, ...validPlans]; return { - plans: allPlans, - currentSubscription: null // Will be implemented later + plans: allPlans }; } catch (error) { console.error('Error fetching plans:', error); @@ -293,15 +292,6 @@ const licenseService = { } }, - /** - * Get current subscription details - * TODO: Implement with Supabase edge function when available - */ - async getCurrentSubscription(): Promise { - // Placeholder - will be implemented later - return null; - }, - /** * Group plans by tier for display (Free, Server, Enterprise) */