chore: to new transation

pull/13892/head
Joel 1 year ago
parent fef2326d6e
commit 7ddb568804

@ -242,7 +242,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({
onChange={e => onDesChange(e.target.value)} onChange={e => onDesChange(e.target.value)}
placeholder={t(`${prefixSettings}.webDescPlaceholder`) as string} placeholder={t(`${prefixSettings}.webDescPlaceholder`) as string}
/> />
{isChatBot && ( {isChat && (
<div className='w-full mt-4'> <div className='w-full mt-4'>
<div className='flex justify-between items-center'> <div className='flex justify-between items-center'>
<div className={cn('system-sm-semibold text-text-secondary')}>{t('app.answerIcon.title')}</div> <div className={cn('system-sm-semibold text-text-secondary')}>{t('app.answerIcon.title')}</div>

@ -1,6 +1,6 @@
import { Fragment, useCallback } from 'react' import { Fragment, useCallback } from 'react'
import type { ElementType, ReactNode } 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' import classNames from '@/utils/classnames'
// https://headlessui.com/react/dialog // https://headlessui.com/react/dialog
@ -34,32 +34,25 @@ const CustomDialog = ({
return ( return (
<Transition appear show={show} as={Fragment}> <Transition appear show={show} as={Fragment}>
<Dialog as="div" className="relative z-40" onClose={close}> <Dialog as="div" className="relative z-40" onClose={close}>
{/* <Transition.Child <TransitionChild>
as={Fragment} <div className={classNames(
enter="ease-out duration-300" 'fixed inset-0 bg-black bg-opacity-25',
enterFrom="opacity-0" 'data-[closed]:opacity-0',
enterTo="opacity-100" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
leave="ease-in duration-200" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
leaveFrom="opacity-100" )} />
leaveTo="opacity-0" </TransitionChild>
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child> */}
{/* TODO: to new Transition */}
<div className="fixed inset-0 bg-black bg-opacity-25" />
<div className="fixed inset-0 overflow-y-auto"> <div className="fixed inset-0 overflow-y-auto">
<div className="flex items-center justify-center min-h-full"> <div className="flex items-center justify-center min-h-full">
{/* <Transition.Child <TransitionChild>
as={Fragment} <DialogPanel className={classNames(
enter="ease-out duration-300" 'w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl',
enterFrom="opacity-0 scale-95" 'data-[closed]:opacity-0 data-[closed]:scale-95',
enterTo="opacity-100 scale-100" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100 data-[enter]:scale-100',
leave="ease-in duration-200" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0 data-[enter]:scale-95',
leaveFrom="opacity-100 scale-100" className,
leaveTo="opacity-0 scale-95" )}>
>
<DialogPanel className={classNames('w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl', className)}>
{Boolean(title) && ( {Boolean(title) && (
<DialogTitle <DialogTitle
as={titleAs || 'h3'} as={titleAs || 'h3'}
@ -77,26 +70,7 @@ const CustomDialog = ({
</div> </div>
)} )}
</DialogPanel> </DialogPanel>
</Transition.Child> */} </TransitionChild>
{/* TODO: to new Transition */}
<DialogPanel className={classNames('w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl', className)}>
{Boolean(title) && (
<DialogTitle
as={titleAs || 'h3'}
className={classNames('pr-8 pb-3 title-2xl-semi-bold text-text-primary', titleClassName)}
>
{title}
</DialogTitle>
)}
<div className={classNames(bodyClassName)}>
{children}
</div>
{Boolean(footer) && (
<div className={classNames('flex items-center justify-end gap-2 px-6 pb-6 pt-3', footerClassName)}>
{footer}
</div>
)}
</DialogPanel>
</div> </div>
</div> </div>
</Dialog> </Dialog>

@ -1,6 +1,6 @@
import { Fragment, useCallback } from 'react' import { Fragment, useCallback } from 'react'
import type { ReactNode } 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' import cn from '@/utils/classnames'
type DialogProps = { type DialogProps = {
@ -22,39 +22,29 @@ const DialogWrapper = ({
return ( return (
<Transition appear show={show} as={Fragment}> <Transition appear show={show} as={Fragment}>
<Dialog as="div" className="relative z-40" onClose={close}> <Dialog as="div" className="relative z-40" onClose={close}>
{/* <Transition.Child <TransitionChild>
as={Fragment} <div className={cn(
enter="ease-out duration-300" 'fixed inset-0 bg-black bg-opacity-25',
enterFrom="opacity-0" 'data-[closed]:opacity-0',
enterTo="opacity-100" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
leave="ease-in duration-200" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
leaveFrom="opacity-100" )} />
leaveTo="opacity-0" </TransitionChild>
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child> */}
{/* TODO: to new Transition */}
<div className="fixed inset-0 bg-black bg-opacity-25" />
<div className="fixed inset-0"> <div className="fixed inset-0">
<div className={cn('flex flex-col items-end justify-center min-h-full pb-2', inWorkflow ? 'pt-[112px]' : 'pt-[64px] pr-2')}> <div className={cn('flex flex-col items-end justify-center min-h-full pb-2', inWorkflow ? 'pt-[112px]' : 'pt-[64px] pr-2')}>
{/* <Transition.Child <TransitionChild>
as={Fragment} <DialogPanel className={cn(
enter="ease-out duration-300" 'grow flex flex-col relative w-[420px] h-0 p-0 overflow-hidden text-left align-middle transition-all transform bg-components-panel-bg-alt border-components-panel-border shadow-xl',
enterFrom="opacity-0 scale-95" inWorkflow ? 'border-t-[0.5px] border-l-[0.5px] border-b-[0.5px] rounded-l-2xl' : 'border-[0.5px] rounded-2xl',
enterTo="opacity-100 scale-100" 'data-[closed]:opacity-0 data-[closed]:scale-95',
leave="ease-in duration-200" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100 data-[enter]:scale-100',
leaveFrom="opacity-100 scale-100" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0 data-[enter]:scale-95',
leaveTo="opacity-0 scale-95" className,
> )}>
<DialogPanel className={cn('grow flex flex-col relative w-[420px] h-0 p-0 overflow-hidden text-left align-middle transition-all transform bg-components-panel-bg-alt border-components-panel-border shadow-xl', inWorkflow ? 'border-t-[0.5px] border-l-[0.5px] border-b-[0.5px] rounded-l-2xl' : 'border-[0.5px] rounded-2xl', className)}>
{children} {children}
</DialogPanel> </DialogPanel>
</Transition.Child> */} </TransitionChild>
{/* TODO: to new Transition */}
<DialogPanel className={cn('grow flex flex-col relative w-[420px] h-0 p-0 overflow-hidden text-left align-middle transition-all transform bg-components-panel-bg-alt border-components-panel-border shadow-xl', inWorkflow ? 'border-t-[0.5px] border-l-[0.5px] border-b-[0.5px] rounded-l-2xl' : 'border-[0.5px] rounded-2xl', className)}>
{children}
</DialogPanel>
</div> </div>
</div> </div>
</Dialog> </Dialog>

@ -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 { RiCloseLargeLine } from '@remixicon/react'
import classNames from '@/utils/classnames' import classNames from '@/utils/classnames'
import { useEffect, useState } from 'react'
type IModal = { type IModal = {
className?: string className?: string
@ -24,59 +24,51 @@ export default function FullScreenModal({
closable = false, closable = false,
overflowVisible = false, overflowVisible = false,
}: IModal) { }: IModal) {
const [showTransition, setShowTransition] = useState(false)
useEffect(() => {
if (!open) {
setShowTransition(false)
return
}
setTimeout(() => {
setShowTransition(true)
}, 100)
}, [open])
return ( return (
<Dialog as="div" className={classNames('modal-dialog', wrapperClassName)} onClose={onClose} open={open}> <Transition appear show={open} as={Fragment}>
<Transition show={showTransition}> <Dialog as="div" className={classNames('modal-dialog', wrapperClassName)} onClose={onClose} open={open}>
<div className={classNames( <TransitionChild>
'fixed inset-0 bg-background-overlay-backdrop backdrop-blur-[6px] transition', <div className={classNames(
'data-[closed]:opacity-0', 'fixed inset-0 bg-background-overlay-backdrop backdrop-blur-[6px] transition',
'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100', 'data-[closed]:opacity-0',
'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0', 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
)} /> 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
</Transition> )} />
</TransitionChild>
<div <div
className="fixed inset-0 h-screen w-screen p-4" className="fixed inset-0 h-screen w-screen p-4"
onClick={(e) => { onClick={(e) => {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
}} }}
> >
<div className="w-full h-full bg-background-default-subtle rounded-2xl border border-effects-highlight relative"> <div className="w-full h-full bg-background-default-subtle rounded-2xl border border-effects-highlight relative">
<Transition show={showTransition}> <TransitionChild>
<DialogPanel className={classNames( <DialogPanel className={classNames(
'h-full transition', 'h-full transition',
overflowVisible ? 'overflow-visible' : 'overflow-hidden', overflowVisible ? 'overflow-visible' : 'overflow-hidden',
'data-[closed]:opacity-0', 'data-[closed]:opacity-0',
'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100', 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0', 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
className, className,
)}> )}>
{closable {closable
&& <div && <div
className='absolute z-50 top-3 right-3 w-9 h-9 flex items-center justify-center rounded-[10px] className='absolute z-50 top-3 right-3 w-9 h-9 flex items-center justify-center rounded-[10px]
bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover cursor-pointer' bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover cursor-pointer'
onClick={(e) => { onClick={(e) => {
e.stopPropagation() e.stopPropagation()
onClose() onClose()
}}> }}>
<RiCloseLargeLine className='w-3.5 h-3.5 text-components-button-tertiary-text' /> <RiCloseLargeLine className='w-3.5 h-3.5 text-components-button-tertiary-text' />
</div>} </div>}
{children} {children}
</DialogPanel> </DialogPanel>
</Transition> </TransitionChild>
</div>
</div> </div>
</div> </Dialog>
</Dialog> </Transition>
) )
} }

@ -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 { Fragment } from 'react'
import { RiCloseLine } from '@remixicon/react' import { RiCloseLine } from '@remixicon/react'
import classNames from '@/utils/classnames' import classNames from '@/utils/classnames'
@ -30,19 +30,14 @@ export default function Modal({
return ( return (
<Transition appear show={isShow} as={Fragment}> <Transition appear show={isShow} as={Fragment}>
<Dialog as="div" className={classNames('relative z-[60]', wrapperClassName)} onClose={onClose}> <Dialog as="div" className={classNames('relative z-[60]', wrapperClassName)} onClose={onClose}>
{/* <Transition.Child <TransitionChild>
as={Fragment} <div className={classNames(
enter="ease-out duration-300" 'fixed inset-0 bg-background-overlay',
enterFrom="opacity-0" 'data-[closed]:opacity-0',
enterTo="opacity-100" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
leave="ease-in duration-200" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
leaveFrom="opacity-100" )} />
leaveTo="opacity-0" </TransitionChild>
>
<div className="fixed inset-0 bg-background-overlay" />
</Transition.Child> */}
{/* TODO: to new Transition */}
<div className="fixed inset-0 bg-background-overlay" />
<div <div
className="fixed inset-0 overflow-y-auto" className="fixed inset-0 overflow-y-auto"
@ -52,18 +47,13 @@ export default function Modal({
}} }}
> >
<div className="flex min-h-full items-center justify-center p-4 text-center"> <div className="flex min-h-full items-center justify-center p-4 text-center">
{/* <Transition.Child <TransitionChild>
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<DialogPanel className={classNames( <DialogPanel className={classNames(
'w-full max-w-[480px] transform rounded-2xl bg-components-panel-bg p-6 text-left align-middle shadow-xl transition-all', 'w-full max-w-[480px] transform rounded-2xl bg-components-panel-bg p-6 text-left align-middle shadow-xl transition-all',
overflowVisible ? 'overflow-visible' : 'overflow-hidden', overflowVisible ? 'overflow-visible' : 'overflow-hidden',
'data-[closed]:opacity-0',
'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100',
'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0',
className, className,
)}> )}>
{title && <DialogTitle {title && <DialogTitle
@ -86,33 +76,7 @@ export default function Modal({
</div>} </div>}
{children} {children}
</DialogPanel> </DialogPanel>
</Transition.Child> */} </TransitionChild>
{/* TODO: to new Transition */}
<DialogPanel className={classNames(
'w-full max-w-[480px] transform rounded-2xl bg-components-panel-bg p-6 text-left align-middle shadow-xl transition-all',
overflowVisible ? 'overflow-visible' : 'overflow-hidden',
className,
)}>
{title && <DialogTitle
as="h3"
className="title-2xl-semi-bold text-text-primary"
>
{title}
</DialogTitle>}
{description && <div className='text-text-secondary body-md-regular mt-2'>
{description}
</div>}
{closable
&& <div className='absolute z-10 top-6 right-6 w-5 h-5 rounded-2xl flex items-center justify-center hover:cursor-pointer hover:bg-state-base-hover'>
<RiCloseLine className='w-4 h-4 text-text-tertiary' onClick={
(e) => {
e.stopPropagation()
onClose()
}
} />
</div>}
{children}
</DialogPanel>
</div> </div>
</div> </div>
</Dialog> </Dialog>

@ -35,22 +35,13 @@ const MenuDialog = ({
<Dialog as="div" className="relative z-[60]" onClose={() => { }}> <Dialog as="div" className="relative z-[60]" onClose={() => { }}>
<div className="fixed inset-0"> <div className="fixed inset-0">
<div className="flex flex-col items-center justify-center min-h-full"> <div className="flex flex-col items-center justify-center min-h-full">
{/* <Transition.Child <DialogPanel className={cn(
as={Fragment} 'grow relative w-full h-full p-0 overflow-hidden text-left align-middle transition-all transform bg-background-sidenav-bg backdrop-blur-md',
enter="ease-out duration-300" 'data-[closed]:opacity-0 data-[closed]:scale-95',
enterFrom="opacity-0 scale-95" 'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:opacity-100 data-[enter]:scale-100',
enterTo="opacity-100 scale-100" 'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:opacity-0 data-[enter]:scale-95',
leave="ease-in duration-200" className,
leaveFrom="opacity-100 scale-100" )}>
leaveTo="opacity-0 scale-95"
>
<DialogPanel className={cn('grow relative w-full h-full p-0 overflow-hidden text-left align-middle transition-all transform bg-background-sidenav-bg backdrop-blur-md', className)}>
<div className='absolute top-0 right-0 h-full w-1/2 bg-components-panel-bg' />
{children}
</DialogPanel>
</Transition.Child> */}
{/* TODO: to new Transition */}
<DialogPanel className={cn('grow relative w-full h-full p-0 overflow-hidden text-left align-middle transition-all transform bg-background-sidenav-bg backdrop-blur-md', className)}>
<div className='absolute top-0 right-0 h-full w-1/2 bg-components-panel-bg' /> <div className='absolute top-0 right-0 h-full w-1/2 bg-components-panel-bg' />
{children} {children}
</DialogPanel> </DialogPanel>

Loading…
Cancel
Save