From 71a72114111b5849d6a8f36e9ad1ec0f6e635027 Mon Sep 17 00:00:00 2001 From: crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Mon, 22 Jul 2024 19:56:46 +0800 Subject: [PATCH] Feat/add email support for pro and team (#6533) --- .../header/account-dropdown/index.tsx | 15 +++++++++++ web/app/components/header/utils/util.ts | 25 +++++++++++++++++++ web/i18n/de-DE/common.ts | 1 + web/i18n/en-US/common.ts | 1 + web/i18n/es-ES/common.ts | 1 + web/i18n/fr-FR/common.ts | 1 + web/i18n/hi-IN/common.ts | 1 + web/i18n/it-IT/common.ts | 1 + web/i18n/ja-JP/common.ts | 1 + web/i18n/ko-KR/common.ts | 1 + web/i18n/pl-PL/common.ts | 1 + web/i18n/pt-BR/common.ts | 1 + web/i18n/ro-RO/common.ts | 1 + web/i18n/uk-UA/common.ts | 1 + web/i18n/vi-VN/common.ts | 1 + web/i18n/zh-Hans/common.ts | 1 + web/i18n/zh-Hant/common.ts | 1 + 17 files changed, 55 insertions(+) create mode 100644 web/app/components/header/utils/util.ts diff --git a/web/app/components/header/account-dropdown/index.tsx b/web/app/components/header/account-dropdown/index.tsx index 006c0311e0..2298bff82d 100644 --- a/web/app/components/header/account-dropdown/index.tsx +++ b/web/app/components/header/account-dropdown/index.tsx @@ -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) {
{t('common.userProfile.settings')}
+ {canEmailSupport && + +
{t('common.userProfile.emailSupport')}
+ +
+
} { + 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) +} diff --git a/web/i18n/de-DE/common.ts b/web/i18n/de-DE/common.ts index 9b5e4efc74..bd0ef66e55 100644 --- a/web/i18n/de-DE/common.ts +++ b/web/i18n/de-DE/common.ts @@ -119,6 +119,7 @@ const translation = { }, userProfile: { settings: 'Einstellungen', + emailSupport: 'E-Mail-Support', workspace: 'Arbeitsbereich', createWorkspace: 'Arbeitsbereich erstellen', helpCenter: 'Hilfe', diff --git a/web/i18n/en-US/common.ts b/web/i18n/en-US/common.ts index 0514763b62..5c7a3d1d0e 100644 --- a/web/i18n/en-US/common.ts +++ b/web/i18n/en-US/common.ts @@ -124,6 +124,7 @@ const translation = { }, userProfile: { settings: 'Settings', + emailSupport: 'Email Support', workspace: 'Workspace', createWorkspace: 'Create Workspace', helpCenter: 'Help', diff --git a/web/i18n/es-ES/common.ts b/web/i18n/es-ES/common.ts index e60c5441a7..4afc06b098 100644 --- a/web/i18n/es-ES/common.ts +++ b/web/i18n/es-ES/common.ts @@ -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', diff --git a/web/i18n/fr-FR/common.ts b/web/i18n/fr-FR/common.ts index 6d15638ff1..bdd94e7a16 100644 --- a/web/i18n/fr-FR/common.ts +++ b/web/i18n/fr-FR/common.ts @@ -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', diff --git a/web/i18n/hi-IN/common.ts b/web/i18n/hi-IN/common.ts index 739f96c5f9..6f1385cb3d 100644 --- a/web/i18n/hi-IN/common.ts +++ b/web/i18n/hi-IN/common.ts @@ -128,6 +128,7 @@ const translation = { }, userProfile: { settings: 'सेटिंग्स', + emailSupport: 'सहायता', workspace: 'वर्कस्पेस', createWorkspace: 'वर्कस्पेस बनाएं', helpCenter: 'सहायता', diff --git a/web/i18n/it-IT/common.ts b/web/i18n/it-IT/common.ts index 2cebc0c18a..cc9c34e2dc 100644 --- a/web/i18n/it-IT/common.ts +++ b/web/i18n/it-IT/common.ts @@ -129,6 +129,7 @@ const translation = { }, userProfile: { settings: 'Impostazioni', + emailSupport: 'Supporto Email', workspace: 'Workspace', createWorkspace: 'Crea Workspace', helpCenter: 'Aiuto', diff --git a/web/i18n/ja-JP/common.ts b/web/i18n/ja-JP/common.ts index e5a5b18cae..b92a2ccd21 100644 --- a/web/i18n/ja-JP/common.ts +++ b/web/i18n/ja-JP/common.ts @@ -119,6 +119,7 @@ const translation = { }, userProfile: { settings: '設定', + emailSupport: 'サポート', workspace: 'ワークスペース', createWorkspace: 'ワークスペースを作成', helpCenter: 'ヘルプ', diff --git a/web/i18n/ko-KR/common.ts b/web/i18n/ko-KR/common.ts index c3fe03f3ac..d517dc9346 100644 --- a/web/i18n/ko-KR/common.ts +++ b/web/i18n/ko-KR/common.ts @@ -115,6 +115,7 @@ const translation = { }, userProfile: { settings: '설정', + emailSupport: '이메일 지원', workspace: '작업 공간', createWorkspace: '작업 공간 만들기', helpCenter: '도움말 센터', diff --git a/web/i18n/pl-PL/common.ts b/web/i18n/pl-PL/common.ts index a86dfb39d2..d9916e9d38 100644 --- a/web/i18n/pl-PL/common.ts +++ b/web/i18n/pl-PL/common.ts @@ -124,6 +124,7 @@ const translation = { }, userProfile: { settings: 'Ustawienia', + emailSupport: 'Wsparcie e-mail', workspace: 'Przestrzeń robocza', createWorkspace: 'Utwórz przestrzeń roboczą', helpCenter: 'Pomoc', diff --git a/web/i18n/pt-BR/common.ts b/web/i18n/pt-BR/common.ts index 9906d4f69d..b82434d523 100644 --- a/web/i18n/pt-BR/common.ts +++ b/web/i18n/pt-BR/common.ts @@ -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', diff --git a/web/i18n/ro-RO/common.ts b/web/i18n/ro-RO/common.ts index 3af0357f09..d61fc63f5c 100644 --- a/web/i18n/ro-RO/common.ts +++ b/web/i18n/ro-RO/common.ts @@ -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', diff --git a/web/i18n/uk-UA/common.ts b/web/i18n/uk-UA/common.ts index 1d2ad45c99..ededdcb228 100644 --- a/web/i18n/uk-UA/common.ts +++ b/web/i18n/uk-UA/common.ts @@ -119,6 +119,7 @@ const translation = { }, userProfile: { settings: 'Налаштування', + emailSupport: 'Підтримка по електронній пошті', workspace: 'Робочий простір', createWorkspace: 'Створити робочий простір', helpCenter: 'Довідковий центр', diff --git a/web/i18n/vi-VN/common.ts b/web/i18n/vi-VN/common.ts index f547360b7d..ff0172fafc 100644 --- a/web/i18n/vi-VN/common.ts +++ b/web/i18n/vi-VN/common.ts @@ -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', diff --git a/web/i18n/zh-Hans/common.ts b/web/i18n/zh-Hans/common.ts index 20bdd6b02d..e0072e2cba 100644 --- a/web/i18n/zh-Hans/common.ts +++ b/web/i18n/zh-Hans/common.ts @@ -124,6 +124,7 @@ const translation = { }, userProfile: { settings: '设置', + emailSupport: '邮件支持', workspace: '工作空间', createWorkspace: '创建工作空间', helpCenter: '帮助文档', diff --git a/web/i18n/zh-Hant/common.ts b/web/i18n/zh-Hant/common.ts index eb7b80bcbe..78c34d3351 100644 --- a/web/i18n/zh-Hant/common.ts +++ b/web/i18n/zh-Hant/common.ts @@ -119,6 +119,7 @@ const translation = { }, userProfile: { settings: '設定', + emailSupport: '電子郵件支援', workspace: '工作空間', createWorkspace: '建立工作空間', helpCenter: '幫助文件',