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.

chore: switch support channels according to configuration (#27195)

Nite Knitecfc3f1527abd
diff --git a/web/app/components/header/account-dropdown/support.tsx b/web/app/components/header/account-dropdown/support.tsx
index fda45f2db5f..b165c5fccae 100644
--- a/web/app/components/header/account-dropdown/support.tsx
+++ b/web/app/components/header/account-dropdown/support.tsx
@@ -1,5 +1,5 @@
import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react'
-import { RiArrowRightSLine, RiArrowRightUpLine, RiChatSmile2Line, RiDiscordLine, RiFeedbackLine, RiQuestionLine } from '@remixicon/react'
+import { RiArrowRightSLine, RiArrowRightUpLine, RiChatSmile2Line, RiDiscordLine, RiFeedbackLine, RiMailSendLine, RiQuestionLine } from '@remixicon/react'
import { Fragment } from 'react'
import Link from 'next/link'
import { useTranslation } from 'react-i18next'
@@ -7,6 +7,9 @@ import cn from '@/utils/classnames'
import { useProviderContext } from '@/context/provider-context'
import { Plan } from '@/app/components/billing/type'
import { toggleZendeskWindow } from '@/app/components/base/zendesk/utils'
+import { mailToSupport } from '../utils/util'
+import { useAppContext } from '@/context/app-context'
+import { ZENDESK_WIDGET_KEY } from '@/config'
type SupportProps = {
closeAccountDropdown: () => void
@@ -19,6 +22,7 @@ export default function Support({ closeAccountDropdown }: SupportProps) {
`
const { t } = useTranslation()
const { plan } = useProviderContext()
+ const { userProfile, langGeniusVersionInfo } = useAppContext()
const hasDedicatedChannel = plan.type !== Plan.sandbox
return <Menu as="div" className="relative h-full w-full">
@@ -50,18 +54,33 @@ export default function Support({ closeAccountDropdown }: SupportProps) {
)}
>
<div className="px-1 py-1">
- {hasDedicatedChannel && <MenuItem>
- <button
- className={cn(itemClassName, 'group justify-between text-left data-[active]:bg-state-base-hover')}
- onClick={() => {
- toggleZendeskWindow(true)
- closeAccountDropdown()
- }}
- >
- <RiChatSmile2Line className='size-4 shrink-0 text-text-tertiary' />
- <div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.contactUs')}</div>
- </button>
- </MenuItem>}
+ {hasDedicatedChannel && (
+ <MenuItem>
+ {ZENDESK_WIDGET_KEY && ZENDESK_WIDGET_KEY.trim() !== '' ? (
+ <button
+ className={cn(itemClassName, 'group justify-between text-left data-[active]:bg-state-base-hover')}
+ onClick={() => {
+ toggleZendeskWindow(true)
+ closeAccountDropdown()
+ }}
+ >
+ <RiChatSmile2Line className='size-4 shrink-0 text-text-tertiary' />
+ <div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.contactUs')}</div>
+ </button>
+ ) : (
+ <a
+ className={cn(itemClassName, 'group justify-between',
+ 'data-[active]:bg-state-base-hover',
+ )}
+ href={mailToSupport(userProfile.email, plan.type, langGeniusVersionInfo?.current_version)}
+ target='_blank' rel='noopener noreferrer'>
+ <RiMailSendLine className='size-4 shrink-0 text-text-tertiary' />
+ <div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.emailSupport')}</div>
+ <RiArrowRightUpLine className='size-[14px] shrink-0 text-text-tertiary' />
+ </a>
+ )}
+ </MenuItem>
+ )}
<MenuItem>
<Link
className={cn(itemClassName, 'group justify-between',