()
| 15 | import type { PluginCard, PluginSection } from './marketplace/types' |
| 16 | |
| 17 | export const PluginMarketplace = () => { |
| 18 | const styles = createStyles() |
| 19 | const { plugins } = createPlugins() |
| 20 | const [pluginSections, setPluginSections] = createSignal< |
| 21 | Array<PluginSection> |
| 22 | >([]) |
| 23 | const [currentPackageJson, setCurrentPackageJson] = |
| 24 | createSignal<PackageJson | null>(null) |
| 25 | const [searchInput, setSearchInput] = createSignal('') |
| 26 | const [searchQuery, setSearchQuery] = createSignal('') |
| 27 | const [collapsedSections, setCollapsedSections] = createSignal<Set<string>>( |
| 28 | new Set(), |
| 29 | ) |
| 30 | const [showActivePlugins, setShowActivePlugins] = createSignal(true) |
| 31 | const [selectedTags, setSelectedTags] = createSignal<Set<string>>(new Set()) |
| 32 | const [isSettingsOpen, setIsSettingsOpen] = createSignal(false) |
| 33 | |
| 34 | let debounceTimeout: ReturnType<typeof setTimeout> | undefined |
| 35 | |
| 36 | // Debounce search input |
| 37 | const handleSearchInput = (value: string) => { |
| 38 | setSearchInput(value) |
| 39 | |
| 40 | if (debounceTimeout) { |
| 41 | clearTimeout(debounceTimeout) |
| 42 | } |
| 43 | |
| 44 | debounceTimeout = setTimeout(() => { |
| 45 | setSearchQuery(value) |
| 46 | }, 300) |
| 47 | } |
| 48 | |
| 49 | const toggleSection = (framework: string) => { |
| 50 | setCollapsedSections((prev) => { |
| 51 | const newSet = new Set(prev) |
| 52 | if (newSet.has(framework)) { |
| 53 | newSet.delete(framework) |
| 54 | } else { |
| 55 | newSet.add(framework) |
| 56 | } |
| 57 | return newSet |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | const matchesSearch = (card: PluginCard, query: string): boolean => { |
| 62 | if (!query) return true |
| 63 | |
| 64 | const lowerQuery = query.toLowerCase() |
| 65 | return ( |
| 66 | card.devtoolsPackage.toLowerCase().includes(lowerQuery) || |
| 67 | card.requiredPackageName.toLowerCase().includes(lowerQuery) || |
| 68 | card.framework.toLowerCase().includes(lowerQuery) |
| 69 | ) |
| 70 | } |
| 71 | |
| 72 | const getFilteredSections = () => { |
| 73 | const query = searchQuery() |
| 74 | const showActive = showActivePlugins() |
nothing calls this directly
no test coverage detected