mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 20:03:13 +08:00
revert(desktop): drop the curated skill packages from the skills market
The skills tab mounted the connector catalog as a featured row above the skill market, and that row was the only place the five curated packages (frontend design, canvas design, generative art, webapp testing, MCP builder) were offered. Stop mounting it, so the tab renders the market alone and those packages have no entry point left in the UI. The featured slot on Market and MarketHome stays in place, and the catalog, bundle lock and installer under src/services/connectors are untouched: restoring the row is a change to one branch of ExtensionMarket, packages already installed keep working, and their mentions still resolve. The ExtensionMarket test now asserts the tab does not mount the catalog again.
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import '@testing-library/jest-dom'
|
||||
import { it, expect, vi } from 'vitest'
|
||||
import { useMarketStore } from '@/stores/marketStore'
|
||||
import { ExtensionMarket } from './ExtensionMarket'
|
||||
vi.mock('@/i18n', () => ({ useTranslation: () => (key: string) => key }))
|
||||
vi.mock('@/pages/Connectors', () => ({ Connectors: ({ mode, embedded, externalQuery, installedFilter, management }: { mode?: string, management?: boolean, embedded?: boolean, externalQuery?: string, installedFilter?: string }) => <div data-testid={`catalog-${mode || "plugins"}`} data-management={management} data-embedded={embedded} data-query={externalQuery} data-filter={installedFilter} /> }))
|
||||
vi.mock('@/pages/InstalledSkills', () => ({ InstalledSkills: () => <div data-testid="installed-skills" /> }))
|
||||
vi.mock('@/pages/Market', () => ({ Market: ({ featured }: { featured: React.ReactNode }) => <div data-testid="existing-skill-market">{featured}</div> }))
|
||||
it('defaults to plugins and combines curated skills with the existing skill market', () => {
|
||||
it('defaults to plugins and shows only the skill market on the skills tab', () => {
|
||||
render(<ExtensionMarket />)
|
||||
expect(screen.getByRole('heading', { name: 'sidebar.extensions' })).toBeInTheDocument()
|
||||
expect(screen.getByTestId('catalog-plugins')).toBeInTheDocument()
|
||||
expect(screen.queryByTestId('existing-skill-market')).not.toBeInTheDocument()
|
||||
fireEvent.click(screen.getByRole('radio', { name: 'extensions.skills' }))
|
||||
expect(screen.getByTestId('existing-skill-market')).toBeInTheDocument()
|
||||
expect(screen.getByTestId('catalog-skills')).toHaveAttribute('data-embedded', 'true')
|
||||
act(() => { useMarketStore.setState({ query: 'poster', filters: { source: 'all', security: 'all', installed: 'installed' } }) })
|
||||
expect(screen.getByTestId('catalog-skills')).toHaveAttribute('data-query', 'poster')
|
||||
expect(screen.getByTestId('catalog-skills')).toHaveAttribute('data-filter', 'installed')
|
||||
// Curated skill packages are withdrawn from the market for now: the skills
|
||||
// tab must not mount the connector catalog again.
|
||||
expect(screen.queryByTestId('catalog-skills')).not.toBeInTheDocument()
|
||||
expect(screen.queryByTestId('catalog-plugins')).not.toBeInTheDocument()
|
||||
fireEvent.click(screen.getByRole('radio', { name: 'extensions.plugins' }))
|
||||
expect(screen.getByTestId('catalog-plugins')).toBeInTheDocument()
|
||||
|
||||
@@ -4,14 +4,11 @@ import { useTranslation } from '@/i18n'
|
||||
import { Button } from '@/components/ui/Button'
|
||||
import { SegmentedControl } from '@/components/ui/SegmentedControl'
|
||||
import { Connectors } from '@/pages/Connectors'
|
||||
import { useMarketStore } from '@/stores/marketStore'
|
||||
import { Market } from '@/pages/Market'
|
||||
import { InstalledSkills } from '@/pages/InstalledSkills'
|
||||
|
||||
export function ExtensionMarket() {
|
||||
const t = useTranslation()
|
||||
const query = useMarketStore(state => state.query)
|
||||
const installedFilter = useMarketStore(state => state.filters.installed)
|
||||
const [section, setSection] = useState<'plugins' | 'skills'>('plugins')
|
||||
const [managing, setManaging] = useState(false)
|
||||
const myLabel = t(section === 'plugins' ? 'extensions.myPlugins' : 'extensions.mySkills')
|
||||
@@ -26,9 +23,12 @@ export function ExtensionMarket() {
|
||||
</div>
|
||||
</header>
|
||||
<div className="flex min-h-0 flex-1 flex-col">
|
||||
{/* Curated skill packages are not offered for now. Their catalog, lock
|
||||
file and installer stay in src/services/connectors, so restoring the
|
||||
previous featured row is a change to the skills branch below. */}
|
||||
{managing
|
||||
? section === 'plugins' ? <Connectors key="installed" management /> : <div className="h-full overflow-y-auto"><div className="mx-auto max-w-7xl px-5 py-6 lg:px-8"><InstalledSkills /></div></div>
|
||||
: section === 'plugins' ? <Connectors key="catalog" mode="plugins" /> : <Market featured={<Connectors mode="skills" embedded externalQuery={query} installedFilter={installedFilter} />} />}
|
||||
: section === 'plugins' ? <Connectors key="catalog" mode="plugins" /> : <Market />}
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user