- - - {onOpen ? - {heading} - {description} - : {heading}{description}} - {metadata && {metadata}} - - {actions} -
+ + {visible.map((plugin) => choose(selected === plugin.id ? null : plugin.id)}> @@ -120,7 +106,10 @@ export function PluginPackageManager({ manager, onSelectionChange, initialSelect {t('settings.plugins.sources.source')}: {t(plugin.source?.kind === 'official' ? 'settings.plugins.sources.official' : plugin.source?.kind === 'third-party' ? 'settings.plugins.sources.thirdparty' : 'settings.plugins.sources.local')}{plugin.source?.origin ? ` · ${plugin.source.origin}` : ''} {plugin.manifest?.publisher && } {descriptionOf(plugin) || t('settings.plugins.manager.noDescription')} - {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''} + {!selectedPlugin ? + {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''} + choose(plugin.id)} aria-label={`${t('settings.plugins.manager.details')} ${nameOf(plugin)}`}>{t('settings.plugins.manager.details')} + : {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''}} {plugin.runtime.lastError && {t('settings.plugins.manager.lastError')}: {plugin.runtime.lastError}} {selected === plugin.id && <> diff --git a/components/settings/tabs/PluginSettingsLanding.test.tsx b/components/settings/tabs/PluginSettingsLanding.test.tsx index cb3df5238..37cb05c01 100644 --- a/components/settings/tabs/PluginSettingsLanding.test.tsx +++ b/components/settings/tabs/PluginSettingsLanding.test.tsx @@ -41,13 +41,6 @@ test('landing rows expose real sources/status/settings and quick toggles preserv await render(); assert.equal(document.querySelector('[role=dialog]'), null); assert.equal(document.querySelector('input[type=checkbox]'), null); - assert.equal(document.querySelectorAll('[data-plugin-row]').length, 2); - assert.equal(document.querySelectorAll('[data-plugin-icon-slot]').length, 2); - assert.equal(document.querySelector('[data-plugin-row-list]')!.className.includes('border'), false); - const alphaRow = document.querySelector('[data-plugin-row="com.example.alpha"]')!; - assert.ok(alphaRow.querySelector('[data-plugin-row-tag]')); - assert.equal(alphaRow.querySelector('[data-plugin-row-actions] [role=switch]')?.getAttribute('aria-label'), 'Disable Alpha'); - assert.equal(alphaRow.querySelector('button button'), null, 'quick actions are never nested inside navigation'); assert.equal(document.querySelectorAll('[role=switch]').length, 2, 'only real plugin toggles appear on landing'); assert.match(document.body.textContent!, /Running/); assert.match(document.body.textContent!, /Source: Official/); diff --git a/components/settings/tabs/PluginSettingsLanding.tsx b/components/settings/tabs/PluginSettingsLanding.tsx index 7a09e77e6..7aff699e2 100644 --- a/components/settings/tabs/PluginSettingsLanding.tsx +++ b/components/settings/tabs/PluginSettingsLanding.tsx @@ -5,7 +5,7 @@ import type { usePluginUpdateCheck } from '../../../application/state/usePluginU import type { usePluginManager } from '../../../application/state/usePluginManager'; import { Button } from '../../ui/button'; import { Input } from '../../ui/input'; -import { PluginListRow } from '../../plugins/PluginListRow'; +import { PluginBrandIcon } from '../../plugins/PluginBrandIcon'; import { PluginAuthorRow } from '../../plugins/PluginAuthorRow'; import { SettingCard, SettingRow, SettingsSection, Toggle } from '../settings-ui'; import { PluginLogSettings } from './PluginLogSettings'; @@ -63,24 +63,28 @@ export function PluginSettingsLanding({ manager, settingsAvailable, settingsErro {manager.statusKnown && manager.available && manager.plugins.length === 0 && {t('settings.plugins.landing.empty')}} {manager.plugins.length > 0 && <> setSearch(event.target.value)} /> - {visible.length === 0 ? {t('settings.plugins.market.noResults')} : + {visible.length === 0 ? {t('settings.plugins.market.noResults')} : {visible.map((plugin) => { const name = nameOf(plugin); const description = localized(plugin.manifest?.description); const availableUpdate = updates?.result?.updates.find((item) => item.pluginId === plugin.id && item.sourceId === plugin.source?.id); const declaredSettings = Boolean(plugin.manifest?.contributes?.settings?.length || plugin.manifest?.contributes?.views?.some((view) => view.location === 'settings')); - return + return } label={ + {name} + {plugin.activeVersion && {plugin.activeVersion}} + } description={<> {plugin.manifest?.publisher && } - {[sourceOf(plugin), statusOf(plugin)].filter(Boolean).join(' · ')} - {availableUpdate && {t('settings.plugins.landing.updateAvailable').replace('{version}', availableUpdate.availableVersion)}} - >} actions={ + {[sourceOf(plugin), statusOf(plugin)].filter(Boolean).join(' · ')} + {availableUpdate && {t('settings.plugins.landing.updateAvailable').replace('{version}', availableUpdate.availableVersion)}} + {description && {description}} + >}> {declaredSettings && onManage(plugin.id, event.currentTarget)}>} void manager.setEnabled(plugin.id, enabled)} /> - } />; + ; })} - } + } >} >; diff --git a/components/settings/tabs/PluginStatePill.test.tsx b/components/settings/tabs/PluginStatePill.test.tsx index 997ff82f1..0d22192cd 100644 --- a/components/settings/tabs/PluginStatePill.test.tsx +++ b/components/settings/tabs/PluginStatePill.test.tsx @@ -6,14 +6,14 @@ import { I18nProvider } from '../../../application/i18n/I18nProvider'; import { PluginPackageManager } from './PluginPackageManager'; import type { usePluginManager } from '../../../application/state/usePluginManager'; -test('detail state pill exposes actual state, opposite action, focus styling and pending disable without granting permissions', async () => { +test('state pill exposes actual state, opposite action, focus styling and pending disable without granting permissions', async () => { const globals = globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }; const previous = globals.IS_REACT_ACT_ENVIRONMENT; globals.IS_REACT_ACT_ENVIRONMENT = true; const calls: unknown[] = []; - const plugin = { id: 'com.test.pill', activeVersion: '1.0.0', enabled: true, manifest: { name: 'Pill', main: { browser: 'index.js' }, engines: { api: '0.1.0-internal', netcatty: '*' } }, runtime: {} } as NetcattyInstalledPlugin; + const plugin = { id: 'com.test.pill', activeVersion: '1.0.0', enabled: true, manifest: { name: 'Pill' }, runtime: {} } as NetcattyInstalledPlugin; const manager = { available: true, plugins: [plugin], busy: false, setEnabled: async (...args: unknown[]) => { calls.push(args); } } as unknown as ReturnType; let renderer: ReactTestRenderer; - const render = (enabled: boolean, busy = false) => ; + const render = (enabled: boolean, busy = false) => ; try { await act(async () => { renderer = create(render(true)); }); const pill = () => renderer.root.findAllByType('button').find((node) => node.props['aria-pressed'] !== undefined)!;
choose(selected === plugin.id ? null : plugin.id)}> @@ -120,7 +106,10 @@ export function PluginPackageManager({ manager, onSelectionChange, initialSelect {t('settings.plugins.sources.source')}: {t(plugin.source?.kind === 'official' ? 'settings.plugins.sources.official' : plugin.source?.kind === 'third-party' ? 'settings.plugins.sources.thirdparty' : 'settings.plugins.sources.local')}{plugin.source?.origin ? ` · ${plugin.source.origin}` : ''} {plugin.manifest?.publisher && } {descriptionOf(plugin) || t('settings.plugins.manager.noDescription')} - {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''} + {!selectedPlugin ? + {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''} + choose(plugin.id)} aria-label={`${t('settings.plugins.manager.details')} ${nameOf(plugin)}`}>{t('settings.plugins.manager.details')} + : {plugin.activeVersion}{plugin.manifest?.license ? ` · ${plugin.manifest.license}` : ''}} {plugin.runtime.lastError && {t('settings.plugins.manager.lastError')}: {plugin.runtime.lastError}} {selected === plugin.id && <> diff --git a/components/settings/tabs/PluginSettingsLanding.test.tsx b/components/settings/tabs/PluginSettingsLanding.test.tsx index cb3df5238..37cb05c01 100644 --- a/components/settings/tabs/PluginSettingsLanding.test.tsx +++ b/components/settings/tabs/PluginSettingsLanding.test.tsx @@ -41,13 +41,6 @@ test('landing rows expose real sources/status/settings and quick toggles preserv await render(); assert.equal(document.querySelector('[role=dialog]'), null); assert.equal(document.querySelector('input[type=checkbox]'), null); - assert.equal(document.querySelectorAll('[data-plugin-row]').length, 2); - assert.equal(document.querySelectorAll('[data-plugin-icon-slot]').length, 2); - assert.equal(document.querySelector('[data-plugin-row-list]')!.className.includes('border'), false); - const alphaRow = document.querySelector('[data-plugin-row="com.example.alpha"]')!; - assert.ok(alphaRow.querySelector('[data-plugin-row-tag]')); - assert.equal(alphaRow.querySelector('[data-plugin-row-actions] [role=switch]')?.getAttribute('aria-label'), 'Disable Alpha'); - assert.equal(alphaRow.querySelector('button button'), null, 'quick actions are never nested inside navigation'); assert.equal(document.querySelectorAll('[role=switch]').length, 2, 'only real plugin toggles appear on landing'); assert.match(document.body.textContent!, /Running/); assert.match(document.body.textContent!, /Source: Official/); diff --git a/components/settings/tabs/PluginSettingsLanding.tsx b/components/settings/tabs/PluginSettingsLanding.tsx index 7a09e77e6..7aff699e2 100644 --- a/components/settings/tabs/PluginSettingsLanding.tsx +++ b/components/settings/tabs/PluginSettingsLanding.tsx @@ -5,7 +5,7 @@ import type { usePluginUpdateCheck } from '../../../application/state/usePluginU import type { usePluginManager } from '../../../application/state/usePluginManager'; import { Button } from '../../ui/button'; import { Input } from '../../ui/input'; -import { PluginListRow } from '../../plugins/PluginListRow'; +import { PluginBrandIcon } from '../../plugins/PluginBrandIcon'; import { PluginAuthorRow } from '../../plugins/PluginAuthorRow'; import { SettingCard, SettingRow, SettingsSection, Toggle } from '../settings-ui'; import { PluginLogSettings } from './PluginLogSettings'; @@ -63,24 +63,28 @@ export function PluginSettingsLanding({ manager, settingsAvailable, settingsErro {manager.statusKnown && manager.available && manager.plugins.length === 0 && {t('settings.plugins.landing.empty')}} {manager.plugins.length > 0 && <> setSearch(event.target.value)} /> - {visible.length === 0 ? {t('settings.plugins.market.noResults')} : + {visible.length === 0 ? {t('settings.plugins.market.noResults')} : {visible.map((plugin) => { const name = nameOf(plugin); const description = localized(plugin.manifest?.description); const availableUpdate = updates?.result?.updates.find((item) => item.pluginId === plugin.id && item.sourceId === plugin.source?.id); const declaredSettings = Boolean(plugin.manifest?.contributes?.settings?.length || plugin.manifest?.contributes?.views?.some((view) => view.location === 'settings')); - return + return } label={ + {name} + {plugin.activeVersion && {plugin.activeVersion}} + } description={<> {plugin.manifest?.publisher && } - {[sourceOf(plugin), statusOf(plugin)].filter(Boolean).join(' · ')} - {availableUpdate && {t('settings.plugins.landing.updateAvailable').replace('{version}', availableUpdate.availableVersion)}} - >} actions={ + {[sourceOf(plugin), statusOf(plugin)].filter(Boolean).join(' · ')} + {availableUpdate && {t('settings.plugins.landing.updateAvailable').replace('{version}', availableUpdate.availableVersion)}} + {description && {description}} + >}> {declaredSettings && onManage(plugin.id, event.currentTarget)}>} void manager.setEnabled(plugin.id, enabled)} /> - } />; + ; })} - } + } >} >; diff --git a/components/settings/tabs/PluginStatePill.test.tsx b/components/settings/tabs/PluginStatePill.test.tsx index 997ff82f1..0d22192cd 100644 --- a/components/settings/tabs/PluginStatePill.test.tsx +++ b/components/settings/tabs/PluginStatePill.test.tsx @@ -6,14 +6,14 @@ import { I18nProvider } from '../../../application/i18n/I18nProvider'; import { PluginPackageManager } from './PluginPackageManager'; import type { usePluginManager } from '../../../application/state/usePluginManager'; -test('detail state pill exposes actual state, opposite action, focus styling and pending disable without granting permissions', async () => { +test('state pill exposes actual state, opposite action, focus styling and pending disable without granting permissions', async () => { const globals = globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }; const previous = globals.IS_REACT_ACT_ENVIRONMENT; globals.IS_REACT_ACT_ENVIRONMENT = true; const calls: unknown[] = []; - const plugin = { id: 'com.test.pill', activeVersion: '1.0.0', enabled: true, manifest: { name: 'Pill', main: { browser: 'index.js' }, engines: { api: '0.1.0-internal', netcatty: '*' } }, runtime: {} } as NetcattyInstalledPlugin; + const plugin = { id: 'com.test.pill', activeVersion: '1.0.0', enabled: true, manifest: { name: 'Pill' }, runtime: {} } as NetcattyInstalledPlugin; const manager = { available: true, plugins: [plugin], busy: false, setEnabled: async (...args: unknown[]) => { calls.push(args); } } as unknown as ReturnType; let renderer: ReactTestRenderer; - const render = (enabled: boolean, busy = false) => ; + const render = (enabled: boolean, busy = false) => ; try { await act(async () => { renderer = create(render(true)); }); const pill = () => renderer.root.findAllByType('button').find((node) => node.props['aria-pressed'] !== undefined)!;