'use client' import type { FC } from 'react' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card' import Button from '@/app/components/base/button' enum PluginManagementOption { Everyone = 'Everyone', Admins = 'Admins', NoOne = 'No one', } type Props = { show: boolean onHide: () => void } const PluginSettingModal: FC = ({ show, onHide, }) => { const { t } = useTranslation() const [manageOption, setManageOption] = useState(PluginManagementOption.Everyone) const [debugOption, setDebugOption] = useState(PluginManagementOption.Everyone) return (
Plugin Preferences
{[ { title: 'Who can install and manage plugins?', key: 'manage', value: manageOption, setValue: setManageOption }, { title: 'Who can debug plugins?', key: 'debug', value: debugOption, setValue: setDebugOption }, ].map(({ title, key, value, setValue }) => (
{title}
{Object.values(PluginManagementOption).map(option => ( setValue(option)} selected={value === option} className="flex-1" /> ))}
))}
) } export default React.memo(PluginSettingModal)