feat(web): Unified frontend code style (#1923)

Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: 谨欣 <echo.cmy@antgroup.com>
Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com>
Co-authored-by: yanzhiyong <932374019@qq.com>
This commit is contained in:
Dreammy23
2024-08-30 14:03:06 +08:00
committed by GitHub
parent f866580703
commit 471689ba20
247 changed files with 4960 additions and 4546 deletions

View File

@@ -26,7 +26,7 @@ const RecommendQuestions: React.FC<{
// 将数据实时返回给消费组件
useEffect(() => {
updateData(recommendQuestions?.filter((question) => !!question.question));
updateData(recommendQuestions?.filter(question => !!question.question));
}, [recommendQuestions, updateData]);
return (
@@ -34,22 +34,28 @@ const RecommendQuestions: React.FC<{
<Form<FormRecommendQuestion>
style={{ width: '100%' }}
form={form}
initialValues={{ recommend_questions: initValue || [{ question: '', valid: false }] }}
autoComplete="off"
initialValues={{
recommend_questions: initValue || [{ question: '', valid: false }],
}}
autoComplete='off'
wrapperCol={{ span: 20 }}
{...(labelCol && { labelCol: { span: 4 } })}
>
<Form.Item label={t('recommended_questions')}>
<Form.List name="recommend_questions">
<Form.List name='recommend_questions'>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name }, index) => (
<div key={key} className={cls('flex flex-1 items-center gap-8 mb-6', formStyle)}>
<Form.Item label={`${t('question')} ${index + 1}`} name={[name, 'question']} className="grow">
<Form.Item label={`${t('question')} ${index + 1}`} name={[name, 'question']} className='grow'>
<Input placeholder={t('please_input_recommended_questions')} />
</Form.Item>
<Form.Item label={t('is_effective')} name={[name, 'valid']}>
<Switch style={{ background: recommendQuestions?.[index]?.valid ? '#1677ff' : '#ccc' }} />
<Switch
style={{
background: recommendQuestions?.[index]?.valid ? '#1677ff' : '#ccc',
}}
/>
</Form.Item>
<Form.Item>
<MinusCircleOutlined
@@ -62,7 +68,7 @@ const RecommendQuestions: React.FC<{
))}
<Form.Item className={cls(formStyle)}>
<Button
type="dashed"
type='dashed'
onClick={() => {
add({ question: '', valid: false });
}}