mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 15:52:42 +08:00
Feat/explore (#198)
This commit is contained in:
@@ -8,6 +8,7 @@ import NewAppCard from './NewAppCard'
|
||||
import { AppListResponse } from '@/models/app'
|
||||
import { fetchAppList } from '@/service/apps'
|
||||
import { useSelector } from '@/context/app-context'
|
||||
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||
|
||||
const getKey = (pageIndex: number, previousPageData: AppListResponse) => {
|
||||
if (!pageIndex || previousPageData.has_more)
|
||||
@@ -21,6 +22,13 @@ const Apps = () => {
|
||||
const pageContainerRef = useSelector(state => state.pageContainerRef)
|
||||
const anchorRef = useRef<HTMLAnchorElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if(localStorage.getItem(NEED_REFRESH_APP_LIST_KEY) === '1') {
|
||||
localStorage.removeItem(NEED_REFRESH_APP_LIST_KEY)
|
||||
mutate()
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
loadingStateRef.current = isLoading
|
||||
}, [isLoading])
|
||||
|
||||
8
web/app/(commonLayout)/explore/apps/page.tsx
Normal file
8
web/app/(commonLayout)/explore/apps/page.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import AppList from "@/app/components/explore/app-list"
|
||||
import React from 'react'
|
||||
|
||||
const Apps = ({ }) => {
|
||||
return <AppList />
|
||||
}
|
||||
|
||||
export default React.memo(Apps)
|
||||
15
web/app/(commonLayout)/explore/installed/[appId]/page.tsx
Normal file
15
web/app/(commonLayout)/explore/installed/[appId]/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React, { FC } from 'react'
|
||||
import Main from '@/app/components/explore/installed-app'
|
||||
|
||||
export interface IInstalledAppProps {
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
}
|
||||
|
||||
const InstalledApp: FC<IInstalledAppProps> = ({ params: {appId} }) => {
|
||||
return (
|
||||
<Main id={appId} />
|
||||
)
|
||||
}
|
||||
export default React.memo(InstalledApp)
|
||||
16
web/app/(commonLayout)/explore/layout.tsx
Normal file
16
web/app/(commonLayout)/explore/layout.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import ExploreClient from '@/app/components/explore'
|
||||
export type IAppDetail = {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const AppDetail: FC<IAppDetail> = ({ children }) => {
|
||||
return (
|
||||
<ExploreClient>
|
||||
{children}
|
||||
</ExploreClient>
|
||||
)
|
||||
}
|
||||
|
||||
export default React.memo(AppDetail)
|
||||
Reference in New Issue
Block a user