diff --git a/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx b/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx index ce75e12ee68df..fdef7a3da5857 100644 --- a/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx +++ b/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx @@ -1,4 +1,4 @@ -import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box } from '@rocket.chat/fuselage'; +import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box, FieldError } from '@rocket.chat/fuselage'; import { GenericModal } from '@rocket.chat/ui-client'; import { useEffect, useId } from 'react'; import { useForm, Controller } from 'react-hook-form'; @@ -15,8 +15,8 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin const textField = useId(); const urlField = useId(); - const { handleSubmit, setFocus, control } = useForm({ - mode: 'onBlur', + const { handleSubmit, setFocus, control, formState } = useForm({ + mode: 'onChange', defaultValues: { text: selectedText || '', url: '', @@ -40,6 +40,7 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin confirmText={t('Add')} onCancel={onClose} wrapperFunction={(props) => void submit(e)} {...props} />} + confirmDisabled={!formState.isValid} title={t('Add_link')} > @@ -52,8 +53,23 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin {t('URL')} - } /> + } + /> + {formState.errors.url?.message} diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 465ee29d3896b..371634f6f1202 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -5422,6 +5422,8 @@ "UI_Use_Real_Name": "Use Real Name", "URL": "URL", "URLs": "URLs", + "URL_is_required": "URL is required", + "URL_must_start_with_'http://'_or_'https://'": "URL must start with 'http://' or 'https://'", "UTC_Timezone": "UTC Timezone", "UTF8_Channel_Names_Validation": "UTF8 Channel Names Validation", "UTF8_Channel_Names_Validation_Description": "RegExp that will be used to validate channel names", diff --git a/packages/i18n/src/locales/es.i18n.json b/packages/i18n/src/locales/es.i18n.json index bafc601ea69b7..c73e63241684c 100644 --- a/packages/i18n/src/locales/es.i18n.json +++ b/packages/i18n/src/locales/es.i18n.json @@ -3866,6 +3866,8 @@ "UI_Use_Name_Avatar": "Usar iniciales del nombre completo para generar un avatar por defecto", "UI_Use_Real_Name": "Usar nombre real", "URL": "URL", + "URL_is_required": "La URL es obligatoria", + "URL_must_start_with_'http://'_or_'https://'": "La URL debe comenzar con 'http://' o 'https://'", "UTC_Timezone": "Zona horaria UTC", "UTF8_Channel_Names_Validation": "Validación de nombres de Channel UTF8", "UTF8_Channel_Names_Validation_Description": "Regex que se usará para validar los nombres de canal", diff --git a/packages/i18n/src/locales/hi-IN.i18n.json b/packages/i18n/src/locales/hi-IN.i18n.json index 49e593aeaf763..1edebc23b9247 100644 --- a/packages/i18n/src/locales/hi-IN.i18n.json +++ b/packages/i18n/src/locales/hi-IN.i18n.json @@ -4405,6 +4405,7 @@ "Test_Connection": "परीक्षण कनेक्शन", "Test_Desktop_Notifications": "डेस्कटॉप सूचनाओं का परीक्षण करें", "Test_LDAP_Search": "एलडीएपी खोज का परीक्षण करें", + "Text": "टेक्स्ट", "Texts": "ग्रंथों", "Thank_You_For_Choosing_RocketChat": "रॉकेट.चैट चुनने के लिए धन्यवाद!", "Thank_you_exclamation_mark": "धन्यवाद!", @@ -4594,6 +4595,8 @@ "UI_Use_Real_Name": "वास्तविक नाम का प्रयोग करें", "URL": "यूआरएल", "URLs": "यूआरएल", + "URL_is_required": "यूआरएल आवश्यक है", + "URL_must_start_with_'http://'_or_'https://'": "यूआरएल की शुरुआत 'http://' या 'https://' से होनी चाहिए।", "UTC_Timezone": "यूटीसी समय क्षेत्र", "UTF8_Channel_Names_Validation": "UTF8 चैनल नाम सत्यापन", "UTF8_Channel_Names_Validation_Description": "रेगएक्सपी जिसका उपयोग चैनल नामों को मान्य करने के लिए किया जाएगा", diff --git a/packages/i18n/src/locales/pt-BR.i18n.json b/packages/i18n/src/locales/pt-BR.i18n.json index a900f91c981c6..b9fc88ed062a2 100644 --- a/packages/i18n/src/locales/pt-BR.i18n.json +++ b/packages/i18n/src/locales/pt-BR.i18n.json @@ -5154,6 +5154,8 @@ "UI_Use_Real_Name": "Usar o nome verdadeiro", "URL": "URL", "URLs": "URLs", + "URL_is_required": "URL é obrigatório", + "URL_must_start_with_'http://'_or_'https://'": "A URL deve começar com 'http://' ou 'https://'", "UTC_Timezone": "Fuso horário UTC", "UTF8_Channel_Names_Validation": "Validação de nomes de canal UTF8", "UTF8_Channel_Names_Validation_Description": "RegExp que será usado para validar nomes de canais",