mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 20:09:20 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@@ -1,30 +1,31 @@
|
||||
'use client'
|
||||
|
||||
import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { RiExternalLinkLine } from '@remixicon/react'
|
||||
import { noop } from 'lodash-es'
|
||||
import {
|
||||
useRouter,
|
||||
useSearchParams,
|
||||
} from 'next/navigation'
|
||||
import UserInfo from './user-info'
|
||||
import SearchInput from './search-input'
|
||||
import RoleSelector from './role-selector'
|
||||
import Confirm from './verify-state-modal'
|
||||
import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Button from '@/app/components/base/button'
|
||||
import Checkbox from '@/app/components/base/checkbox'
|
||||
import { useToastContext } from '@/app/components/base/toast'
|
||||
import { EDUCATION_VERIFYING_LOCALSTORAGE_ITEM } from '@/app/education-apply/constants'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import {
|
||||
useEducationAdd,
|
||||
useInvalidateEducationStatus,
|
||||
} from '@/service/use-education'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { useToastContext } from '@/app/components/base/toast'
|
||||
import { EDUCATION_VERIFYING_LOCALSTORAGE_ITEM } from '@/app/education-apply/constants'
|
||||
import { noop } from 'lodash-es'
|
||||
import DifyLogo from '../components/base/logo/dify-logo'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import RoleSelector from './role-selector'
|
||||
import SearchInput from './search-input'
|
||||
import UserInfo from './user-info'
|
||||
import Confirm from './verify-state-modal'
|
||||
|
||||
const EducationApplyAge = () => {
|
||||
const { t } = useTranslation()
|
||||
const [schoolName, setSchoolName] = useState('')
|
||||
@@ -35,7 +36,7 @@ const EducationApplyAge = () => {
|
||||
isPending,
|
||||
mutateAsync: educationAdd,
|
||||
} = useEducationAdd({ onSuccess: noop })
|
||||
const [modalShow, setShowModal] = useState<undefined | { title: string; desc: string; onConfirm?: () => void }>(undefined)
|
||||
const [modalShow, setShowModal] = useState<undefined | { title: string, desc: string, onConfirm?: () => void }>(undefined)
|
||||
const { onPlanInfoChanged } = useProviderContext()
|
||||
const updateEducationStatus = useInvalidateEducationStatus()
|
||||
const { notify } = useToastContext()
|
||||
@@ -75,8 +76,8 @@ const EducationApplyAge = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='fixed inset-0 z-[31] overflow-y-auto bg-background-body p-6'>
|
||||
<div className='mx-auto w-full max-w-[1408px] rounded-2xl border border-effects-highlight bg-background-default-subtle'>
|
||||
<div className="fixed inset-0 z-[31] overflow-y-auto bg-background-body p-6">
|
||||
<div className="mx-auto w-full max-w-[1408px] rounded-2xl border border-effects-highlight bg-background-default-subtle">
|
||||
<div
|
||||
className="h-[349px] w-full overflow-hidden rounded-t-2xl bg-cover bg-center bg-no-repeat"
|
||||
style={{
|
||||
@@ -84,23 +85,25 @@ const EducationApplyAge = () => {
|
||||
}}
|
||||
>
|
||||
</div>
|
||||
<div className='mt-[-349px] box-content flex h-7 items-center justify-between p-6'>
|
||||
<DifyLogo size='large' style='monochromeWhite' />
|
||||
<div className="mt-[-349px] box-content flex h-7 items-center justify-between p-6">
|
||||
<DifyLogo size="large" style="monochromeWhite" />
|
||||
</div>
|
||||
<div className='mx-auto max-w-[720px] px-8 pb-[180px]'>
|
||||
<div className='mb-2 flex h-[192px] flex-col justify-end pb-4 pt-3 text-text-primary-on-surface'>
|
||||
<div className='title-5xl-bold mb-2 shadow-xs'>{t('education.toVerified')}</div>
|
||||
<div className='system-md-medium shadow-xs'>
|
||||
{t('education.toVerifiedTip.front')}
|
||||
<span className='system-md-semibold underline'>{t('education.toVerifiedTip.coupon')}</span>
|
||||
<div className="mx-auto max-w-[720px] px-8 pb-[180px]">
|
||||
<div className="mb-2 flex h-[192px] flex-col justify-end pb-4 pt-3 text-text-primary-on-surface">
|
||||
<div className="title-5xl-bold mb-2 shadow-xs">{t('education.toVerified')}</div>
|
||||
<div className="system-md-medium shadow-xs">
|
||||
{t('education.toVerifiedTip.front')}
|
||||
|
||||
<span className="system-md-semibold underline">{t('education.toVerifiedTip.coupon')}</span>
|
||||
|
||||
{t('education.toVerifiedTip.end')}
|
||||
</div>
|
||||
</div>
|
||||
<div className='mb-7'>
|
||||
<div className="mb-7">
|
||||
<UserInfo />
|
||||
</div>
|
||||
<div className='mb-7'>
|
||||
<div className='system-md-semibold mb-1 flex h-6 items-center text-text-secondary'>
|
||||
<div className="mb-7">
|
||||
<div className="system-md-semibold mb-1 flex h-6 items-center text-text-secondary">
|
||||
{t('education.form.schoolName.title')}
|
||||
</div>
|
||||
<SearchInput
|
||||
@@ -108,8 +111,8 @@ const EducationApplyAge = () => {
|
||||
onChange={setSchoolName}
|
||||
/>
|
||||
</div>
|
||||
<div className='mb-7'>
|
||||
<div className='system-md-semibold mb-1 flex h-6 items-center text-text-secondary'>
|
||||
<div className="mb-7">
|
||||
<div className="system-md-semibold mb-1 flex h-6 items-center text-text-secondary">
|
||||
{t('education.form.schoolRole.title')}
|
||||
</div>
|
||||
<RoleSelector
|
||||
@@ -117,29 +120,32 @@ const EducationApplyAge = () => {
|
||||
onChange={setRole}
|
||||
/>
|
||||
</div>
|
||||
<div className='mb-7'>
|
||||
<div className='system-md-semibold mb-1 flex h-6 items-center text-text-secondary'>
|
||||
<div className="mb-7">
|
||||
<div className="system-md-semibold mb-1 flex h-6 items-center text-text-secondary">
|
||||
{t('education.form.terms.title')}
|
||||
</div>
|
||||
<div className='system-md-regular mb-1 text-text-tertiary'>
|
||||
{t('education.form.terms.desc.front')}
|
||||
<a href='https://dify.ai/terms' target='_blank' className='text-text-secondary hover:underline'>{t('education.form.terms.desc.termsOfService')}</a>
|
||||
{t('education.form.terms.desc.and')}
|
||||
<a href='https://dify.ai/privacy' target='_blank' className='text-text-secondary hover:underline'>{t('education.form.terms.desc.privacyPolicy')}</a>
|
||||
<div className="system-md-regular mb-1 text-text-tertiary">
|
||||
{t('education.form.terms.desc.front')}
|
||||
|
||||
<a href="https://dify.ai/terms" target="_blank" className="text-text-secondary hover:underline">{t('education.form.terms.desc.termsOfService')}</a>
|
||||
|
||||
{t('education.form.terms.desc.and')}
|
||||
|
||||
<a href="https://dify.ai/privacy" target="_blank" className="text-text-secondary hover:underline">{t('education.form.terms.desc.privacyPolicy')}</a>
|
||||
{t('education.form.terms.desc.end')}
|
||||
</div>
|
||||
<div className='system-md-regular py-2 text-text-primary'>
|
||||
<div className='mb-2 flex'>
|
||||
<div className="system-md-regular py-2 text-text-primary">
|
||||
<div className="mb-2 flex">
|
||||
<Checkbox
|
||||
className='mr-2 shrink-0'
|
||||
className="mr-2 shrink-0"
|
||||
checked={ageChecked}
|
||||
onCheck={() => setAgeChecked(!ageChecked)}
|
||||
/>
|
||||
{t('education.form.terms.option.age')}
|
||||
</div>
|
||||
<div className='flex'>
|
||||
<div className="flex">
|
||||
<Checkbox
|
||||
className='mr-2 shrink-0'
|
||||
className="mr-2 shrink-0"
|
||||
checked={inSchoolChecked}
|
||||
onCheck={() => setInSchoolChecked(!inSchoolChecked)}
|
||||
/>
|
||||
@@ -148,20 +154,20 @@ const EducationApplyAge = () => {
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
variant='primary'
|
||||
variant="primary"
|
||||
disabled={!ageChecked || !inSchoolChecked || !schoolName || !role || isPending}
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
{t('education.submit')}
|
||||
</Button>
|
||||
<div className='mb-4 mt-5 h-px bg-gradient-to-r from-[rgba(16,24,40,0.08)]'></div>
|
||||
<div className="mb-4 mt-5 h-px bg-gradient-to-r from-[rgba(16,24,40,0.08)]"></div>
|
||||
<a
|
||||
className='system-xs-regular flex items-center text-text-accent'
|
||||
className="system-xs-regular flex items-center text-text-accent"
|
||||
href={docLink('/getting-started/dify-for-education')}
|
||||
target='_blank'
|
||||
target="_blank"
|
||||
>
|
||||
{t('education.learn')}
|
||||
<RiExternalLinkLine className='ml-1 h-3 w-3' />
|
||||
<RiExternalLinkLine className="ml-1 h-3 w-3" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
'use client'
|
||||
import { RiExternalLinkLine } from '@remixicon/react'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Button from '@/app/components/base/button'
|
||||
import Modal from '@/app/components/base/modal'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import Link from 'next/link'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { RiExternalLinkLine } from '@remixicon/react'
|
||||
import { SparklesSoftAccent } from '../components/base/icons/src/public/common'
|
||||
import useTimestamp from '@/hooks/use-timestamp'
|
||||
import { useModalContextSelector } from '@/context/modal-context'
|
||||
import useTimestamp from '@/hooks/use-timestamp'
|
||||
import { useEducationVerify } from '@/service/use-education'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { SparklesSoftAccent } from '../components/base/icons/src/public/common'
|
||||
|
||||
export type ExpireNoticeModalPayloadProps = {
|
||||
expireAt: number
|
||||
@@ -46,45 +46,53 @@ const ExpireNoticeModal: React.FC<Props> = ({ expireAt, expired, onClose }) => {
|
||||
onClose={onClose}
|
||||
title={expired ? t(`${i18nPrefix}.expired.title`) : t(`${i18nPrefix}.isAboutToExpire.title`, { date: formatTime(expireAt, t(`${i18nPrefix}.dateFormat`) as string), interpolation: { escapeValue: false } })}
|
||||
closable
|
||||
className='max-w-[600px]'
|
||||
className="max-w-[600px]"
|
||||
>
|
||||
<div className='body-md-regular mt-5 space-y-5 text-text-secondary'>
|
||||
<div className="body-md-regular mt-5 space-y-5 text-text-secondary">
|
||||
<div>
|
||||
{expired ? (<>
|
||||
<div>{t(`${i18nPrefix}.expired.summary.line1`)}</div>
|
||||
<div>{t(`${i18nPrefix}.expired.summary.line2`)}</div>
|
||||
</>
|
||||
) : t(`${i18nPrefix}.isAboutToExpire.summary`)}
|
||||
{expired
|
||||
? (
|
||||
<>
|
||||
<div>{t(`${i18nPrefix}.expired.summary.line1`)}</div>
|
||||
<div>{t(`${i18nPrefix}.expired.summary.line2`)}</div>
|
||||
</>
|
||||
)
|
||||
: t(`${i18nPrefix}.isAboutToExpire.summary`)}
|
||||
</div>
|
||||
<div>
|
||||
<strong className='title-md-semi-bold block'>{t(`${i18nPrefix}.stillInEducation.title`)}</strong>
|
||||
<strong className="title-md-semi-bold block">{t(`${i18nPrefix}.stillInEducation.title`)}</strong>
|
||||
{t(`${i18nPrefix}.stillInEducation.${expired ? 'expired' : 'isAboutToExpire'}`)}
|
||||
</div>
|
||||
<div>
|
||||
<strong className='title-md-semi-bold block'>{t(`${i18nPrefix}.alreadyGraduated.title`)}</strong>
|
||||
<strong className="title-md-semi-bold block">{t(`${i18nPrefix}.alreadyGraduated.title`)}</strong>
|
||||
{t(`${i18nPrefix}.alreadyGraduated.${expired ? 'expired' : 'isAboutToExpire'}`)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-7 flex items-center justify-between space-x-2">
|
||||
<Link className='system-xs-regular flex items-center space-x-1 text-text-accent' href={eduDocLink} target="_blank" rel="noopener noreferrer">
|
||||
<Link className="system-xs-regular flex items-center space-x-1 text-text-accent" href={eduDocLink} target="_blank" rel="noopener noreferrer">
|
||||
<div>{t('education.learn')}</div>
|
||||
<RiExternalLinkLine className='size-3' />
|
||||
<RiExternalLinkLine className="size-3" />
|
||||
</Link>
|
||||
<div className='flex space-x-2'>
|
||||
{expired ? (
|
||||
<Button onClick={() => {
|
||||
onClose()
|
||||
setShowPricingModal()
|
||||
}} className='flex items-center space-x-1'>
|
||||
<SparklesSoftAccent className='size-4' />
|
||||
<div className='text-components-button-secondary-accent-text'>{t(`${i18nPrefix}.action.upgrade`)}</div>
|
||||
</Button>
|
||||
) : (
|
||||
<Button onClick={onClose}>
|
||||
{t(`${i18nPrefix}.action.dismiss`)}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant='primary' onClick={handleConfirm}>
|
||||
<div className="flex space-x-2">
|
||||
{expired
|
||||
? (
|
||||
<Button
|
||||
onClick={() => {
|
||||
onClose()
|
||||
setShowPricingModal()
|
||||
}}
|
||||
className="flex items-center space-x-1"
|
||||
>
|
||||
<SparklesSoftAccent className="size-4" />
|
||||
<div className="text-components-button-secondary-accent-text">{t(`${i18nPrefix}.action.upgrade`)}</div>
|
||||
</Button>
|
||||
)
|
||||
: (
|
||||
<Button onClick={onClose}>
|
||||
{t(`${i18nPrefix}.action.dismiss`)}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="primary" onClick={handleConfirm}>
|
||||
{t(`${i18nPrefix}.action.reVerify`)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
import type { SearchParams } from './types'
|
||||
import { useDebounceFn, useLocalStorageState } from 'ahooks'
|
||||
import dayjs from 'dayjs'
|
||||
import timezone from 'dayjs/plugin/timezone'
|
||||
import utc from 'dayjs/plugin/utc'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useDebounceFn, useLocalStorageState } from 'ahooks'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import type { SearchParams } from './types'
|
||||
import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useModalContextSelector } from '@/context/modal-context'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { useEducationAutocomplete, useEducationVerify } from '@/service/use-education'
|
||||
import {
|
||||
EDUCATION_PRICING_SHOW_ACTION,
|
||||
EDUCATION_RE_VERIFY_ACTION,
|
||||
EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,
|
||||
EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION,
|
||||
EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,
|
||||
} from './constants'
|
||||
import { useEducationAutocomplete, useEducationVerify } from '@/service/use-education'
|
||||
import { useModalContextSelector } from '@/context/modal-context'
|
||||
import dayjs from 'dayjs'
|
||||
import utc from 'dayjs/plugin/utc'
|
||||
import timezone from 'dayjs/plugin/timezone'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants'
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
@@ -27,12 +27,12 @@ const RoleSelector = ({
|
||||
]
|
||||
|
||||
return (
|
||||
<div className='flex'>
|
||||
<div className="flex">
|
||||
{
|
||||
options.map(option => (
|
||||
<div
|
||||
key={option.key}
|
||||
className='system-md-regular mr-6 flex h-5 cursor-pointer items-center text-text-primary'
|
||||
className="system-md-regular mr-6 flex h-5 cursor-pointer items-center text-text-primary"
|
||||
onClick={() => onChange(option.key)}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -5,13 +5,13 @@ import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useEducation } from './hooks'
|
||||
import Input from '@/app/components/base/input'
|
||||
import {
|
||||
PortalToFollowElem,
|
||||
PortalToFollowElemContent,
|
||||
PortalToFollowElemTrigger,
|
||||
} from '@/app/components/base/portal-to-follow-elem'
|
||||
import { useEducation } from './hooks'
|
||||
|
||||
type SearchInputProps = {
|
||||
value?: string
|
||||
@@ -77,30 +77,30 @@ const SearchInput = ({
|
||||
<PortalToFollowElem
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
placement='bottom'
|
||||
placement="bottom"
|
||||
offset={4}
|
||||
triggerPopupSameWidth
|
||||
>
|
||||
<PortalToFollowElemTrigger className='block w-full'>
|
||||
<PortalToFollowElemTrigger className="block w-full">
|
||||
<Input
|
||||
className='w-full'
|
||||
className="w-full"
|
||||
placeholder={t('education.form.schoolName.placeholder')}
|
||||
value={value}
|
||||
onChange={handleValueChange}
|
||||
/>
|
||||
</PortalToFollowElemTrigger>
|
||||
<PortalToFollowElemContent className='z-[32]'>
|
||||
<PortalToFollowElemContent className="z-[32]">
|
||||
{
|
||||
!!schools.length && value && (
|
||||
<div
|
||||
className='max-h-[330px] overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1'
|
||||
className="max-h-[330px] overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1"
|
||||
onScroll={handleScroll as any}
|
||||
>
|
||||
{
|
||||
schools.map((school, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className='system-md-regular flex h-8 cursor-pointer items-center truncate rounded-lg px-2 py-1.5 text-text-secondary hover:bg-state-base-hover'
|
||||
className="system-md-regular flex h-8 cursor-pointer items-center truncate rounded-lg px-2 py-1.5 text-text-secondary hover:bg-state-base-hover"
|
||||
title={school}
|
||||
onClick={() => {
|
||||
onChange(school)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Avatar from '@/app/components/base/avatar'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { Triangle } from '@/app/components/base/icons/src/public/education'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useLogout } from '@/service/use-common'
|
||||
|
||||
const UserInfo = () => {
|
||||
@@ -22,31 +22,31 @@ const UserInfo = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='relative flex items-center justify-between rounded-xl border-[4px] border-components-panel-on-panel-item-bg bg-gradient-to-r from-background-gradient-bg-fill-chat-bg-2 to-background-gradient-bg-fill-chat-bg-1 pb-6 pl-6 pr-8 pt-9 shadow-shadow-shadow-5'>
|
||||
<div className='absolute left-0 top-0 flex items-center'>
|
||||
<div className='system-2xs-semibold-uppercase flex h-[22px] items-center bg-components-panel-on-panel-item-bg pl-2 pt-1 text-text-accent-light-mode-only'>
|
||||
<div className="relative flex items-center justify-between rounded-xl border-[4px] border-components-panel-on-panel-item-bg bg-gradient-to-r from-background-gradient-bg-fill-chat-bg-2 to-background-gradient-bg-fill-chat-bg-1 pb-6 pl-6 pr-8 pt-9 shadow-shadow-shadow-5">
|
||||
<div className="absolute left-0 top-0 flex items-center">
|
||||
<div className="system-2xs-semibold-uppercase flex h-[22px] items-center bg-components-panel-on-panel-item-bg pl-2 pt-1 text-text-accent-light-mode-only">
|
||||
{t('education.currentSigned')}
|
||||
</div>
|
||||
<Triangle className='h-[22px] w-4 text-components-panel-on-panel-item-bg' />
|
||||
<Triangle className="h-[22px] w-4 text-components-panel-on-panel-item-bg" />
|
||||
</div>
|
||||
<div className='flex items-center'>
|
||||
<div className="flex items-center">
|
||||
<Avatar
|
||||
className='mr-4'
|
||||
className="mr-4"
|
||||
avatar={userProfile.avatar_url}
|
||||
name={userProfile.name}
|
||||
size={48}
|
||||
/>
|
||||
<div className='pt-1.5'>
|
||||
<div className='system-md-semibold text-text-primary'>
|
||||
<div className="pt-1.5">
|
||||
<div className="system-md-semibold text-text-primary">
|
||||
{userProfile.name}
|
||||
</div>
|
||||
<div className='system-sm-regular text-text-secondary'>
|
||||
<div className="system-sm-regular text-text-secondary">
|
||||
{userProfile.email}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
variant='secondary'
|
||||
variant="secondary"
|
||||
onClick={handleLogout}
|
||||
>
|
||||
{t('common.userProfile.logout')}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
RiExternalLinkLine,
|
||||
} from '@remixicon/react'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
@@ -77,38 +77,40 @@ function Confirm({
|
||||
return null
|
||||
|
||||
return createPortal(
|
||||
<div className={'fixed inset-0 z-[10000000] flex items-center justify-center bg-background-overlay'}
|
||||
<div
|
||||
className="fixed inset-0 z-[10000000] flex items-center justify-center bg-background-overlay"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<div ref={dialogRef} className={'relative w-full max-w-[481px] overflow-hidden'}>
|
||||
<div className='shadows-shadow-lg flex max-w-full flex-col items-start rounded-2xl border-[0.5px] border-solid border-components-panel-border bg-components-panel-bg'>
|
||||
<div className='flex flex-col items-start gap-2 self-stretch pb-4 pl-6 pr-6 pt-6'>
|
||||
<div className='title-2xl-semi-bold text-text-primary'>{title}</div>
|
||||
<div className='system-md-regular w-full text-text-tertiary'>{content}</div>
|
||||
<div ref={dialogRef} className="relative w-full max-w-[481px] overflow-hidden">
|
||||
<div className="shadows-shadow-lg flex max-w-full flex-col items-start rounded-2xl border-[0.5px] border-solid border-components-panel-border bg-components-panel-bg">
|
||||
<div className="flex flex-col items-start gap-2 self-stretch pb-4 pl-6 pr-6 pt-6">
|
||||
<div className="title-2xl-semi-bold text-text-primary">{title}</div>
|
||||
<div className="system-md-regular w-full text-text-tertiary">{content}</div>
|
||||
</div>
|
||||
{email && (
|
||||
<div className='w-full space-y-1 px-6 py-3'>
|
||||
<div className='system-sm-semibold py-1 text-text-secondary'>{t('education.emailLabel')}</div>
|
||||
<div className='system-sm-regular rounded-lg bg-components-input-bg-disabled px-3 py-2 text-components-input-text-filled-disabled'>{email}</div>
|
||||
<div className="w-full space-y-1 px-6 py-3">
|
||||
<div className="system-sm-semibold py-1 text-text-secondary">{t('education.emailLabel')}</div>
|
||||
<div className="system-sm-regular rounded-lg bg-components-input-bg-disabled px-3 py-2 text-components-input-text-filled-disabled">{email}</div>
|
||||
</div>
|
||||
)}
|
||||
<div className='flex items-center justify-between gap-2 self-stretch p-6'>
|
||||
<div className='flex items-center gap-1'>
|
||||
<div className="flex items-center justify-between gap-2 self-stretch p-6">
|
||||
<div className="flex items-center gap-1">
|
||||
{showLink && (
|
||||
<>
|
||||
<a onClick={handleClick} href={eduDocLink} target='_blank' className='system-xs-regular cursor-pointer text-text-accent'>{t('education.learn')}</a>
|
||||
<RiExternalLinkLine className='h-3 w-3 text-text-accent' />
|
||||
<a onClick={handleClick} href={eduDocLink} target="_blank" className="system-xs-regular cursor-pointer text-text-accent">{t('education.learn')}</a>
|
||||
<RiExternalLinkLine className="h-3 w-3 text-text-accent" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Button variant='primary' className='!w-20' onClick={onConfirm}>{t('common.operation.ok')}</Button>
|
||||
<Button variant="primary" className="!w-20" onClick={onConfirm}>{t('common.operation.ok')}</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>, document.body,
|
||||
</div>,
|
||||
document.body,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user