File tree Expand file tree Collapse file tree
apps/sim/app/workspace/[workspaceId]/home
components/chat-plan-modal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use client'
22
3+ import { useEffect } from 'react'
34import {
45 ChipModal,
56 ChipModalBody,
@@ -15,12 +16,15 @@ import { useChatPlanModalStore } from '@/stores/modals/chat-plan/store'
1516
1617/**
1718 * Answers a send the workspace's plan refuses: Chat is on paid plans, with the way to upgrade
18- * for a viewer who may, and who to ask for one who may not. Render it once per workspace shell.
19+ * for a viewer who may, and who to ask for one who may not. Render it once per workspace shell;
20+ * leaving the shell closes it, so a refusal never reopens in the next workspace or organization.
1921 */
2022export function ChatPlanModal() {
2123 const isOpen = useChatPlanModalStore((state) => state.isOpen)
2224 const close = useChatPlanModalStore((state) => state.close)
2325
26+ useEffect(() => close, [close])
27+
2428 return (
2529 <ChipModal
2630 open={isOpen}
Original file line number Diff line number Diff line change @@ -63,12 +63,13 @@ export function usePlanUpgradeLink(data: PlanUpgradeLinkInput): PlanUpgradeLink
6363 const action = planRequired
6464 ? 'upgrade this workspace’s plan'
6565 : 'manage this workspace’s usage limits'
66- const unavailableMessage =
67- organizationContext && !planRequired
68- ? 'Contact an organization admin to manage usage limits.'
69- : organizationContext || hostContext?.hostOrganizationId
70- ? `Contact an organization admin to ${action}.`
71- : `Only the workspace owner can ${action}.`
66+ const unavailableMessage = organizationContext
67+ ? planRequired
68+ ? 'Contact an organization admin to upgrade this organization’s plan.'
69+ : 'Contact an organization admin to manage usage limits.'
70+ : hostContext?.hostOrganizationId
71+ ? `Contact an organization admin to ${action}.`
72+ : `Only the workspace owner can ${action}.`
7273
7374 return {
7475 href,
You can’t perform that action at this time.
0 commit comments