From 326d7f2eba9f4019d157e36a328888986ac3a083 Mon Sep 17 00:00:00 2001 From: ShukeBta <272197458+ShukeBta@users.noreply.github.com> Date: Wed, 24 Jun 2026 23:47:51 +0800 Subject: [PATCH] refactor: reuse notify config controls --- web/src/pages/NotifyChannelConfigControls.tsx | 97 +++++ web/src/pages/NotifyChannelProviderFields.tsx | 334 +++++++++--------- 2 files changed, 255 insertions(+), 176 deletions(-) create mode 100644 web/src/pages/NotifyChannelConfigControls.tsx diff --git a/web/src/pages/NotifyChannelConfigControls.tsx b/web/src/pages/NotifyChannelConfigControls.tsx new file mode 100644 index 0000000..35d8350 --- /dev/null +++ b/web/src/pages/NotifyChannelConfigControls.tsx @@ -0,0 +1,97 @@ +import { Field } from './NotifyChannelFormField' + +type ConfigControlProps = { + config: Record + updateConfig: (key: string, value: string) => void +} + +type ConfigInputProps = ConfigControlProps & { + label: string + name: string + placeholder?: string + required?: boolean + type?: string +} + +export function ConfigInput({ + config, + updateConfig, + label, + name, + placeholder, + required, + type, +}: ConfigInputProps) { + return ( + + updateConfig(name, event.target.value)} + /> + + ) +} + +type ConfigSelectProps = ConfigControlProps & { + label: string + name: string + options: Array<{ value: string; label: string }> + defaultValue?: string +} + +export function ConfigSelect({ + config, + updateConfig, + label, + name, + options, + defaultValue = '', +}: ConfigSelectProps) { + return ( + + + + ) +} + +type ConfigTextareaProps = ConfigControlProps & { + label: string + name: string + placeholder?: string + rows: number +} + +export function ConfigTextarea({ + config, + updateConfig, + label, + name, + placeholder, + rows, +}: ConfigTextareaProps) { + return ( + +