ProjectUpdateDisabledTooltip.tsx34 lines · main
| 1 | import { PropsWithChildren } from 'react' |
| 2 | import { Tooltip, TooltipContent, TooltipTrigger } from 'ui' |
| 3 | |
| 4 | export interface ProjectUpdateDisabledTooltipProps { |
| 5 | projectUpdateDisabled: boolean |
| 6 | projectNotActive?: boolean |
| 7 | tooltip?: string |
| 8 | } |
| 9 | |
| 10 | export const ProjectUpdateDisabledTooltip = ({ |
| 11 | projectUpdateDisabled, |
| 12 | projectNotActive = false, |
| 13 | children, |
| 14 | tooltip, |
| 15 | }: PropsWithChildren<ProjectUpdateDisabledTooltipProps>) => { |
| 16 | const tooltipMessage = |
| 17 | tooltip || |
| 18 | (projectUpdateDisabled |
| 19 | ? 'Subscription changes are currently disabled. Our engineers are working on a fix.' |
| 20 | : projectNotActive |
| 21 | ? 'Unable to update subscription as project is currently not active' |
| 22 | : undefined) |
| 23 | |
| 24 | return ( |
| 25 | <Tooltip> |
| 26 | <TooltipTrigger asChild>{children}</TooltipTrigger> |
| 27 | {tooltipMessage !== undefined && ( |
| 28 | <TooltipContent side="bottom" className="w-64 text-center"> |
| 29 | {tooltipMessage} |
| 30 | </TooltipContent> |
| 31 | )} |
| 32 | </Tooltip> |
| 33 | ) |
| 34 | } |