Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import { useEffect } from 'react'
import {
ChipModal,
ChipModalBody,
Expand All @@ -15,12 +16,15 @@ import { useChatPlanModalStore } from '@/stores/modals/chat-plan/store'

/**
* Answers a send the workspace's plan refuses: Chat is on paid plans, with the way to upgrade
* for a viewer who may, and who to ask for one who may not. Render it once per workspace shell.
* for a viewer who may, and who to ask for one who may not. Render it once per workspace shell;
* leaving the shell closes it, so a refusal never reopens in the next workspace or organization.
*/
export function ChatPlanModal() {
const isOpen = useChatPlanModalStore((state) => state.isOpen)
const close = useChatPlanModalStore((state) => state.close)

useEffect(() => close, [close])

return (
<ChipModal
open={isOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ export function usePlanUpgradeLink(data: PlanUpgradeLinkInput): PlanUpgradeLink
const action = planRequired
? 'upgrade this workspace’s plan'
: 'manage this workspace’s usage limits'
const unavailableMessage =
organizationContext && !planRequired
? 'Contact an organization admin to manage usage limits.'
: organizationContext || hostContext?.hostOrganizationId
? `Contact an organization admin to ${action}.`
: `Only the workspace owner can ${action}.`
const unavailableMessage = organizationContext
? planRequired
? 'Contact an organization admin to upgrade this organization’s plan.'
: 'Contact an organization admin to manage usage limits.'
: hostContext?.hostOrganizationId
? `Contact an organization admin to ${action}.`
: `Only the workspace owner can ${action}.`

return {
href,
Expand Down
Loading