diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/config.ts b/web/app/components/plugins/reference-setting-modal/auto-update-setting/config.ts index 6c325e0719..a247061200 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/config.ts +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/config.ts @@ -4,6 +4,6 @@ export const defaultValue: AutoUpdateConfig = { strategy_setting: AUTO_UPDATE_STRATEGY.fixOnly, // For test upgrade_time_of_day: 0, upgrade_mode: AUTO_UPDATE_MODE.exclude, // For test - exclude_plugins: [], - include_plugins: [], + exclude_plugins: ['a', 'c'], + include_plugins: ['b'], } diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx new file mode 100644 index 0000000000..e255be0525 --- /dev/null +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx @@ -0,0 +1,22 @@ +'use client' +import type { FC } from 'react' +import React from 'react' +import { AUTO_UPDATE_MODE } from './types' +import { useTranslation } from 'react-i18next' + +type Props = { + updateMode: AUTO_UPDATE_MODE +} + +const NoPluginSelected: FC = ({ + updateMode, +}) => { + const { t } = useTranslation() + const text = `${t(`plugin.autoUpdate.upgradeModePlaceholder.${updateMode === AUTO_UPDATE_MODE.partial ? 'partial' : 'exclude'}`)}` + return ( +
+ {text} +
+ ) +} +export default React.memo(NoPluginSelected) diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx index fa348efa0a..ce5104764e 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx @@ -3,9 +3,12 @@ import type { FC } from 'react' import React from 'react' import NoPluginSelected from './no-plugin-selected' import type { AUTO_UPDATE_MODE } from './types' +import PluginsSelected from './plugins-selected' +import Button from '@/app/components/base/button' +import { RiAddLine } from '@remixicon/react' type Props = { - updateMode: AUTO_UPDATE_MODE + updateMode: AUTO_UPDATE_MODE value: string[] // plugin ids onChange: (value: string[]) => void } @@ -19,13 +22,23 @@ const PluginsPicker: FC = ({ return (
{hasSelected ? ( -
-
Selected plugins will not auto-update
+
+
The following 21 plugins will not auto-update
+
Clear all
) : ( )} + + +
) } diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-selected.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-selected.tsx new file mode 100644 index 0000000000..8bdf97c668 --- /dev/null +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-selected.tsx @@ -0,0 +1,31 @@ +'use client' +import type { FC } from 'react' +import React from 'react' +import cn from '@/utils/classnames' + +const MAX_DISPLAY_COUNT = 14 +type Props = { + className?: string + plugins: string[] +} + +const PluginsSelected: FC = ({ + className, + plugins, +}) => { + const isShowAll = plugins.length < MAX_DISPLAY_COUNT + const displayPlugins = isShowAll ? plugins.slice(0, MAX_DISPLAY_COUNT) : plugins + return ( +
+ {displayPlugins.map((plugin, index) => ( +
+
+ ))} + {!isShowAll &&
+{plugins.length - MAX_DISPLAY_COUNT}
} +
+ ) +} +export default React.memo(PluginsSelected)