+
{footer}
)}
diff --git a/web/app/components/header/account-setting/account-page/index.module.css b/web/app/components/header/account-setting/account-page/index.module.css
deleted file mode 100644
index 949d1257e9..0000000000
--- a/web/app/components/header/account-setting/account-page/index.module.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.modal {
- padding: 24px 32px !important;
- width: 400px !important;
-}
-
-.bg {
- background: linear-gradient(180deg, rgba(217, 45, 32, 0.05) 0%, rgba(217, 45, 32, 0.00) 24.02%), #F9FAFB;
-}
-
diff --git a/web/app/components/header/account-setting/account-page/index.tsx b/web/app/components/header/account-setting/account-page/index.tsx
deleted file mode 100644
index 7b400dd50d..0000000000
--- a/web/app/components/header/account-setting/account-page/index.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-'use client'
-import { useState } from 'react'
-import { useTranslation } from 'react-i18next'
-
-import { useContext, useContextSelector } from 'use-context-selector'
-import Collapse from '../collapse'
-import type { IItem } from '../collapse'
-import s from './index.module.css'
-import classNames from '@/utils/classnames'
-import Modal from '@/app/components/base/modal'
-import Confirm from '@/app/components/base/confirm'
-import Button from '@/app/components/base/button'
-import { updateUserProfile } from '@/service/common'
-import AppContext, { useAppContext } from '@/context/app-context'
-import { ToastContext } from '@/app/components/base/toast'
-import AppIcon from '@/app/components/base/app-icon'
-import Avatar from '@/app/components/base/avatar'
-import { IS_CE_EDITION } from '@/config'
-
-const titleClassName = `
- text-sm font-medium text-gray-900
-`
-const descriptionClassName = `
- mt-1 text-xs font-normal text-gray-500
-`
-const inputClassName = `
- mt-2 w-full px-3 py-2 bg-gray-100 rounded
- text-sm font-normal text-gray-800
-`
-
-const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
-
-export default function AccountPage() {
- const { t } = useTranslation()
- const { mutateUserProfile, userProfile, apps } = useAppContext()
- const { notify } = useContext(ToastContext)
- const [editNameModalVisible, setEditNameModalVisible] = useState(false)
- const [editName, setEditName] = useState('')
- const [editing, setEditing] = useState(false)
- const [editPasswordModalVisible, setEditPasswordModalVisible] = useState(false)
- const [currentPassword, setCurrentPassword] = useState('')
- const [password, setPassword] = useState('')
- const [confirmPassword, setConfirmPassword] = useState('')
- const [showDeleteAccountModal, setShowDeleteAccountModal] = useState(false)
- const systemFeatures = useContextSelector(AppContext, state => state.systemFeatures)
-
- const handleEditName = () => {
- setEditNameModalVisible(true)
- setEditName(userProfile.name)
- }
- const handleSaveName = async () => {
- try {
- setEditing(true)
- await updateUserProfile({ url: 'account/name', body: { name: editName } })
- notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
- mutateUserProfile()
- setEditNameModalVisible(false)
- setEditing(false)
- }
- catch (e) {
- notify({ type: 'error', message: (e as Error).message })
- setEditNameModalVisible(false)
- setEditing(false)
- }
- }
-
- const showErrorMessage = (message: string) => {
- notify({
- type: 'error',
- message,
- })
- }
- const valid = () => {
- if (!password.trim()) {
- showErrorMessage(t('login.error.passwordEmpty'))
- return false
- }
- if (!validPassword.test(password)) {
- showErrorMessage(t('login.error.passwordInvalid'))
- return false
- }
- if (password !== confirmPassword) {
- showErrorMessage(t('common.account.notEqual'))
- return false
- }
-
- return true
- }
- const resetPasswordForm = () => {
- setCurrentPassword('')
- setPassword('')
- setConfirmPassword('')
- }
- const handleSavePassword = async () => {
- if (!valid())
- return
- try {
- setEditing(true)
- await updateUserProfile({
- url: 'account/password',
- body: {
- password: currentPassword,
- new_password: password,
- repeat_new_password: confirmPassword,
- },
- })
- notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
- mutateUserProfile()
- setEditPasswordModalVisible(false)
- resetPasswordForm()
- setEditing(false)
- }
- catch (e) {
- notify({ type: 'error', message: (e as Error).message })
- setEditPasswordModalVisible(false)
- setEditing(false)
- }
- }
-
- const renderAppItem = (item: IItem) => {
- return (
-
- )
- }
-
- return (
- <>
-
-
{t('common.account.avatar')}
-
-
-
-
{t('common.account.name')}
-
- {userProfile.name}
-
{t('common.operation.edit')}
-
-
-
-
{t('common.account.email')}
-
{userProfile.email}
-
- {systemFeatures.enable_email_password_login && (
-
-
{t('common.account.password')}
-
{t('common.account.passwordTip')}
-
-
- )}
-
-
-
{t('common.account.langGeniusAccount')}
-
{t('common.account.langGeniusAccountTip')}
- {!!apps.length && (
-
({ key: app.id, name: app.name }))}
- renderItem={renderAppItem}
- wrapperClassName='mt-2'
- />
- )}
- {!IS_CE_EDITION && }
-
- {editNameModalVisible && (
-
setEditNameModalVisible(false)}
- className={s.modal}
- >
- {t('common.account.editName')}
- {t('common.account.name')}
- setEditName(e.target.value)}
- />
-
-
-
-
-
- )}
- {editPasswordModalVisible && (
-
{
- setEditPasswordModalVisible(false)
- resetPasswordForm()
- }}
- className={s.modal}
- >
- {userProfile.is_password_set ? t('common.account.resetPassword') : t('common.account.setPassword')}
- {userProfile.is_password_set && (
- <>
- {t('common.account.currentPassword')}
- setCurrentPassword(e.target.value)}
- />
- >
- )}
-
- {userProfile.is_password_set ? t('common.account.newPassword') : t('common.account.password')}
-
- setPassword(e.target.value)}
- />
- {t('common.account.confirmPassword')}
- setConfirmPassword(e.target.value)}
- />
-
-
-
-
-
- )}
- {showDeleteAccountModal && (
-
setShowDeleteAccountModal(false)}
- onConfirm={() => setShowDeleteAccountModal(false)}
- showCancel={false}
- type='warning'
- title={t('common.account.delete')}
- content={
- <>
-
- {t('common.account.deleteTip')}
-
-
- {`${t('common.account.delete')}: ${userProfile.email}`}
- >
- }
- confirmText={t('common.operation.ok') as string}
- />
- )}
- >
- )
-}
diff --git a/web/app/layout.tsx b/web/app/layout.tsx
index 9c4f8ba16d..46e4f39075 100644
--- a/web/app/layout.tsx
+++ b/web/app/layout.tsx
@@ -3,6 +3,7 @@ import I18nServer from './components/i18n-server'
import BrowserInitor from './components/browser-initor'
import SentryInitor from './components/sentry-initor'
import { getLocaleOnServer } from '@/i18n/server'
+import { TanstackQueryIniter } from '@/context/query-client'
import './styles/globals.css'
import './styles/markdown.scss'
@@ -46,7 +47,9 @@ const LocaleLayout = ({
>
- {children}
+
+ {children}
+