From 087a106fbe6f7e8184accee80d6eec85f231a4da Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Feb 2025 14:35:25 +0800 Subject: [PATCH 1/4] chore: listoptions active --- .../text-to-speech/param-config-content.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx index 94775172c4..a425ee84b9 100644 --- a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx +++ b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx @@ -116,10 +116,7 @@ const VoiceParamConfig = ({ {languages.map((item: Item) => ( - `relative cursor-pointer select-none py-2 pl-3 pr-9 rounded-lg hover:bg-gray-100 text-gray-700 ${active ? 'bg-gray-100' : '' - }` - } + className='relative cursor-pointer select-none py-2 pl-3 pr-9 rounded-lg hover:bg-gray-100 text-gray-700 data-[active]:bg-gray-100' value={item} disabled={false} > @@ -183,10 +180,7 @@ const VoiceParamConfig = ({ {voiceItems?.map((item: Item) => ( - `relative cursor-pointer select-none py-2 pl-3 pr-9 rounded-lg hover:bg-gray-100 text-gray-700 ${active ? 'bg-gray-100' : '' - }` - } + className='relative cursor-pointer select-none py-2 pl-3 pr-9 rounded-lg hover:bg-gray-100 text-gray-700 data-[active]:bg-gray-100' value={item} disabled={false} > From a7575e6a413747336c8f499c2062924bd1ce47a4 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Feb 2025 15:05:56 +0800 Subject: [PATCH 2/4] fix: deprecated active --- web/app/components/base/select/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/base/select/index.tsx b/web/app/components/base/select/index.tsx index 6a99fd3f76..be74d92c3f 100644 --- a/web/app/components/base/select/index.tsx +++ b/web/app/components/base/select/index.tsx @@ -249,7 +249,7 @@ const SimpleSelect: FC = ({ {items.map((item: Item) => ( + className={ classNames( 'relative cursor-pointer select-none py-2 pl-3 pr-9 rounded-lg hover:bg-state-base-hover text-text-secondary', optionClassName, From fef2326d6e69e340591b97e43fa0bf2f71ef6fe6 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Feb 2025 17:30:46 +0800 Subject: [PATCH 3/4] fix: transation new --- .../app/create-app-dialog/newAppDialog.tsx | 63 ------------- .../base/fullscreen-modal/index.tsx | 92 ++++++++----------- 2 files changed, 36 insertions(+), 119 deletions(-) delete mode 100644 web/app/components/app/create-app-dialog/newAppDialog.tsx diff --git a/web/app/components/app/create-app-dialog/newAppDialog.tsx b/web/app/components/app/create-app-dialog/newAppDialog.tsx deleted file mode 100644 index 33e7d779f5..0000000000 --- a/web/app/components/app/create-app-dialog/newAppDialog.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Fragment, useCallback } from 'react' -import type { ReactNode } from 'react' -import { Dialog, DialogPanel, Transition } from '@headlessui/react' -import cn from '@/utils/classnames' - -type DialogProps = { - className?: string - children: ReactNode - show: boolean - onClose?: () => void -} - -const NewAppDialog = ({ - className, - children, - show, - onClose, -}: DialogProps) => { - const close = useCallback(() => onClose?.(), [onClose]) - return ( - - - {/* -
- */} - {/* TODO: to new Transition */} -
- -
-
- {/* - - {children} - - */} - {/* TODO: to new Transition */} - - {children} - -
-
-
-
- ) -} - -export default NewAppDialog diff --git a/web/app/components/base/fullscreen-modal/index.tsx b/web/app/components/base/fullscreen-modal/index.tsx index 9a76dfa62b..f53ebc5b29 100644 --- a/web/app/components/base/fullscreen-modal/index.tsx +++ b/web/app/components/base/fullscreen-modal/index.tsx @@ -1,7 +1,7 @@ import { Dialog, DialogPanel, Transition } from '@headlessui/react' -import { Fragment } from 'react' import { RiCloseLargeLine } from '@remixicon/react' import classNames from '@/utils/classnames' +import { useEffect, useState } from 'react' type IModal = { className?: string @@ -24,62 +24,42 @@ export default function FullScreenModal({ closable = false, overflowVisible = false, }: IModal) { + const [showTransition, setShowTransition] = useState(false) + useEffect(() => { + if (!open) { + setShowTransition(false) + return + } + setTimeout(() => { + setShowTransition(true) + }, 100) + }, [open]) return ( - - - {/* -
- */} - {/* TODO: to new Transition */} -
+ + +
+ -
{ - e.preventDefault() - e.stopPropagation() - }} - > -
- {/* - - {closable - &&
{ - e.stopPropagation() - onClose() - }}> - -
} - {children} -
-
*/} - {/* TODO: to new Transition */} +
{ + e.preventDefault() + e.stopPropagation() + }} + > +
+ {closable @@ -94,9 +74,9 @@ export default function FullScreenModal({
} {children} -
+
-
- +
+
) } From 7ddb56880404d0db97bfc788cdbffcdb011ae7ca Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Feb 2025 18:06:55 +0800 Subject: [PATCH 4/4] chore: to new transation --- .../app/overview/settings/index.tsx | 2 +- web/app/components/base/dialog/index.tsx | 62 ++++-------- .../new-feature-panel/dialog-wrapper.tsx | 48 ++++------ .../base/fullscreen-modal/index.tsx | 96 +++++++++---------- web/app/components/base/modal/index.tsx | 64 +++---------- .../header/account-setting/menu-dialog.tsx | 23 ++--- 6 files changed, 103 insertions(+), 192 deletions(-) diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index 2487cd8685..5ec91f0e1d 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -242,7 +242,7 @@ const SettingsModal: FC = ({ onChange={e => onDesChange(e.target.value)} placeholder={t(`${prefixSettings}.webDescPlaceholder`) as string} /> - {isChatBot && ( + {isChat && (
{t('app.answerIcon.title')}
diff --git a/web/app/components/base/dialog/index.tsx b/web/app/components/base/dialog/index.tsx index 6554ef9009..829d3f0c04 100644 --- a/web/app/components/base/dialog/index.tsx +++ b/web/app/components/base/dialog/index.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback } from 'react' import type { ElementType, ReactNode } from 'react' -import { Dialog, DialogPanel, DialogTitle, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react' import classNames from '@/utils/classnames' // https://headlessui.com/react/dialog @@ -34,32 +34,25 @@ const CustomDialog = ({ return ( - {/* -
- */} - {/* TODO: to new Transition */} -
+ +
+
- {/* - + + {Boolean(title) && ( )} - */} - {/* TODO: to new Transition */} - - {Boolean(title) && ( - - {title} - - )} -
- {children} -
- {Boolean(footer) && ( -
- {footer} -
- )} -
+
diff --git a/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx b/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx index c61a325858..e6dc4e2139 100644 --- a/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx +++ b/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback } from 'react' import type { ReactNode } from 'react' -import { Dialog, DialogPanel, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react' import cn from '@/utils/classnames' type DialogProps = { @@ -22,39 +22,29 @@ const DialogWrapper = ({ return ( - {/* -
- */} - {/* TODO: to new Transition */} -
+ +
+
- {/* - + + {children} - */} - {/* TODO: to new Transition */} - - {children} - +
diff --git a/web/app/components/base/fullscreen-modal/index.tsx b/web/app/components/base/fullscreen-modal/index.tsx index f53ebc5b29..9d99e280ec 100644 --- a/web/app/components/base/fullscreen-modal/index.tsx +++ b/web/app/components/base/fullscreen-modal/index.tsx @@ -1,7 +1,7 @@ -import { Dialog, DialogPanel, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react' +import { Fragment } from 'react' import { RiCloseLargeLine } from '@remixicon/react' import classNames from '@/utils/classnames' -import { useEffect, useState } from 'react' type IModal = { className?: string @@ -24,59 +24,51 @@ export default function FullScreenModal({ closable = false, overflowVisible = false, }: IModal) { - const [showTransition, setShowTransition] = useState(false) - useEffect(() => { - if (!open) { - setShowTransition(false) - return - } - setTimeout(() => { - setShowTransition(true) - }, 100) - }, [open]) return ( - - -
- + + + +
+ -
{ - e.preventDefault() - e.stopPropagation() - }} - > -
- - - {closable - &&
+ {closable + &&
{ - e.stopPropagation() - onClose() - }}> - -
} - {children} - - + onClick={(e) => { + e.stopPropagation() + onClose() + }}> + +
} + {children} +
+ +
-
-
+
+
) } diff --git a/web/app/components/base/modal/index.tsx b/web/app/components/base/modal/index.tsx index 4d586add57..04bc11b2c8 100644 --- a/web/app/components/base/modal/index.tsx +++ b/web/app/components/base/modal/index.tsx @@ -1,4 +1,4 @@ -import { Dialog, DialogPanel, DialogTitle, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react' import { Fragment } from 'react' import { RiCloseLine } from '@remixicon/react' import classNames from '@/utils/classnames' @@ -30,19 +30,14 @@ export default function Modal({ return ( - {/* -
- */} - {/* TODO: to new Transition */} -
+ +
+
- {/* + {title && } {children} - */} - {/* TODO: to new Transition */} - - {title && - {title} - } - {description &&
- {description} -
} - {closable - &&
- { - e.stopPropagation() - onClose() - } - } /> -
} - {children} -
+
diff --git a/web/app/components/header/account-setting/menu-dialog.tsx b/web/app/components/header/account-setting/menu-dialog.tsx index c6e1fd8ba8..c1d0c46d4d 100644 --- a/web/app/components/header/account-setting/menu-dialog.tsx +++ b/web/app/components/header/account-setting/menu-dialog.tsx @@ -35,22 +35,13 @@ const MenuDialog = ({ { }}>
- {/* - -
- {children} - - */} - {/* TODO: to new Transition */} - +
{children}