import React from 'react'
import { useParams } from 'react-router'
import PageShell from '../components/Layout/PageShell'
import PluginFrame from '../components/Plugins/PluginFrame'
import { usePluginStore } from '../store/pluginStore'
import { useTranslation } from '../i18n'
/**
* Full-page host for a `page` plugin (#plugins, M3). Thin by design (no state /
* effects — the page-pattern rule): it resolves the plugin from the store and
* renders its sandboxed iframe; PluginFrame owns the bridge.
*/
export default function PluginPage(): React.ReactElement {
const { pluginId = '' } = useParams()
const { t } = useTranslation()
const plugin = usePluginStore((s) => s.getById(pluginId))
const loaded = usePluginStore((s) => s.loaded)
if (loaded && (!plugin || plugin.type !== 'page')) {
return (
{t('plugins.notFound')}
)
}
return (
)
}