mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import type { PluginDetail } from '../types'
|
||||
import { RiBookReadLine } from '@remixicon/react'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { RiBookReadLine } from '@remixicon/react'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { ReadmeShowType, useReadmePanelStore } from './store'
|
||||
import { BUILTIN_TOOLS_ARRAY } from './constants'
|
||||
import type { PluginDetail } from '../types'
|
||||
import { ReadmeShowType, useReadmePanelStore } from './store'
|
||||
|
||||
export const ReadmeEntrance = ({
|
||||
pluginDetail,
|
||||
@ -29,9 +29,11 @@ export const ReadmeEntrance = ({
|
||||
|
||||
return (
|
||||
<div className={cn('flex flex-col items-start justify-center gap-2 pb-4 pt-0', showType === ReadmeShowType.drawer && 'px-4', className)}>
|
||||
{!showShortTip && <div className="relative h-1 w-8 shrink-0">
|
||||
<div className="h-px w-full bg-divider-regular"></div>
|
||||
</div>}
|
||||
{!showShortTip && (
|
||||
<div className="relative h-1 w-8 shrink-0">
|
||||
<div className="h-px w-full bg-divider-regular"></div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={handleReadmeClick}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import { RiBookReadLine, RiCloseLine } from '@remixicon/react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import ActionButton from '@/app/components/base/action-button'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { Markdown } from '@/app/components/base/markdown'
|
||||
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { usePluginReadme } from '@/service/use-plugins'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { RiBookReadLine, RiCloseLine } from '@remixicon/react'
|
||||
import type { FC } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import DetailHeader from '../plugin-detail-panel/detail-header'
|
||||
import { ReadmeShowType, useReadmePanelStore } from './store'
|
||||
|
||||
@ -28,7 +28,8 @@ const ReadmePanel: FC = () => {
|
||||
setCurrentPluginDetail()
|
||||
}
|
||||
|
||||
if (!detail) return null
|
||||
if (!detail)
|
||||
return null
|
||||
|
||||
const children = (
|
||||
<div className="flex h-full w-full flex-col overflow-hidden">
|
||||
@ -41,7 +42,7 @@ const ReadmePanel: FC = () => {
|
||||
</span>
|
||||
</div>
|
||||
<ActionButton onClick={onClose}>
|
||||
<RiCloseLine className='h-4 w-4' />
|
||||
<RiCloseLine className="h-4 w-4" />
|
||||
</ActionButton>
|
||||
</div>
|
||||
<DetailHeader detail={detail} isReadmeView={true} />
|
||||
@ -86,33 +87,33 @@ const ReadmePanel: FC = () => {
|
||||
|
||||
const portalContent = showType === ReadmeShowType.drawer
|
||||
? (
|
||||
<div className='fixed inset-0 z-[999] flex justify-start' onClick={onClose}>
|
||||
<div
|
||||
className={cn(
|
||||
'pointer-events-auto mb-2 ml-2 mr-2 mt-16 w-[600px] max-w-[600px] justify-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0 shadow-xl',
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
<div className="fixed inset-0 z-[999] flex justify-start" onClick={onClose}>
|
||||
<div
|
||||
className={cn(
|
||||
'pointer-events-auto mb-2 ml-2 mr-2 mt-16 w-[600px] max-w-[600px] justify-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0 shadow-xl',
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
: (
|
||||
<div className='fixed inset-0 z-[999] flex items-center justify-center p-2' onClick={onClose}>
|
||||
<div
|
||||
className={cn(
|
||||
'pointer-events-auto relative h-[calc(100vh-16px)] w-full max-w-[800px] rounded-2xl bg-components-panel-bg p-0 shadow-xl',
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
<div className="fixed inset-0 z-[999] flex items-center justify-center p-2" onClick={onClose}>
|
||||
<div
|
||||
className={cn(
|
||||
'pointer-events-auto relative h-[calc(100vh-16px)] w-full max-w-[800px] rounded-2xl bg-components-panel-bg p-0 shadow-xl',
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
|
||||
return createPortal(
|
||||
portalContent,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { create } from 'zustand'
|
||||
import type { PluginDetail } from '@/app/components/plugins/types'
|
||||
import { create } from 'zustand'
|
||||
|
||||
export enum ReadmeShowType {
|
||||
drawer = 'drawer',
|
||||
@ -17,9 +17,11 @@ type Shape = {
|
||||
export const useReadmePanelStore = create<Shape>(set => ({
|
||||
currentPluginDetail: undefined,
|
||||
setCurrentPluginDetail: (detail?: PluginDetail, showType?: ReadmeShowType) => set({
|
||||
currentPluginDetail: !detail ? undefined : {
|
||||
detail,
|
||||
showType: showType ?? ReadmeShowType.drawer,
|
||||
},
|
||||
currentPluginDetail: !detail
|
||||
? undefined
|
||||
: {
|
||||
detail,
|
||||
showType: showType ?? ReadmeShowType.drawer,
|
||||
},
|
||||
}),
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user