|  |  | @ -1,19 +1,18 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Avatar, Tag } from '@lobehub/ui'; |  |  |  | import { Avatar, Tag } from '@lobehub/ui'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Skeleton, Typography, App } from 'antd'; |  |  |  | import { Skeleton, Typography } from 'antd'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { createStyles } from 'antd-style'; |  |  |  | import { createStyles } from 'antd-style'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { startCase } from 'lodash-es'; |  |  |  | import { startCase } from 'lodash-es'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import dynamic from 'next/dynamic'; |  |  |  | import dynamic from 'next/dynamic'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import qs from 'query-string'; |  |  |  | import qs from 'query-string'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { memo, useState } from 'react'; |  |  |  | import { memo } from 'react'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { Center, Flexbox, FlexboxProps } from 'react-layout-kit'; |  |  |  | import { Center, Flexbox, FlexboxProps } from 'react-layout-kit'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import urlJoin from 'url-join'; |  |  |  | import urlJoin from 'url-join'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { useTranslation } from 'react-i18next'; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { DiscoverPlugintem } from '@/types/discover'; |  |  |  | import { DiscoverPlugintem } from '@/types/discover'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { useUserStore } from '@/store/user'; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import CardBanner from '../../../components/CardBanner'; |  |  |  | import CardBanner from '../../../components/CardBanner'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { useCategoryItem } from './useCategory'; |  |  |  | import { useCategoryItem } from './useCategory'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { StarOutlined } from '@ant-design/icons'; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import request from '@/app/api/request'; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | const Link = dynamic(() => import('next/link'), { |  |  |  | const Link = dynamic(() => import('next/link'), { | 
			
		
	
		
		
			
				
					
					|  |  |  |   loading: () => <Skeleton.Button size={'small'} style={{ height: 22 }} />, |  |  |  |   loading: () => <Skeleton.Button size={'small'} style={{ height: 22 }} />, | 
			
		
	
		
		
			
				
					
					|  |  |  |   ssr: false, |  |  |  |   ssr: false, | 
			
		
	
	
		
		
			
				
					|  |  | @ -62,15 +61,6 @@ const useStyles = createStyles(({ css, token, isDarkMode }) => ({ | 
			
		
	
		
		
			
				
					
					|  |  |  |     font-size: 18px !important; |  |  |  |     font-size: 18px !important; | 
			
		
	
		
		
			
				
					
					|  |  |  |     font-weight: bold; |  |  |  |     font-weight: bold; | 
			
		
	
		
		
			
				
					
					|  |  |  |   `,
 |  |  |  |   `,
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   collectBtn: css` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     font-size: 12px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     width: 20px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     height: 20px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     line-height: 20px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     border-radius: 50%; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     background: #FFF3D9; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     text-align: center; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   `,
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | })); |  |  |  | })); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | interface PluginCardProps |  |  |  | interface PluginCardProps | 
			
		
	
	
		
		
			
				
					|  |  | @ -83,63 +73,10 @@ interface PluginCardProps | 
			
		
	
		
		
			
				
					
					|  |  |  | const PluginCard = memo<PluginCardProps>( |  |  |  | const PluginCard = memo<PluginCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |   ({ className, showCategory, meta, createdAt, author, variant, ...rest }) => { |  |  |  |   ({ className, showCategory, meta, createdAt, author, variant, ...rest }) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { avatar, title, description, tags = [], category } = meta; |  |  |  |     const { avatar, title, description, tags = [], category } = meta; | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { createAt, homepage, identifier, schemaVersion, status, classify, manifest,locale } = {...rest} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const categoryItem = useCategoryItem(category, 12); |  |  |  |     const categoryItem = useCategoryItem(category, 12); | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { cx, styles, theme } = useStyles(); |  |  |  |     const { cx, styles, theme } = useStyles(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { t } = useTranslation('discover'); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { message } = App.useApp(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const isCompact = variant === 'compact'; |  |  |  |     const isCompact = variant === 'compact'; | 
			
		
	
		
		
			
				
					
					|  |  |  |     const getUserId = (s: UserStore) => s.user?.id |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     const userId = getUserId(useUserStore.getState()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log(status,"9383737-------------------------------------") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log(manifest,locale,"plugins9999999999-------------------") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const [val, setVal] = useState('') |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const handleCollect = (e) => { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       console.log(e,8844848) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       e.preventDefault() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       e.stopPropagation() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       const params = { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "author": author, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "createdAt": createdAt, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "homepage": homepage, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "identifier": identifier, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "avatar": avatar, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "description": description, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "tags": tags.join(','), |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "title": title, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "category": category, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "schemaVersion": schemaVersion, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "manifest": manifest, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "locale": locale, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         "userid": userId, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       request({ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           url: "/flxai/api/robot/appaiplugin", |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           method: "post", |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           data: params |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       }).then(response => { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         console.log(response,222222222) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (response.code == 0) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             message.success(t('collectSuccess')); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             setVal("1") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       }).catch(error => { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         console.error('Error fetching data: ', error); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       }) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const renderElement = () => { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       console.log(classify,'66666----------------------') |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (classify != 'collect') { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         console.log(status,"222222222--------------------------") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(status == "1" || val == "1") { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           return <div className={styles.collectBtn} onClick={(e) => {e.stopPropagation()}}><StarOutlined style={{color: '#FFAD01'}}/></div> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           return <div className={styles.collectBtn} style={{background: '#F1F1F1'}} onClick={(e) => handleCollect(e)}><StarOutlined style={{color: '#D6D6D6'}}/></div> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     }; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     return ( |  |  |  |     return ( | 
			
		
	
		
		
			
				
					
					|  |  |  |       <Flexbox className={cx(styles.container, className)} gap={24} {...rest}> |  |  |  |       <Flexbox className={cx(styles.container, className)} gap={24} {...rest}> | 
			
		
	
		
		
			
				
					
					|  |  |  |         {!isCompact && <CardBanner avatar={avatar} />} |  |  |  |         {!isCompact && <CardBanner avatar={avatar} />} | 
			
		
	
	
		
		
			
				
					|  |  | @ -184,28 +121,29 @@ const PluginCard = memo<PluginCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |           <Paragraph className={styles.desc} ellipsis={{ rows: 2 }}> |  |  |  |           <Paragraph className={styles.desc} ellipsis={{ rows: 2 }}> | 
			
		
	
		
		
			
				
					
					|  |  |  |             {description} |  |  |  |             {description} | 
			
		
	
		
		
			
				
					
					|  |  |  |           </Paragraph> |  |  |  |           </Paragraph> | 
			
		
	
		
		
			
				
					
					|  |  |  |           <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap',justifyContent: 'space-between' }}> |  |  |  |           <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             <div onClick={(e) => {e.stopPropagation()}} style={{width: '85%'}}> |  |  |  |             {showCategory && categoryItem ? ( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |               {showCategory && categoryItem ? ( |  |  |  |               <Link href={urlJoin('/discover/plugins', categoryItem.key)}> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   <Tag icon={categoryItem.icon} style={{ margin: '0 5' }}> |  |  |  |                 <Tag icon={categoryItem.icon} style={{ margin: 0 }}> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     {categoryItem.label} |  |  |  |                   {categoryItem.label} | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   </Tag> |  |  |  |                 </Tag> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |               ) : ( |  |  |  |               </Link> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 tags |  |  |  |             ) : ( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   .slice(0, 4) |  |  |  |               tags | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   .filter(Boolean) |  |  |  |                 .slice(0, 4) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   .map((tag: string, index) => { |  |  |  |                 .filter(Boolean) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     const url = qs.stringifyUrl({ |  |  |  |                 .map((tag: string, index) => { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       query: { q: tag, type: 'plugins' }, |  |  |  |                   const url = qs.stringifyUrl({ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       url: '/discover/search', |  |  |  |                     query: { q: tag, type: 'plugins' }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     }); |  |  |  |                     url: '/discover/search', | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     return ( |  |  |  |                   }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       <Tag style={{ margin: '0 5' }}>{startCase(tag).trim()}</Tag> |  |  |  |                   return ( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     ); |  |  |  |                     <Link href={url} key={index}> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   }) |  |  |  |                       <Tag style={{ margin: 0 }}>{startCase(tag).trim()}</Tag> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |               )} |  |  |  |                     </Link> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             </div> |  |  |  |                   ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             {renderElement()} |  |  |  |                 }) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             )} | 
			
		
	
		
		
			
				
					
					|  |  |  |           </Flexbox> |  |  |  |           </Flexbox> | 
			
		
	
		
		
			
				
					
					|  |  |  |         </Flexbox> |  |  |  |         </Flexbox> | 
			
		
	
		
		
			
				
					
					|  |  |  |       </Flexbox> |  |  |  |       </Flexbox> | 
			
		
	
	
		
		
			
				
					|  |  | 
 |