From 2d3ec9173c91784ef1fb17205ea66e3b0767893e Mon Sep 17 00:00:00 2001 From: shuai Date: Tue, 29 Nov 2022 16:03:19 +0800 Subject: [PATCH 1/2] fix: timeline for tag diffcontent --- ui/src/components/DiffContent/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/DiffContent/index.tsx b/ui/src/components/DiffContent/index.tsx index 2362e81c..2becb18d 100644 --- a/ui/src/components/DiffContent/index.tsx +++ b/ui/src/components/DiffContent/index.tsx @@ -24,7 +24,7 @@ const Index: FC = ({ showTagUrlSlug: true, }, }) => { - if (!newData?.original_text) return null; + if (!newData) return null; let tag = newData.tags; if (objectType === 'question' && oldData?.tags) { From ac3a9a4e24d892746959966b2d2b7cd5113f7c49 Mon Sep 17 00:00:00 2001 From: robin Date: Tue, 29 Nov 2022 16:04:43 +0800 Subject: [PATCH 2/2] fix(ui): solve the problem that the checkbox cannot be selected FIx: #101 --- ui/src/components/SchemaForm/index.tsx | 21 ++++++++++++++++++++- ui/src/pages/Admin/Smtp/index.tsx | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsx index 1d36e7e9..e9629aef 100644 --- a/ui/src/components/SchemaForm/index.tsx +++ b/ui/src/components/SchemaForm/index.tsx @@ -225,6 +225,24 @@ const SchemaForm: FC = ({ } }; + const handleCheckboxChange = ( + e: React.ChangeEvent, + index: number, + ) => { + const { name } = e.target; + const data = { + ...formData, + [name]: { + ...formData[name], + value: schema.properties[name]?.enum?.[index], + isInvalid: false, + }, + }; + if (onChange instanceof Function) { + onChange(data); + } + }; + return (
{keys.map((key) => { @@ -265,13 +283,14 @@ const SchemaForm: FC = ({ inline required type={widget} - name={title} + name={key} id={String(item)} label={properties[key].enumNames?.[index]} checked={formData[key]?.value === item} feedback={formData[key]?.errorMsg} feedbackType="invalid" isInvalid={formData[key].isInvalid} + onChange={(e) => handleCheckboxChange(e, index)} /> ); })} diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsx index 2af421a6..26cdd451 100644 --- a/ui/src/pages/Admin/Smtp/index.tsx +++ b/ui/src/pages/Admin/Smtp/index.tsx @@ -37,7 +37,7 @@ const Smtp: FC = () => { type: 'boolean', title: t('encryption.label'), description: t('encryption.text'), - enum: [true, false], + enum: ['SSL', ''], enumNames: ['SSL', ''], }, smtp_port: {