index.tsx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // import { useTheme } from 'next-themes'
  2. import {
  3. // RiArrowRightUpLine,
  4. RiArrowUpDoubleLine,
  5. } from '@remixicon/react'
  6. // import { useTranslation } from 'react-i18next'
  7. import type { useMarketplace } from './hooks'
  8. import List from '@/app/components/plugins/marketplace/list'
  9. import Loading from '@/app/components/base/loading'
  10. import { getLocaleOnClient } from '@/i18n-config'
  11. // import { getMarketplaceUrl } from '@/utils/var'
  12. type MarketplaceProps = {
  13. searchPluginText: string
  14. filterPluginTags: string[]
  15. isMarketplaceArrowVisible: boolean
  16. showMarketplacePanel: () => void
  17. marketplaceContext: ReturnType<typeof useMarketplace>
  18. }
  19. const Marketplace = ({
  20. searchPluginText,
  21. filterPluginTags,
  22. isMarketplaceArrowVisible,
  23. showMarketplacePanel,
  24. marketplaceContext,
  25. }: MarketplaceProps) => {
  26. const locale = getLocaleOnClient()
  27. // zlwu12 2025-09-18 注释
  28. // const { t } = useTranslation()
  29. // const { theme } = useTheme()
  30. const {
  31. isLoading,
  32. marketplaceCollections,
  33. marketplaceCollectionPluginsMap,
  34. plugins,
  35. page,
  36. } = marketplaceContext
  37. return (
  38. <>
  39. <div className='sticky bottom-0 flex shrink-0 flex-col bg-background-default-subtle px-12 pb-[14px] pt-2'>
  40. {isMarketplaceArrowVisible && (
  41. <RiArrowUpDoubleLine
  42. className='absolute left-1/2 top-2 z-10 h-4 w-4 -translate-x-1/2 cursor-pointer text-text-quaternary'
  43. onClick={showMarketplacePanel}
  44. />
  45. )}
  46. <div className='pb-3 pt-4'>
  47. {/* zlwu12 2025-09-18 注释 */}
  48. {/* <div className='title-2xl-semi-bold bg-gradient-to-r from-[rgba(11,165,236,0.95)] to-[rgba(21,90,239,0.95)] bg-clip-text text-transparent'>
  49. {t('plugin.marketplace.moreFrom')}
  50. </div>
  51. <div className='body-md-regular flex items-center text-center text-text-tertiary'>
  52. {t('plugin.marketplace.discover')}
  53. <span className="body-md-medium relative ml-1 text-text-secondary after:absolute after:bottom-[1.5px] after:left-0 after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
  54. {t('plugin.category.models')}
  55. </span>
  56. ,
  57. <span className="body-md-medium relative ml-1 text-text-secondary after:absolute after:bottom-[1.5px] after:left-0 after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
  58. {t('plugin.category.tools')}
  59. </span>
  60. ,
  61. <span className="body-md-medium relative ml-1 text-text-secondary after:absolute after:bottom-[1.5px] after:left-0 after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
  62. {t('plugin.category.agents')}
  63. </span>
  64. ,
  65. <span className="body-md-medium relative ml-1 mr-1 text-text-secondary after:absolute after:bottom-[1.5px] after:left-0 after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
  66. {t('plugin.category.extensions')}
  67. </span>
  68. {t('plugin.marketplace.and')}
  69. <span className="body-md-medium relative ml-1 mr-1 text-text-secondary after:absolute after:bottom-[1.5px] after:left-0 after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
  70. {t('plugin.category.bundles')}
  71. </span>
  72. {t('common.operation.in')}
  73. <a
  74. href={getMarketplaceUrl('', { language: locale, q: searchPluginText, tags: filterPluginTags.join(','), theme })}
  75. className='system-sm-medium ml-1 flex items-center text-text-accent'
  76. target='_blank'
  77. >
  78. {t('plugin.marketplace.difyMarketplace')}
  79. <RiArrowRightUpLine className='h-4 w-4' />
  80. </a>
  81. </div> */}
  82. </div>
  83. </div>
  84. <div className='mt-[-14px] shrink-0 grow bg-background-default-subtle px-12 pb-2'>
  85. {
  86. isLoading && page === 1 && (
  87. <div className='absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2'>
  88. <Loading />
  89. </div>
  90. )
  91. }
  92. {
  93. (!isLoading || page > 1) && (
  94. <List
  95. marketplaceCollections={marketplaceCollections || []}
  96. marketplaceCollectionPluginsMap={marketplaceCollectionPluginsMap || {}}
  97. plugins={plugins}
  98. showInstallButton
  99. locale={locale}
  100. />
  101. )
  102. }
  103. </div>
  104. </>
  105. )
  106. }
  107. export default Marketplace