| @@ -8,6 +8,7 @@ import Link from 'next/link' | |||
| import { Menu, Transition } from '@headlessui/react' | |||
| import Indicator from '../indicator' | |||
| import AccountAbout from '../account-about' | |||
| import { mailToSupport } from '../utils/util' | |||
| import WorkplaceSelector from './workplace-selector' | |||
| import classNames from '@/utils/classnames' | |||
| import I18n from '@/context/i18n' | |||
| @@ -18,6 +19,9 @@ import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows | |||
| import { LogOut01 } from '@/app/components/base/icons/src/vender/line/general' | |||
| import { useModalContext } from '@/context/modal-context' | |||
| import { LanguagesSupported } from '@/i18n/language' | |||
| import { useProviderContext } from '@/context/provider-context' | |||
| import { Plan } from '@/app/components/billing/type' | |||
| export type IAppSelecotr = { | |||
| isMobile: boolean | |||
| } | |||
| @@ -34,6 +38,8 @@ export default function AppSelector({ isMobile }: IAppSelecotr) { | |||
| const { t } = useTranslation() | |||
| const { userProfile, langeniusVersionInfo } = useAppContext() | |||
| const { setShowAccountSettingModal } = useModalContext() | |||
| const { plan } = useProviderContext() | |||
| const canEmailSupport = plan.type === Plan.professional || plan.type === Plan.team || plan.type === Plan.enterprise | |||
| const handleLogout = async () => { | |||
| await logout({ | |||
| @@ -105,6 +111,15 @@ export default function AppSelector({ isMobile }: IAppSelecotr) { | |||
| <div>{t('common.userProfile.settings')}</div> | |||
| </div> | |||
| </Menu.Item> | |||
| {canEmailSupport && <Menu.Item> | |||
| <a | |||
| className={classNames(itemClassName, 'group justify-between')} | |||
| href={mailToSupport(userProfile.email, plan.type, langeniusVersionInfo.current_version)} | |||
| target='_blank' rel='noopener noreferrer'> | |||
| <div>{t('common.userProfile.emailSupport')}</div> | |||
| <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' /> | |||
| </a> | |||
| </Menu.Item>} | |||
| <Menu.Item> | |||
| <Link | |||
| className={classNames(itemClassName, 'group justify-between')} | |||
| @@ -0,0 +1,25 @@ | |||
| export const generateMailToLink = (email: string, subject?: string, body?: string): string => { | |||
| let mailtoLink = `mailto:${email}` | |||
| if (subject) | |||
| mailtoLink += `?subject=${encodeURIComponent(subject)}` | |||
| if (body) | |||
| mailtoLink += `&body=${encodeURIComponent(body)}` | |||
| return mailtoLink | |||
| } | |||
| export const mailToSupport = (account: string, plan: string, version: string) => { | |||
| const subject = `Technical Support Request ${plan} ${account}` | |||
| const body = ` | |||
| Please do not remove the following information: | |||
| ----------------------------------------------- | |||
| Current Plan: ${plan} | |||
| Account: ${account} | |||
| Version: ${version} | |||
| Platform: | |||
| Problem Description: | |||
| ` | |||
| return generateMailToLink('support@dify.ai', subject, body) | |||
| } | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Einstellungen', | |||
| emailSupport: 'E-Mail-Support', | |||
| workspace: 'Arbeitsbereich', | |||
| createWorkspace: 'Arbeitsbereich erstellen', | |||
| helpCenter: 'Hilfe', | |||
| @@ -124,6 +124,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Settings', | |||
| emailSupport: 'Email Support', | |||
| workspace: 'Workspace', | |||
| createWorkspace: 'Create Workspace', | |||
| helpCenter: 'Help', | |||
| @@ -124,6 +124,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Configuraciones', | |||
| emailSupport: 'Soporte de Correo Electrónico', | |||
| workspace: 'Espacio de trabajo', | |||
| createWorkspace: 'Crear espacio de trabajo', | |||
| helpCenter: 'Ayuda', | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Paramètres', | |||
| emailSupport: 'Support par courriel', | |||
| workspace: 'Espace de travail', | |||
| createWorkspace: 'Créer un Espace de Travail', | |||
| helpCenter: 'Aide', | |||
| @@ -128,6 +128,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'सेटिंग्स', | |||
| emailSupport: 'सहायता', | |||
| workspace: 'वर्कस्पेस', | |||
| createWorkspace: 'वर्कस्पेस बनाएं', | |||
| helpCenter: 'सहायता', | |||
| @@ -129,6 +129,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Impostazioni', | |||
| emailSupport: 'Supporto Email', | |||
| workspace: 'Workspace', | |||
| createWorkspace: 'Crea Workspace', | |||
| helpCenter: 'Aiuto', | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: '設定', | |||
| emailSupport: 'サポート', | |||
| workspace: 'ワークスペース', | |||
| createWorkspace: 'ワークスペースを作成', | |||
| helpCenter: 'ヘルプ', | |||
| @@ -115,6 +115,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: '설정', | |||
| emailSupport: '이메일 지원', | |||
| workspace: '작업 공간', | |||
| createWorkspace: '작업 공간 만들기', | |||
| helpCenter: '도움말 센터', | |||
| @@ -124,6 +124,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Ustawienia', | |||
| emailSupport: 'Wsparcie e-mail', | |||
| workspace: 'Przestrzeń robocza', | |||
| createWorkspace: 'Utwórz przestrzeń roboczą', | |||
| helpCenter: 'Pomoc', | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Configurações', | |||
| emailSupport: 'Suporte por e-mail', | |||
| workspace: 'Espaço de trabalho', | |||
| createWorkspace: 'Criar Espaço de Trabalho', | |||
| helpCenter: 'Ajuda', | |||
| @@ -118,6 +118,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Setări', | |||
| emailSupport: 'Suport prin email', | |||
| workspace: 'Spațiu de lucru', | |||
| createWorkspace: 'Creează Spațiu de lucru', | |||
| helpCenter: 'Ajutor', | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Налаштування', | |||
| emailSupport: 'Підтримка по електронній пошті', | |||
| workspace: 'Робочий простір', | |||
| createWorkspace: 'Створити робочий простір', | |||
| helpCenter: 'Довідковий центр', | |||
| @@ -118,6 +118,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: 'Cài đặt', | |||
| emailSupport: 'Hỗ trợ qua Email', | |||
| workspace: 'Không gian làm việc', | |||
| createWorkspace: 'Tạo Không gian làm việc', | |||
| helpCenter: 'Trung tâm trợ giúp', | |||
| @@ -124,6 +124,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: '设置', | |||
| emailSupport: '邮件支持', | |||
| workspace: '工作空间', | |||
| createWorkspace: '创建工作空间', | |||
| helpCenter: '帮助文档', | |||
| @@ -119,6 +119,7 @@ const translation = { | |||
| }, | |||
| userProfile: { | |||
| settings: '設定', | |||
| emailSupport: '電子郵件支援', | |||
| workspace: '工作空間', | |||
| createWorkspace: '建立工作空間', | |||
| helpCenter: '幫助文件', | |||