From a8cb4dc2f44f32ffeed9e467077eb37c1a7f6229 Mon Sep 17 00:00:00 2001 From: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:26:18 +0100 Subject: [PATCH] Press enter to add to blocklist (#3847) * Press enter to add to blocklist * Add support for using ts-key-enum in SettingsAccountsEmailsBlocklistInput * Sort imports --- .../SettingsAccountsEmailsBlocklistInput.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsBlocklistInput.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsBlocklistInput.tsx index bfc8ca7cb..754c5c935 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsBlocklistInput.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsBlocklistInput.tsx @@ -1,5 +1,6 @@ import { useState } from 'react'; import styled from '@emotion/styled'; +import { Key } from 'ts-key-enum'; import { Button } from '@/ui/input/button/components/Button'; import { TextInput } from '@/ui/input/components/TextInput'; @@ -27,6 +28,14 @@ export const SettingsAccountsEmailsBlocklistInput = ({ }>({ email: '', }); + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === Key.Enter) { + updateBlockedEmailList(formValues.email); + setFormValues({ email: '' }); + } + }; + return ( @@ -40,6 +49,7 @@ export const SettingsAccountsEmailsBlocklistInput = ({ })); }} fullWidth + onKeyDown={handleKeyDown} />