import React from 'react' import { t } from '../i18n' import { Locale, ViewContribution } from '../types' import { Button } from '../ui/controls' import { Modal } from '../ui/dialog' import { PluginPanelFrame } from './PluginPanelFrame' import { locText } from './SchemaForm' interface Props { view: ViewContribution locale: Locale appearance: 'light' | 'dark' assetToken: string vm?: string dialog?: boolean metadata?: { title?: string; badge?: { text: string; tone: string } } onMetadata: (metadata: { title?: string; badge?: { text: string; tone: string } }) => void onOpenView: (view: ViewContribution, vm?: string) => void onCloseView: () => { closed: boolean } onNavigate: (target: { page?: string; vm?: string }) => void } export const PluginViewHost: React.FC = ({ view, locale, appearance, assetToken, vm, dialog, metadata, onMetadata, onOpenView, onCloseView, onNavigate, }) => { const title = metadata?.title || locText(view.title, locale, view.id) const badge = metadata?.badge const panel = { id: view.id, pluginId: view.pluginId, title: view.title, entry: view.entry, slot: '', height: 640, } const frame = ( ) if (dialog) { return ( {frame} ) } return (

{title}

{badge && {badge.text}}
{frame}
) }