您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.tsx 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { MarketplaceContextProvider } from './context'
  2. import Description from './description'
  3. import IntersectionLine from './intersection-line'
  4. import SearchBoxWrapper from './search-box/search-box-wrapper'
  5. import PluginTypeSwitch from './plugin-type-switch'
  6. import ListWrapper from './list/list-wrapper'
  7. import type { SearchParams } from './types'
  8. import { getMarketplaceCollectionsAndPlugins } from './utils'
  9. import { TanstackQueryIniter } from '@/context/query-client'
  10. type MarketplaceProps = {
  11. locale: string
  12. searchBoxAutoAnimate?: boolean
  13. showInstallButton?: boolean
  14. shouldExclude?: boolean
  15. searchParams?: SearchParams
  16. pluginTypeSwitchClassName?: string
  17. intersectionContainerId?: string
  18. scrollContainerId?: string
  19. }
  20. const Marketplace = async ({
  21. locale,
  22. searchBoxAutoAnimate = true,
  23. showInstallButton = true,
  24. shouldExclude,
  25. searchParams,
  26. pluginTypeSwitchClassName,
  27. intersectionContainerId,
  28. scrollContainerId,
  29. }: MarketplaceProps) => {
  30. let marketplaceCollections: any = []
  31. let marketplaceCollectionPluginsMap = {}
  32. if (!shouldExclude) {
  33. const marketplaceCollectionsAndPluginsData = await getMarketplaceCollectionsAndPlugins()
  34. marketplaceCollections = marketplaceCollectionsAndPluginsData.marketplaceCollections
  35. marketplaceCollectionPluginsMap = marketplaceCollectionsAndPluginsData.marketplaceCollectionPluginsMap
  36. }
  37. return (
  38. <TanstackQueryIniter>
  39. <MarketplaceContextProvider
  40. searchParams={searchParams}
  41. shouldExclude={shouldExclude}
  42. scrollContainerId={scrollContainerId}
  43. >
  44. <Description locale={locale} />
  45. <IntersectionLine intersectionContainerId={intersectionContainerId} />
  46. <SearchBoxWrapper
  47. locale={locale}
  48. searchBoxAutoAnimate={searchBoxAutoAnimate}
  49. />
  50. <PluginTypeSwitch
  51. locale={locale}
  52. className={pluginTypeSwitchClassName}
  53. searchBoxAutoAnimate={searchBoxAutoAnimate}
  54. />
  55. <ListWrapper
  56. locale={locale}
  57. marketplaceCollections={marketplaceCollections}
  58. marketplaceCollectionPluginsMap={marketplaceCollectionPluginsMap}
  59. showInstallButton={showInstallButton}
  60. />
  61. </MarketplaceContextProvider>
  62. </TanstackQueryIniter>
  63. )
  64. }
  65. export default Marketplace