Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.6 KB
Raw Blame
'use client'

import type { PopoverContentProps } from '@langgenius/dify-ui/popover'
import { cn } from '@langgenius/dify-ui/cn'
import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'
import { useSuspenseQuery } from '@tanstack/react-query'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'

type CommunityEditionTipProps = Pick<PopoverContentProps, 'className' | 'side' | 'align'> & {
  tip: string
}

/**
 * Warning affordance for caveats that only apply to community edition.
 * Renders nothing on enterprise or cloud deployments, so callers do not repeat
 * the edition check.
 */
export function CommunityEditionTip({ tip, side, align, className }: CommunityEditionTipProps) {
  const { data: deploymentEdition } = useSuspenseQuery({
    ...systemFeaturesQueryOptions(),
    select: ({ deployment_edition }) => deployment_edition,
  })

  if (deploymentEdition !== 'COMMUNITY') return null

  return (
    <Popover>
      <PopoverTrigger
        openOnHover
        delay={300}
        closeDelay={200}
        aria-label={tip}
        render={
          <button
            type="button"
            className="inline-flex size-4 shrink-0 items-center justify-center rounded-sm"
          >
            <span
              aria-hidden
              className="i-custom-vender-line-alertsAndFeedback-alert-triangle size-4 text-text-warning-secondary"
            />
          </button>
        }
      />
      <PopoverContent
        side={side}
        align={align}
        className={cn('px-3 py-2 system-xs-regular text-text-tertiary', className)}
      >
        {tip}
      </PopoverContent>
    </Popover>
  )
}