fix: marketplace plugin type icon

This commit is contained in:
StyleZhang 2024-10-24 14:21:12 +08:00
parent 7daa365564
commit 25f34f6703
2 changed files with 33 additions and 8 deletions

View File

@ -0,0 +1,15 @@
import { useRequest } from 'ahooks'
export const useCheckInstallStatus = () => {
const { data, run, cancel } = useRequest(async () => {}, {
manual: true,
pollingInterval: 5000,
pollingErrorRetryCount: 2,
})
return {
data,
run,
cancel,
}
}

View File

@ -1,46 +1,56 @@
'use client'
import { useState } from 'react'
import { PluginType } from '../types'
import {
RiArchive2Line,
RiBrain2Line,
RiHammerLine,
RiPuzzle2Line,
} from '@remixicon/react'
import cn from '@/utils/classnames'
const PLUGIN_TYPE_SEARCH_MAP = {
all: 'all',
model: PluginType.model,
tool: PluginType.tool,
extension: PluginType.extension,
bundle: 'bundle',
}
type PluginTypeSwitchProps = {
onChange?: (type: string) => void
}
const options = [
{
value: 'all',
value: PLUGIN_TYPE_SEARCH_MAP.all,
text: 'All',
icon: null,
},
{
value: 'models',
value: PLUGIN_TYPE_SEARCH_MAP.model,
text: 'Models',
icon: null,
icon: <RiBrain2Line className='mr-1.5 w-4 h-4' />,
},
{
value: 'tools',
value: PLUGIN_TYPE_SEARCH_MAP.tool,
text: 'Tools',
icon: <RiHammerLine className='mr-1.5 w-4 h-4' />,
},
{
value: 'extensions',
value: PLUGIN_TYPE_SEARCH_MAP.extension,
text: 'Extensions',
icon: <RiPuzzle2Line className='mr-1.5 w-4 h-4' />,
},
{
value: 'bundles',
value: PLUGIN_TYPE_SEARCH_MAP.bundle,
text: 'Bundles',
icon: null,
icon: <RiArchive2Line className='mr-1.5 w-4 h-4' />,
},
]
const PluginTypeSwitch = ({
onChange,
}: PluginTypeSwitchProps) => {
const [activeType, setActiveType] = useState('all')
const [activeType, setActiveType] = useState(PLUGIN_TYPE_SEARCH_MAP.all)
return (
<div className={cn(