mirror of
https://github.com/langgenius/dify.git
synced 2026-03-03 14:05:11 +00:00
Compare commits
5 Commits
fix/accoun
...
refactor/b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed9623647e | ||
|
|
aa5a22991b | ||
|
|
4928917878 | ||
|
|
b00afff61e | ||
|
|
691248f477 |
@@ -77,11 +77,11 @@ const Toast = ({
|
||||
</div>
|
||||
<div className={cn('flex grow flex-col items-start gap-1 py-1', size === 'md' ? 'px-1' : 'px-0.5')}>
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="system-sm-semibold text-text-primary [word-break:break-word]">{message}</div>
|
||||
<div className="text-text-primary system-sm-semibold [word-break:break-word]">{message}</div>
|
||||
{customComponent}
|
||||
</div>
|
||||
{!!children && (
|
||||
<div className="system-xs-regular text-text-secondary">
|
||||
<div className="text-text-secondary system-xs-regular">
|
||||
{children}
|
||||
</div>
|
||||
)}
|
||||
@@ -149,25 +149,26 @@ Toast.notify = ({
|
||||
if (typeof window === 'object') {
|
||||
const holder = document.createElement('div')
|
||||
const root = createRoot(holder)
|
||||
let timerId: ReturnType<typeof setTimeout> | undefined
|
||||
|
||||
toastHandler.clear = () => {
|
||||
if (holder) {
|
||||
const unmountAndRemove = () => {
|
||||
if (timerId) {
|
||||
clearTimeout(timerId)
|
||||
timerId = undefined
|
||||
}
|
||||
if (typeof window !== 'undefined' && holder) {
|
||||
root.unmount()
|
||||
holder.remove()
|
||||
}
|
||||
onClose?.()
|
||||
}
|
||||
|
||||
toastHandler.clear = unmountAndRemove
|
||||
|
||||
root.render(
|
||||
<ToastContext.Provider value={{
|
||||
notify: noop,
|
||||
close: () => {
|
||||
if (holder) {
|
||||
root.unmount()
|
||||
holder.remove()
|
||||
}
|
||||
onClose?.()
|
||||
},
|
||||
close: unmountAndRemove,
|
||||
}}
|
||||
>
|
||||
<Toast type={type} size={size} message={message} duration={duration} className={className} customComponent={customComponent} />
|
||||
@@ -176,7 +177,7 @@ Toast.notify = ({
|
||||
document.body.appendChild(holder)
|
||||
const d = duration ?? defaultDuring
|
||||
if (d > 0)
|
||||
setTimeout(toastHandler.clear, d)
|
||||
timerId = setTimeout(unmountAndRemove, d)
|
||||
}
|
||||
|
||||
return toastHandler
|
||||
|
||||
@@ -2516,9 +2516,6 @@
|
||||
"app/components/base/toast/index.tsx": {
|
||||
"react-refresh/only-export-components": {
|
||||
"count": 2
|
||||
},
|
||||
"tailwindcss/enforce-consistent-class-order": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"app/components/base/tooltip/index.tsx": {
|
||||
|
||||
Reference in New Issue
Block a user