import { FunctionComponent } from 'preact'; import { PluginManifest, PluginSetting } from 'plugins/types'; import { PluginStatus } from 'plugins/plugin'; import { Locale } from 'util/locale'; import { LocalizedWith } from 'views/components/localized-with'; export const SettingsPluginView: FunctionComponent<{ hasUnicodeFlags: boolean; id: string; manifest: PluginManifest; status?: PluginStatus; installTime?: number; updateError?: string; updateCheckDate?: string; installError?: string; autoUpdate: boolean; settings: PluginSetting[]; uninstallClicked: () => void; disableClicked: () => void; enableClicked: () => void; updateClicked: () => void; autoUpdateChanged: () => void; useLocaleClicked: () => void; useThemeClicked: () => void; pluginSettingChanged: (key: string, value: string | boolean) => void; }> = ({ hasUnicodeFlags, id, manifest, status, installTime, updateError, updateCheckDate, installError, autoUpdate, settings, uninstallClicked, disableClicked, enableClicked, updateClicked, autoUpdateChanged, useLocaleClicked, useThemeClicked, pluginSettingChanged }) => { return (

{id}

{manifest.description}
{manifest.url} , v{manifest.version}.{' '} {manifest.author.name === 'KeeWeb' ? ( Locale.setPlOfficial ) : ( {manifest.author.name} {' '} ({manifest.author.email}) )} ,{' '} {status === 'active' ? ( {installTime}ms ) : status === 'error' ? (  {Locale.setPlLoadError} ) : ( status )} {updateCheckDate ? (
{Locale.setPlLastUpdate}: {updateCheckDate}
) : null} {installError ? (
{installError}
) : null} {updateError ? (
{updateError}
) : null}
{settings ? (
{settings.map((setting) => (
{setting.type === 'checkbox' ? ( pluginSettingChanged( setting.name, (e.target as HTMLInputElement).checked ) } /> ) : null} {setting.type === 'text' ? ( pluginSettingChanged( setting.name, (e.target as HTMLInputElement).value ) } /> ) : null} {setting.type === 'select' && setting.options ? ( ) : null}
))}
) : null}
{status === 'active' ? ( ) : null} {status === 'inactive' ? ( ) : null} {status === 'active' ? ( <> {manifest.locale ? ( ) : null} {manifest.theme ? ( ) : null} ) : null}
); };