Feat/explore (#198)

This commit is contained in:
Joel
2023-05-25 16:59:47 +08:00
committed by GitHub
parent b6cca59517
commit 33b3eaf324
38 changed files with 1312 additions and 97 deletions

View File

@@ -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])

View 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)

View 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)

View 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)