From 944e7733926ca5372bc76c6e9515092f37a04a13 Mon Sep 17 00:00:00 2001 From: haitaoo Date: Thu, 20 Apr 2023 17:51:43 +0800 Subject: [PATCH] fix(Login): Improve the prompt text for the Login process --- i18n/en_US.yaml | 1 + ui/src/components/SchemaForm/components/Input.tsx | 2 +- ui/src/components/SchemaForm/components/Select.tsx | 3 +++ ui/src/components/SchemaForm/components/Textarea.tsx | 3 +++ ui/src/components/SchemaForm/index.tsx | 2 ++ ui/src/components/UploadImg/index.tsx | 7 +++++-- .../pages/UserCenter/Auth/components/WeCom/index.tsx | 6 ++++-- .../pages/UserCenter/AuthFailed/components/WeCom.tsx | 12 +++++++++--- ui/src/pages/Users/Settings/Profile/index.tsx | 10 +++++----- ui/src/plugins/PluginUcLogin/index.tsx | 5 +++-- ui/src/services/user-center/index.ts | 1 + 11 files changed, 37 insertions(+), 15 deletions(-) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index af3c5d9f..dc50a9b1 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -1123,6 +1123,7 @@ ui: plugins: login: Login qrcode_login_tip: Please use {{ agentName }} to scan the QR code and log in. + login_failed_email_tip: Login failed, please allow this app to access your email information before try again. oauth: connect: Connect with {{ auth_name }} remove: Remove {{ auth_name }} diff --git a/ui/src/components/SchemaForm/components/Input.tsx b/ui/src/components/SchemaForm/components/Input.tsx index 02f20ce9..84fda2eb 100644 --- a/ui/src/components/SchemaForm/components/Input.tsx +++ b/ui/src/components/SchemaForm/components/Input.tsx @@ -42,7 +42,7 @@ const Index: FC = ({ type={type} value={fieldObject?.value || ''} onChange={handleChange} - readOnly={readOnly} + disabled={readOnly} isInvalid={fieldObject?.isInvalid} style={type === 'color' ? { width: '6rem' } : {}} /> diff --git a/ui/src/components/SchemaForm/components/Select.tsx b/ui/src/components/SchemaForm/components/Select.tsx index 77c0f87a..0680360d 100644 --- a/ui/src/components/SchemaForm/components/Select.tsx +++ b/ui/src/components/SchemaForm/components/Select.tsx @@ -10,6 +10,7 @@ interface Props { enumValues: (string | boolean | number)[]; enumNames: string[]; formData: Type.FormDataType; + readOnly: boolean; } const Index: FC = ({ desc, @@ -18,6 +19,7 @@ const Index: FC = ({ enumValues, enumNames, formData, + readOnly = false, }) => { const fieldObject = formData[fieldName]; const handleChange = (evt: React.ChangeEvent) => { @@ -40,6 +42,7 @@ const Index: FC = ({ name={fieldName} value={fieldObject?.value || ''} onChange={handleChange} + disabled={readOnly} isInvalid={fieldObject?.isInvalid}> {enumValues?.map((item, index) => { return ( diff --git a/ui/src/components/SchemaForm/components/Textarea.tsx b/ui/src/components/SchemaForm/components/Textarea.tsx index ed504102..792465cc 100644 --- a/ui/src/components/SchemaForm/components/Textarea.tsx +++ b/ui/src/components/SchemaForm/components/Textarea.tsx @@ -12,6 +12,7 @@ interface Props { fieldName: string; onChange?: (fd: Type.FormDataType) => void; formData: Type.FormDataType; + readOnly: boolean; } const Index: FC = ({ placeholder = '', @@ -20,6 +21,7 @@ const Index: FC = ({ fieldName, onChange, formData, + readOnly = false, }) => { const fieldObject = formData[fieldName]; const handleChange = (evt: React.ChangeEvent) => { @@ -46,6 +48,7 @@ const Index: FC = ({ onChange={handleChange} isInvalid={fieldObject?.isInvalid} rows={rows} + disabled={readOnly} className={classnames(className)} /> ); diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsx index bdf32087..7233fc71 100644 --- a/ui/src/components/SchemaForm/index.tsx +++ b/ui/src/components/SchemaForm/index.tsx @@ -369,6 +369,7 @@ const SchemaForm: ForwardRefRenderFunction = ( enumValues={enumValues} enumNames={enumNames} formData={formData} + readOnly={readOnly} /> ) : null} {widget === 'radio' || widget === 'checkbox' ? ( @@ -420,6 +421,7 @@ const SchemaForm: ForwardRefRenderFunction = ( fieldName={key} onChange={onChange} formData={formData} + readOnly={readOnly} /> ) : null} {widget === 'input' ? ( diff --git a/ui/src/components/UploadImg/index.tsx b/ui/src/components/UploadImg/index.tsx index 07dde645..896c698e 100644 --- a/ui/src/components/UploadImg/index.tsx +++ b/ui/src/components/UploadImg/index.tsx @@ -1,12 +1,14 @@ import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; +import classnames from 'classnames'; + import { uploadImage } from '@/services'; import * as Type from '@/common/interface'; interface IProps { type: Type.UploadType; - className?: string; + className?: classnames.Argument; children?: React.ReactNode; acceptType?: string; disabled?: boolean; @@ -49,7 +51,8 @@ const Index: React.FC = ({ }; return ( -