import { X } from 'lucide-react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { requestOpenPluginView, usePluginViewLifecycle, } from '../../application/state/usePluginViewLifecycle'; import { Button } from '../ui/button'; import { PluginContributionIcon } from './PluginContributionIcon'; export { requestOpenPluginView }; const DEFAULT_KEYBINDING_CONTEXT = Object.freeze({ 'netcatty.surface': 'keybinding' }); export function PluginContributionHost({ locale, theme, themeTokens: suppliedThemeTokens, keybindingContext = DEFAULT_KEYBINDING_CONTEXT, }: { locale: string; theme: string; themeTokens?: Record; keybindingContext?: Record; }) { const { t } = useI18n(); const { activeView, close, effectiveRequested, mountRef, } = usePluginViewLifecycle({ locale, theme, suppliedThemeTokens, keybindingContext, }); if (!effectiveRequested || !activeView) return null; const location = activeView.view.location; const containerClass = location === 'aside' ? 'absolute inset-y-0 right-0 z-40 w-[420px] border-l border-border bg-background shadow-2xl' : location === 'panel' ? 'absolute inset-x-0 bottom-0 z-40 h-[42%] border-t border-border bg-background shadow-2xl' : location === 'modal' ? 'fixed left-1/2 top-1/2 z-50 h-[70vh] w-[min(800px,85vw)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-2xl' : 'absolute inset-0 z-40 bg-background'; if (location === 'tab') { return (
); } return (
{activeView.view.title}
{activeView.plugin.displayName}
); }