diff --git a/apps/admin-x-design-system/src/global/form/TextArea.stories.tsx b/apps/admin-x-design-system/src/global/form/TextArea.stories.tsx index b0b912b131..611bfa14dd 100644 --- a/apps/admin-x-design-system/src/global/form/TextArea.stories.tsx +++ b/apps/admin-x-design-system/src/global/form/TextArea.stories.tsx @@ -80,15 +80,6 @@ export const ResizeDisabled: Story = { } }; -export const MaxLength: Story = { - args: { - title: 'Description', - placeholder: 'Try to enter more than 80 characters, I dare you...', - value: 'This is a nice text area that only accepts up to 80 characters. Try to add more:', - maxLength: 80 - } -}; - export const Error: Story = { args: { title: 'Description', diff --git a/apps/admin-x-design-system/src/global/form/TextArea.tsx b/apps/admin-x-design-system/src/global/form/TextArea.tsx index 8c554eb12c..6a3c1e3b66 100644 --- a/apps/admin-x-design-system/src/global/form/TextArea.tsx +++ b/apps/admin-x-design-system/src/global/form/TextArea.tsx @@ -97,7 +97,6 @@ const TextArea: React.FC = ({ {title && {title}} {hint && {hint}} - {maxLength && Max length is {maxLength}} ); }; diff --git a/apps/admin-x-settings/src/components/settings/advanced/integrations/AddIntegrationModal.tsx b/apps/admin-x-settings/src/components/settings/advanced/integrations/AddIntegrationModal.tsx index fc2e8a1796..8aee196bf0 100644 --- a/apps/admin-x-settings/src/components/settings/advanced/integrations/AddIntegrationModal.tsx +++ b/apps/admin-x-settings/src/components/settings/advanced/integrations/AddIntegrationModal.tsx @@ -63,6 +63,7 @@ const AddIntegrationModal: React.FC = () => { autoFocus={true} error={!!errors.name} hint={errors.name} + maxLength={191} placeholder='Custom integration' title='Name' value={name} diff --git a/apps/admin-x-settings/src/components/settings/advanced/integrations/CustomIntegrationModal.tsx b/apps/admin-x-settings/src/components/settings/advanced/integrations/CustomIntegrationModal.tsx index 7bdb5c88c5..7037a694b8 100644 --- a/apps/admin-x-settings/src/components/settings/advanced/integrations/CustomIntegrationModal.tsx +++ b/apps/admin-x-settings/src/components/settings/advanced/integrations/CustomIntegrationModal.tsx @@ -2,6 +2,7 @@ import APIKeys from './APIKeys'; import NiceModal, {useModal} from '@ebay/nice-modal-react'; import React, {useEffect, useState} from 'react'; import WebhooksTable from './WebhooksTable'; +import {APIError} from '@tryghost/admin-x-framework/errors'; import {APIKey, useRefreshAPIKey} from '@tryghost/admin-x-framework/api/apiKeys'; import {ConfirmationModal, Form, ImageUpload, Modal, TextField, showToast} from '@tryghost/admin-x-design-system'; import {Integration, useBrowseIntegrations, useEditIntegration} from '@tryghost/admin-x-framework/api/integrations'; @@ -112,7 +113,11 @@ const CustomIntegrationModalContent: React.FC<{integration: Integration}> = ({in const imageUrl = getImageUrl(await uploadImage({file})); updateForm(state => ({...state, icon_image: imageUrl})); } catch (e) { - handleError(e); + const error = e as APIError; + if (error.response!.status === 415) { + error.message = 'Unsupported file type'; + } + handleError(error); } }} > @@ -124,12 +129,13 @@ const CustomIntegrationModalContent: React.FC<{integration: Integration}> = ({in updateForm(state => ({...state, name: e.target.value}))} onKeyDown={() => clearError('name')} /> - updateForm(state => ({...state, description: e.target.value}))} /> + updateForm(state => ({...state, description: e.target.value}))} /> = ({webhook, integrationId}) => = ({webhook, integrationId}) => = ({webhook, integrationId}) => onKeyDown={() => clearError('target_url')} /> = ({keywords}) => { onOk: confirmModal => confirmModal?.remove() }); } catch (e) { - let prompt = 'There was an error verifying your email address. Please try again.'; + let prompt = 'There was an error verifying your email address. Try again later.'; if (e instanceof APIError && e.message === 'Token expired') { - prompt = 'The verification link has expired. Please try again.'; + prompt = 'Verification link has expired.'; } NiceModal.show(ConfirmationModal, { title: 'Error verifying email address', diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx index 87ee38e7a5..7466604e0d 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/AddNewsletterModal.tsx @@ -97,6 +97,7 @@ const AddNewsletterModal: React.FC = () => { autoFocus={true} error={Boolean(errors.name)} hint={errors.name} + maxLength={191} placeholder='Weekly roundup' title='Name' value={formState.name} @@ -104,6 +105,7 @@ const AddNewsletterModal: React.FC = () => { onKeyDown={() => clearError('name')} />