mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
feat(console): add support fields config to sie (#6792)
add support fields to sie page
This commit is contained in:
parent
ae4b65bc26
commit
1c0b29fb13
3 changed files with 56 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
|||
import { emailRegEx } from '@logto/core-kit';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import Card from '@/ds-components/Card';
|
||||
import FormField from '@/ds-components/FormField';
|
||||
import TextInput from '@/ds-components/TextInput';
|
||||
import { type SignInExperienceForm } from '@/pages/SignInExperience/types';
|
||||
import { uriValidator } from '@/utils/validator';
|
||||
|
||||
import FormSectionTitle from '../../components/FormSectionTitle';
|
||||
|
||||
function SupportForm() {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const {
|
||||
register,
|
||||
formState: { errors },
|
||||
control,
|
||||
} = useFormContext<SignInExperienceForm>();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<FormSectionTitle title="content.support.title" />
|
||||
<FormField title="sign_in_exp.content.support.support_email">
|
||||
<TextInput
|
||||
{...register('supportEmail', {
|
||||
pattern: { value: emailRegEx, message: t('errors.email_pattern_error') },
|
||||
})}
|
||||
error={errors.supportEmail?.message}
|
||||
placeholder={t('sign_in_exp.content.support.support_email_placeholder')}
|
||||
/>
|
||||
</FormField>
|
||||
<FormField title="sign_in_exp.content.support.support_website">
|
||||
<TextInput
|
||||
{...register('supportWebsiteUrl', {
|
||||
validate: (value) => !value || uriValidator(value) || t('errors.invalid_uri_format'),
|
||||
})}
|
||||
error={errors.supportWebsiteUrl?.message}
|
||||
placeholder={t('sign_in_exp.content.support.support_website_placeholder')}
|
||||
/>
|
||||
</FormField>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
export default SupportForm;
|
|
@ -1,8 +1,10 @@
|
|||
import PageMeta from '@/components/PageMeta';
|
||||
import { isDevFeaturesEnabled } from '@/consts/env';
|
||||
|
||||
import SignInExperienceTabWrapper from '../components/SignInExperienceTabWrapper';
|
||||
|
||||
import LanguagesForm from './LanguagesForm';
|
||||
import SupportForm from './SupportForm';
|
||||
import TermsForm from './TermsForm';
|
||||
|
||||
type Props = {
|
||||
|
@ -14,6 +16,7 @@ function Content({ isActive }: Props) {
|
|||
<SignInExperienceTabWrapper isActive={isActive}>
|
||||
{isActive && <PageMeta titleKey={['sign_in_exp.tabs.content', 'sign_in_exp.page_title']} />}
|
||||
<TermsForm />
|
||||
{isDevFeaturesEnabled && <SupportForm />}
|
||||
<LanguagesForm isManageLanguageVisible />
|
||||
</SignInExperienceTabWrapper>
|
||||
);
|
||||
|
|
|
@ -24,6 +24,13 @@ const content = {
|
|||
default_language_description_fixed:
|
||||
'When auto-detect is off, the default language is the only language your software will show. Turn on auto-detect for language extension.',
|
||||
},
|
||||
support: {
|
||||
title: 'SUPPORT',
|
||||
support_email: 'Support email',
|
||||
support_email_placeholder: 'support@email.com',
|
||||
support_website: 'Support website',
|
||||
support_website_placeholder: 'https://your.website/support',
|
||||
},
|
||||
manage_language: {
|
||||
title: 'Manage language',
|
||||
subtitle:
|
||||
|
|
Loading…
Reference in a new issue