fix: marketplace plugin type icon

pull/9940/head
StyleZhang 2 years ago
parent 7daa365564
commit 25f34f6703

@ -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,
}
}

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

Loading…
Cancel
Save