2
0

🚸 (sendEmail) Make custom sender name optional

This commit is contained in:
Baptiste Arnaud
2022-11-14 11:02:30 +01:00
parent d01549fee6
commit 3686465a85
17 changed files with 75 additions and 105 deletions

View File

@ -24,8 +24,7 @@ export const ChoiceInputSettingsBody = ({
return (
<Stack spacing={4}>
<SwitchWithLabel
id={'is-multiple'}
label={'Multiple choice?'}
label="Multiple choice?"
initialValue={options?.isMultipleChoice ?? false}
onCheckChange={handleIsMultipleChange}
/>

View File

@ -33,7 +33,6 @@ export const CodeSettings = ({ options, onOptionsChange }: Props) => {
/>
</Stack>
<SwitchWithLabel
id="shouldExecuteInParentContext"
label="Execute in parent window"
moreInfoContent="Execute the code in the parent window context (when the bot is embedded). If it isn't detected, the code will be executed in the current window context."
initialValue={options.shouldExecuteInParentContext ?? false}

View File

@ -30,14 +30,12 @@ export const DateInputSettingsBody = ({
return (
<Stack spacing={4}>
<SwitchWithLabel
id="is-range"
label={'Is range?'}
label="Is range?"
initialValue={options.isRange}
onCheckChange={handleIsRangeChange}
/>
<SwitchWithLabel
id="with-time"
label={'With time?'}
label="With time?"
initialValue={options.isRange}
onCheckChange={handleHasTimeChange}
/>

View File

@ -28,13 +28,11 @@ export const FileInputSettings = ({ options, onOptionsChange }: Props) => {
return (
<Stack spacing={4}>
<SwitchWithLabel
id="required"
label="Required?"
initialValue={options.isRequired ?? true}
onCheckChange={handleRequiredChange}
/>
<SwitchWithLabel
id="switch"
label="Allow multiple files?"
initialValue={options.isMultipleAllowed}
onCheckChange={handleMultipleFilesChange}

View File

@ -68,7 +68,6 @@ export const RatingInputSettings = ({
{options.buttonType === 'Icons' && (
<SwitchWithLabel
id="switch"
label="Custom icon?"
initialValue={options.customIcon.isEnabled}
onCheckChange={handleCustomIconCheck}

View File

@ -29,7 +29,6 @@ export const RedirectSettings = ({ options, onOptionsChange }: Props) => {
/>
</Stack>
<SwitchWithLabel
id="new-tab"
label="Open in new tab?"
initialValue={options.isNewTab}
onCheckChange={handleIsNewTabChange}

View File

@ -154,7 +154,6 @@ export const SendEmailSettings = ({ options, onOptionsChange }: Props) => {
/>
</Stack>
<SwitchWithLabel
id={'custom-body'}
label={'Custom content?'}
initialValue={options.isCustomBody ?? false}
onCheckChange={handleIsCustomBodyChange}

View File

@ -28,60 +28,53 @@ export const SmtpConfigForm = ({ config, onConfigChange }: Props) => {
return (
<Stack as="form" spacing={4}>
<FormControl isRequired>
<FormLabel>From email:</FormLabel>
<Input
defaultValue={config.from.email ?? ''}
onChange={handleFromEmailChange}
placeholder="notifications@provider.com"
withVariableButton={false}
/>
</FormControl>
<FormControl isRequired>
<FormLabel>From name:</FormLabel>
<Input
defaultValue={config.from.name ?? ''}
onChange={handleFromNameChange}
placeholder="John Smith"
withVariableButton={false}
/>
</FormControl>
<FormControl isRequired>
<FormLabel>Host:</FormLabel>
<Input
defaultValue={config.host ?? ''}
onChange={handleHostChange}
placeholder="mail.provider.com"
withVariableButton={false}
/>
</FormControl>
<FormControl isRequired>
<FormLabel>Username / Email:</FormLabel>
<Input
type="email"
defaultValue={config.username ?? ''}
onChange={handleUsernameChange}
placeholder="user@provider.com"
withVariableButton={false}
/>
</FormControl>
<FormControl isRequired>
<FormLabel>Password:</FormLabel>
<Input
type="password"
defaultValue={config.password ?? ''}
onChange={handlePasswordChange}
withVariableButton={false}
/>
</FormControl>
<Input
isRequired
label="From email"
defaultValue={config.from.email ?? ''}
onChange={handleFromEmailChange}
placeholder="notifications@provider.com"
withVariableButton={false}
/>
<Input
label="From name"
defaultValue={config.from.name ?? ''}
onChange={handleFromNameChange}
placeholder="John Smith"
withVariableButton={false}
/>
<Input
isRequired
label="Host"
defaultValue={config.host ?? ''}
onChange={handleHostChange}
placeholder="mail.provider.com"
withVariableButton={false}
/>
<Input
isRequired
label="Username / Email"
type="email"
defaultValue={config.username ?? ''}
onChange={handleUsernameChange}
placeholder="user@provider.com"
withVariableButton={false}
/>
<Input
isRequired
label="Password"
type="password"
defaultValue={config.password ?? ''}
onChange={handlePasswordChange}
withVariableButton={false}
/>
<SwitchWithLabel
id="Tls"
label={'Secure?'}
label="Secure?"
initialValue={config.isTlsEnabled ?? false}
onCheckChange={handleTlsCheck}
moreInfoContent="If enabled, the connection will use TLS when connecting to server. If disabled then TLS is used if server supports the STARTTLS extension. In most cases enable it if you are connecting to port 465. For port 587 or 25 keep it disabled."
/>
<FormControl as={HStack} justifyContent="space-between">
<FormControl as={HStack} justifyContent="space-between" isRequired>
<FormLabel mb="0">Port number:</FormLabel>
<SmartNumberInput
placeholder="25"

View File

@ -83,10 +83,10 @@ export const SmtpConfigModal = ({
onClick={handleCreateClick}
isDisabled={
isNotDefined(smtpConfig.from.email) ||
isNotDefined(smtpConfig.from.name) ||
isNotDefined(smtpConfig.host) ||
isNotDefined(smtpConfig.username) ||
isNotDefined(smtpConfig.password)
isNotDefined(smtpConfig.password) ||
isNotDefined(smtpConfig.port)
}
isLoading={isCreating}
>

View File

@ -26,7 +26,6 @@ export const TextInputSettingsBody = ({
return (
<Stack spacing={4}>
<SwitchWithLabel
id="switch"
label="Long text?"
initialValue={options?.isLong ?? false}
onCheckChange={handleLongChange}

View File

@ -172,7 +172,6 @@ export const WebhookSettings = ({
withVariableButton={!provider}
/>
<SwitchWithLabel
id={'easy-config'}
label="Advanced configuration"
initialValue={options.isAdvancedConfig ?? true}
onCheckChange={handleAdvancedConfigChange}
@ -225,7 +224,6 @@ export const WebhookSettings = ({
</AccordionButton>
<AccordionPanel pb={4} as={Stack} spacing="6">
<SwitchWithLabel
id={'custom-body'}
label="Custom body"
initialValue={options.isCustomBody ?? true}
onCheckChange={handleBodyFormStateChange}