From 8ef4ec12b7b487e35d1e1b691ff385c97e069857 Mon Sep 17 00:00:00 2001 From: jZonG Date: Tue, 1 Apr 2025 13:44:23 +0800 Subject: [PATCH] fix: link of education doc --- .../education-apply/education-apply-page.tsx | 13 ++++++++++++- web/app/education-apply/verify-state-modal.tsx | 18 ++++++++++++++++-- web/i18n/en-US/education.ts | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/web/app/education-apply/education-apply-page.tsx b/web/app/education-apply/education-apply-page.tsx index 5072e241ff..8d822f2ab0 100644 --- a/web/app/education-apply/education-apply-page.tsx +++ b/web/app/education-apply/education-apply-page.tsx @@ -1,6 +1,7 @@ 'use client' import { + useMemo, useState, } from 'react' import { useTranslation } from 'react-i18next' @@ -22,9 +23,11 @@ import { import { useProviderContext } from '@/context/provider-context' import { useToastContext } from '@/app/components/base/toast' import { EDUCATION_VERIFYING_LOCALSTORAGE_ITEM } from '@/app/education-apply/constants' +import { getLocaleOnClient } from '@/i18n' const EducationApplyAge = () => { const { t } = useTranslation() + const locale = getLocaleOnClient() const [schoolName, setSchoolName] = useState('') const [role, setRole] = useState('Student') const [ageChecked, setAgeChecked] = useState(false) @@ -39,6 +42,14 @@ const EducationApplyAge = () => { const { notify } = useToastContext() const router = useRouter() + const docLink = useMemo(() => { + if (locale === 'zh-Hans') + return 'https://docs.dify.ai/zh-hans/getting-started/dify-for-education' + if (locale === 'ja-JP') + return 'https://docs.dify.ai/ja-jp/getting-started/dify-for-education' + return 'https://docs.dify.ai/getting-started/dify-for-education' + }, [locale]) + const handleModalConfirm = () => { setShowModal(undefined) onPlanInfoChanged() @@ -158,7 +169,7 @@ const EducationApplyAge = () => {
{t('education.learn')} diff --git a/web/app/education-apply/verify-state-modal.tsx b/web/app/education-apply/verify-state-modal.tsx index c20f05797b..aace6a3bb1 100644 --- a/web/app/education-apply/verify-state-modal.tsx +++ b/web/app/education-apply/verify-state-modal.tsx @@ -1,10 +1,11 @@ -import React, { useEffect, useRef, useState } from 'react' +import React, { useEffect, useMemo, useRef, useState } from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import { RiExternalLinkLine, } from '@remixicon/react' import Button from '@/app/components/base/button' +import { getLocaleOnClient } from '@/i18n' export type IConfirm = { className?: string @@ -29,9 +30,22 @@ function Confirm({ email, }: IConfirm) { const { t } = useTranslation() + const locale = getLocaleOnClient() const dialogRef = useRef(null) const [isVisible, setIsVisible] = useState(isShow) + const docLink = useMemo(() => { + if (locale === 'zh-Hans') + return 'https://docs.dify.ai/zh-hans/getting-started/dify-for-education' + if (locale === 'ja-JP') + return 'https://docs.dify.ai/ja-jp/getting-started/dify-for-education' + return 'https://docs.dify.ai/getting-started/dify-for-education' + }, [locale]) + + const handleClick = () => { + window.open(docLink, '_blank', 'noopener,noreferrer') + } + useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') @@ -92,7 +106,7 @@ function Confirm({
{showLink && ( <> - {t('education.learn')} + {t('education.learn')} )} diff --git a/web/i18n/en-US/education.ts b/web/i18n/en-US/education.ts index 5b0d1d1745..b3a13612ed 100644 --- a/web/i18n/en-US/education.ts +++ b/web/i18n/en-US/education.ts @@ -39,7 +39,7 @@ const translation = { learn: 'Learn how to get education verified', successTitle: 'You Have Got Dify Education Verified', successContent: 'We have issued a 50% discount coupon for the Dify Professional plan to your account. The coupon is valid for one year, please use it within the validity period.', - rejectTitle: 'Your Dify Education Verified Has Been Rejected', + rejectTitle: 'Your Dify Educational Verification Has Been Rejected', rejectContent: 'Unfortunately, you are not eligible for Education Verified status and therefore cannot receive the exclusive 50% coupon for the Dify Professional Plan if you use this email address.', emailLabel: 'Your current email', }