fix: doc links (#763)

This commit is contained in:
Matri 2023-08-07 10:50:45 +08:00 committed by GitHub
parent 8ae1eb0ebb
commit f914eb95eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 9 deletions

View File

@ -1,5 +1,6 @@
'use client'
import { useState } from 'react'
import { useContext } from 'use-context-selector'
import { useTranslation } from 'react-i18next'
import useSWR from 'swr'
import { useSearchParams } from 'next/navigation'
@ -15,11 +16,13 @@ import { languageMaps, languages } from '@/utils/language'
import { activateMember, invitationCheck } from '@/service/common'
import Toast from '@/app/components/base/toast'
import Loading from '@/app/components/base/loading'
import I18n from '@/context/i18n'
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
const ActivateForm = () => {
const { t } = useTranslation()
const { locale } = useContext(I18n)
const searchParams = useSearchParams()
const workspaceID = searchParams.get('workspace_id')
const email = searchParams.get('email')
@ -202,7 +205,7 @@ const ActivateForm = () => {
<Link
className='text-primary-600'
target={'_blank'}
href='https://docs.dify.ai/community/open-source'
href={`https://docs.dify.ai/${locale === 'en' ? '' : `v/${locale.toLowerCase()}`}/community/open-source`}
>{t('login.license.link')}</Link>
</div>
</div>

View File

@ -94,7 +94,7 @@ const CustomizeModal: FC<IShareLinkProps> = ({
<p className='mt-2 text-base font-medium text-gray-800'>{t(`${prefixCustomize}.way2.name`)}</p>
<Button
className='w-36 mt-2'
onClick={() => window.open(`https://docs.dify.ai/${locale.toLowerCase()}/application/developing-with-apis`, '_blank')}
onClick={() => window.open(`https://docs.dify.ai/${locale === 'en' ? '' : `v/${locale.toLowerCase()}`}/application/developing-with-apis`, '_blank')}
>
<span className='text-sm text-gray-800'>{t(`${prefixCustomize}.way2.operation`)}</span>
<ArrowTopRightOnSquareIcon className='w-4 h-4 ml-1 text-gray-800 shrink-0' />

View File

@ -2,12 +2,14 @@
import { useTranslation } from 'react-i18next'
import classNames from 'classnames'
import Link from 'next/link'
import { useContext } from 'use-context-selector'
import s from './index.module.css'
import Modal from '@/app/components/base/modal'
import { XClose } from '@/app/components/base/icons/src/vender/line/general'
import { Dify } from '@/app/components/base/icons/src/public/common'
import type { LangGeniusVersionResponse } from '@/models/common'
import { IS_CE_EDITION } from '@/config'
import I18n from '@/context/i18n'
type IAccountSettingProps = {
langeniusVersionInfo: LangGeniusVersionResponse
@ -22,6 +24,7 @@ export default function AccountAbout({
onCancel,
}: IAccountSettingProps) {
const { t } = useTranslation()
const { locale } = useContext(I18n)
const isLatest = langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version
return (
@ -48,8 +51,8 @@ export default function AccountAbout({
IS_CE_EDITION
? <Link href={'https://github.com/langgenius/dify/blob/main/LICENSE'} target='_blank'>Open Source License</Link>
: <>
<Link href={'https://docs.dify.ai/user-agreement/privacy-policy'} target='_blank'>Privacy Policy</Link>,
<Link href={'https://docs.dify.ai/user-agreement/terms-of-service'} target='_blank'>Terms of Service</Link>
<Link href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/privacy-policy' : 'https://docs.dify.ai/v/zh-hans/yong-hu-xie-yi/yin-si-xie-yi'} target='_blank'>Privacy Policy</Link>,
<Link href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/terms-of-service' : 'https://docs.dify.ai/v/zh-hans/yong-hu-xie-yi/fu-wu-xie-yi'} target='_blank'>Terms of Service</Link>
</>
}
</div>

View File

@ -97,7 +97,7 @@ export default function AppSelector() {
<Link
className={classNames(itemClassName, 'group justify-between')}
href={
locale === 'zh-Hans' ? 'https://docs.dify.ai/v/zh-hans/' : 'https://docs.dify.ai/'
locale === 'en' ? 'https://docs.dify.ai/' : `https://docs.dify.ai/v/${locale.toLowerCase()}/`
}
target='_blank'>
<div>{t('common.userProfile.helpCenter')}</div>

View File

@ -3,15 +3,18 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import { useContext } from 'use-context-selector'
import Toast from '../components/base/toast'
import Button from '@/app/components/base/button'
import { setup } from '@/service/common'
import I18n from '@/context/i18n'
const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
const InstallForm = () => {
const { t } = useTranslation()
const { locale } = useContext(I18n)
const router = useRouter()
const [email, setEmail] = React.useState('')
@ -149,7 +152,7 @@ const InstallForm = () => {
<Link
className='text-primary-600'
target={'_blank'}
href='https://docs.dify.ai/community/open-source'
href={`https://docs.dify.ai/${locale === 'en' ? '' : `v/${locale.toLowerCase()}/`}community/open-source`}
>{t('login.license.link')}</Link>
</div>
</div>

View File

@ -5,12 +5,14 @@ import { useRouter } from 'next/navigation'
import classNames from 'classnames'
import useSWR from 'swr'
import Link from 'next/link'
import { useContext } from 'use-context-selector'
import Toast from '../components/base/toast'
import style from './page.module.css'
// import Tooltip from '@/app/components/base/tooltip/index'
import { IS_CE_EDITION, apiPrefix } from '@/config'
import Button from '@/app/components/base/button'
import { login, oauth } from '@/service/common'
import I18n from '@/context/i18n'
const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
@ -60,6 +62,7 @@ function reducer(state: IState, action: { type: string; payload: any }) {
const NormalForm = () => {
const { t } = useTranslation()
const router = useRouter()
const { locale } = useContext(I18n)
const [state, dispatch] = useReducer(reducer, {
formValid: false,
@ -269,13 +272,13 @@ const NormalForm = () => {
<Link
className='text-primary-600'
target={'_blank'}
href='https://docs.dify.ai/user-agreement/terms-of-service'
href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/terms-of-service' : 'https://docs.dify.ai/v/zh-hans/yong-hu-xie-yi/fu-wu-xie-yi'}
>{t('login.tos')}</Link>
&nbsp;&&nbsp;
<Link
className='text-primary-600'
target={'_blank'}
href='https://docs.dify.ai/user-agreement/privacy-policy'
href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/privacy-policy' : 'https://docs.dify.ai/v/zh-hans/yong-hu-xie-yi/yin-si-xie-yi'}
>{t('login.pp')}</Link>
</div>

View File

@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
import Link from 'next/link'
import useSWR from 'swr'
import { useRouter } from 'next/navigation'
import { useContext } from 'use-context-selector'
import Button from '@/app/components/base/button'
import Tooltip from '@/app/components/base/tooltip/index'
@ -12,6 +13,7 @@ import { timezones } from '@/utils/timezone'
import { languageMaps, languages } from '@/utils/language'
import { oneMoreStep } from '@/service/common'
import Toast from '@/app/components/base/toast'
import I18n from '@/context/i18n'
type IState = {
formState: 'processing' | 'error' | 'success' | 'initial'
@ -45,6 +47,7 @@ const reducer = (state: IState, action: any) => {
const OneMoreStep = () => {
const { t } = useTranslation()
const router = useRouter()
const { locale } = useContext(I18n)
const [state, dispatch] = useReducer(reducer, {
formState: 'initial',
@ -158,7 +161,7 @@ const OneMoreStep = () => {
<Link
className='text-primary-600'
target={'_blank'}
href='https://docs.dify.ai/community/open-source'
href={`https://docs.dify.ai/${locale === 'en' ? '' : `v/${locale.toLowerCase()}`}/community/open-source`}
>{t('login.license.link')}</Link>
</div>
</div>