mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins
This commit is contained in:
@ -3,7 +3,6 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import {
|
||||
createContext,
|
||||
@ -12,14 +11,10 @@ import {
|
||||
|
||||
export type PluginPageContextValue = {
|
||||
containerRef: React.RefObject<HTMLDivElement>
|
||||
scrollDisabled: boolean
|
||||
setScrollDisabled: (scrollDisabled: boolean) => void
|
||||
}
|
||||
|
||||
export const PluginPageContext = createContext<PluginPageContextValue>({
|
||||
containerRef: { current: null },
|
||||
scrollDisabled: false,
|
||||
setScrollDisabled: () => {},
|
||||
})
|
||||
|
||||
type PluginPageContextProviderProps = {
|
||||
@ -34,14 +29,11 @@ export const PluginPageContextProvider = ({
|
||||
children,
|
||||
}: PluginPageContextProviderProps) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [scrollDisabled, setScrollDisabled] = useState(false)
|
||||
|
||||
return (
|
||||
<PluginPageContext.Provider
|
||||
value={{
|
||||
containerRef,
|
||||
scrollDisabled,
|
||||
setScrollDisabled,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@ -36,7 +36,6 @@ const PluginPage = ({
|
||||
const { setShowPluginSettingModal } = useModalContext() as any
|
||||
const [currentFile, setCurrentFile] = useState<File | null>(null)
|
||||
const containerRef = usePluginPageContext(v => v.containerRef)
|
||||
const scrollDisabled = usePluginPageContext(v => v.scrollDisabled)
|
||||
|
||||
const { dragging, fileUploader, fileChangeHandle, removeFile } = useUploader({
|
||||
onFileChange: setCurrentFile,
|
||||
@ -60,12 +59,11 @@ const PluginPage = ({
|
||||
className={cn('grow relative flex flex-col overflow-y-auto border-t border-divider-subtle', activeTab === 'plugins'
|
||||
? 'rounded-t-xl bg-components-panel-bg'
|
||||
: 'bg-background-body',
|
||||
activeTab === 'discover' && scrollDisabled && 'overflow-hidden',
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
'sticky top-0 flex min-h-[60px] px-12 pt-4 pb-2 items-center self-stretch gap-1',
|
||||
'sticky top-0 flex min-h-[60px] px-12 pt-4 pb-2 items-center self-stretch gap-1 bg-background-body z-10',
|
||||
)}
|
||||
>
|
||||
<div className='flex justify-between items-center w-full'>
|
||||
|
||||
Reference in New Issue
Block a user