diff --git a/frontend/web/src/App.tsx b/frontend/web/src/App.tsx index f0d8a9d..bc38fdd 100644 --- a/frontend/web/src/App.tsx +++ b/frontend/web/src/App.tsx @@ -28,7 +28,7 @@ function App() { }, [workspaceStore.setting.customStyle]); useEffect(() => { - const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO; + const hasCustomBranding = workspaceStore.profile.subscription?.plan === PlanType.PRO; if (!hasCustomBranding || !workspaceStore.setting.branding) { return; } diff --git a/frontend/web/src/components/Header.tsx b/frontend/web/src/components/Header.tsx index 2f163f5..11b26f3 100644 --- a/frontend/web/src/components/Header.tsx +++ b/frontend/web/src/components/Header.tsx @@ -35,10 +35,10 @@ const Header: React.FC = () => { Slash - {[PlanType.PRO, PlanType.ENTERPRISE].includes(profile.plan) && ( + {profile.subscription?.plan && [PlanType.PRO, PlanType.ENTERPRISE].includes(profile.subscription.plan) && ( {/* PRO or ENT */} - {profile.plan.substring(0, 3)} + {profile.subscription.plan.substring(0, 3)} )} {shouldShowRouterSwitch && ( diff --git a/frontend/web/src/components/Logo.tsx b/frontend/web/src/components/Logo.tsx index ddc17b4..f8a69fd 100644 --- a/frontend/web/src/components/Logo.tsx +++ b/frontend/web/src/components/Logo.tsx @@ -9,7 +9,7 @@ interface Props { const Logo = ({ className }: Props) => { const workspaceStore = useWorkspaceStore(); - const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO; + const hasCustomBranding = workspaceStore.profile.subscription?.plan === PlanType.PRO; const branding = hasCustomBranding && workspaceStore.setting.branding ? new TextDecoder().decode(workspaceStore.setting.branding) : ""; return (
diff --git a/frontend/web/src/components/setting/WorkspaceSection.tsx b/frontend/web/src/components/setting/WorkspaceSection.tsx index 8adfad9..e09e53c 100644 --- a/frontend/web/src/components/setting/WorkspaceSection.tsx +++ b/frontend/web/src/components/setting/WorkspaceSection.tsx @@ -35,7 +35,7 @@ const WorkspaceSection = () => { const [workspaceSetting, setWorkspaceSetting] = useState(workspaceStore.setting); const originalWorkspaceSetting = useRef(workspaceStore.setting); const allowSave = !isEqual(originalWorkspaceSetting.current, workspaceSetting); - const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO; + const hasCustomBranding = workspaceStore.profile.subscription?.plan === PlanType.PRO; const branding = hasCustomBranding && workspaceSetting.branding ? new TextDecoder().decode(workspaceSetting.branding) : ""; const onBrandingChange = async (event: React.ChangeEvent) => { @@ -80,12 +80,10 @@ const WorkspaceSection = () => { } try { - const setting = ( - await workspaceServiceClient.updateWorkspaceSetting({ - setting: workspaceSetting, - updateMask: updateMask, - }) - ).setting as WorkspaceSetting; + const setting = await workspaceServiceClient.updateWorkspaceSetting({ + setting: workspaceSetting, + updateMask: updateMask, + }); setWorkspaceSetting(setting); await workspaceStore.fetchWorkspaceSetting(); originalWorkspaceSetting.current = setting; diff --git a/frontend/web/src/pages/SubscriptionSetting.tsx b/frontend/web/src/pages/SubscriptionSetting.tsx index a1fc2a9..9ce38f0 100644 --- a/frontend/web/src/pages/SubscriptionSetting.tsx +++ b/frontend/web/src/pages/SubscriptionSetting.tsx @@ -58,7 +58,7 @@ const SubscriptionSetting: React.FC = () => {

Subscription

Current plan: - {stringifyPlanType(profile.plan)} + {stringifyPlanType(profile.subscription?.plan)}