fix: link of education doc

This commit is contained in:
jZonG 2025-04-01 13:44:23 +08:00
parent 044504cf98
commit 8ef4ec12b7
3 changed files with 29 additions and 4 deletions

View File

@ -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 = () => {
<div className='mb-4 mt-5 h-[1px] bg-gradient-to-r from-[rgba(16,24,40,0.08)]'></div>
<a
className='system-xs-regular flex items-center text-text-accent'
href='https://docs.dify.ai/getting-started/dify-for-education'
href={docLink}
target='_blank'
>
{t('education.learn')}

View File

@ -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<HTMLDivElement>(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({
<div className='flex items-center gap-1'>
{showLink && (
<>
<a href='' className='system-xs-regular cursor-pointer text-text-accent'>{t('education.learn')}</a>
<a onClick={handleClick} href={docLink} target='_blank' className='system-xs-regular cursor-pointer text-text-accent'>{t('education.learn')}</a>
<RiExternalLinkLine className='h-3 w-3 text-text-accent' />
</>
)}

View File

@ -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',
}