mirror of
https://github.com/langgenius/dify.git
synced 2026-03-03 05:55:18 +00:00
Compare commits
4 Commits
feat/evalu
...
refactor/b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa5a22991b | ||
|
|
4928917878 | ||
|
|
b00afff61e | ||
|
|
691248f477 |
@@ -77,11 +77,11 @@ const Toast = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={cn('flex grow flex-col items-start gap-1 py-1', size === 'md' ? 'px-1' : 'px-0.5')}>
|
<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="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}
|
{customComponent}
|
||||||
</div>
|
</div>
|
||||||
{!!children && (
|
{!!children && (
|
||||||
<div className="system-xs-regular text-text-secondary">
|
<div className="text-text-secondary system-xs-regular">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -149,25 +149,26 @@ Toast.notify = ({
|
|||||||
if (typeof window === 'object') {
|
if (typeof window === 'object') {
|
||||||
const holder = document.createElement('div')
|
const holder = document.createElement('div')
|
||||||
const root = createRoot(holder)
|
const root = createRoot(holder)
|
||||||
|
let timerId: ReturnType<typeof setTimeout> | undefined
|
||||||
|
|
||||||
toastHandler.clear = () => {
|
const unmountAndRemove = () => {
|
||||||
if (holder) {
|
if (timerId) {
|
||||||
|
clearTimeout(timerId)
|
||||||
|
timerId = undefined
|
||||||
|
}
|
||||||
|
if (typeof window !== 'undefined' && holder) {
|
||||||
root.unmount()
|
root.unmount()
|
||||||
holder.remove()
|
holder.remove()
|
||||||
}
|
}
|
||||||
onClose?.()
|
onClose?.()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toastHandler.clear = unmountAndRemove
|
||||||
|
|
||||||
root.render(
|
root.render(
|
||||||
<ToastContext.Provider value={{
|
<ToastContext.Provider value={{
|
||||||
notify: noop,
|
notify: noop,
|
||||||
close: () => {
|
close: unmountAndRemove,
|
||||||
if (holder) {
|
|
||||||
root.unmount()
|
|
||||||
holder.remove()
|
|
||||||
}
|
|
||||||
onClose?.()
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Toast type={type} size={size} message={message} duration={duration} className={className} customComponent={customComponent} />
|
<Toast type={type} size={size} message={message} duration={duration} className={className} customComponent={customComponent} />
|
||||||
@@ -176,7 +177,7 @@ Toast.notify = ({
|
|||||||
document.body.appendChild(holder)
|
document.body.appendChild(holder)
|
||||||
const d = duration ?? defaultDuring
|
const d = duration ?? defaultDuring
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
setTimeout(toastHandler.clear, d)
|
timerId = setTimeout(unmountAndRemove, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
return toastHandler
|
return toastHandler
|
||||||
|
|||||||
@@ -1856,11 +1856,6 @@
|
|||||||
"count": 4
|
"count": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app/components/base/file-uploader/utils.spec.ts": {
|
|
||||||
"ts/no-explicit-any": {
|
|
||||||
"count": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"app/components/base/file-uploader/utils.ts": {
|
"app/components/base/file-uploader/utils.ts": {
|
||||||
"ts/no-explicit-any": {
|
"ts/no-explicit-any": {
|
||||||
"count": 3
|
"count": 3
|
||||||
@@ -2033,11 +2028,6 @@
|
|||||||
"count": 1
|
"count": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app/components/base/input/index.spec.tsx": {
|
|
||||||
"ts/no-explicit-any": {
|
|
||||||
"count": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"app/components/base/input/index.stories.tsx": {
|
"app/components/base/input/index.stories.tsx": {
|
||||||
"no-console": {
|
"no-console": {
|
||||||
"count": 2
|
"count": 2
|
||||||
@@ -2590,9 +2580,6 @@
|
|||||||
"app/components/base/toast/index.tsx": {
|
"app/components/base/toast/index.tsx": {
|
||||||
"react-refresh/only-export-components": {
|
"react-refresh/only-export-components": {
|
||||||
"count": 2
|
"count": 2
|
||||||
},
|
|
||||||
"tailwindcss/enforce-consistent-class-order": {
|
|
||||||
"count": 2
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app/components/base/tooltip/index.tsx": {
|
"app/components/base/tooltip/index.tsx": {
|
||||||
@@ -2618,11 +2605,6 @@
|
|||||||
"count": 4
|
"count": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app/components/base/with-input-validation/index.spec.tsx": {
|
|
||||||
"ts/no-explicit-any": {
|
|
||||||
"count": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"app/components/base/with-input-validation/index.stories.tsx": {
|
"app/components/base/with-input-validation/index.stories.tsx": {
|
||||||
"no-console": {
|
"no-console": {
|
||||||
"count": 1
|
"count": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user