@@ -5,7 +5,6 @@ import { IconCheck, IconPlus } from 'twenty-ui';
5
5
6
6
import { useLinksField } from '@/object-record/record-field/meta-types/hooks/useLinksField' ;
7
7
import { LinksFieldMenuItem } from '@/object-record/record-field/meta-types/input/components/LinksFieldMenuItem' ;
8
- import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent' ;
9
8
import { LightIconButton } from '@/ui/input/button/components/LightIconButton' ;
10
9
import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu' ;
11
10
import { DropdownMenuInput } from '@/ui/layout/dropdown/components/DropdownMenuInput' ;
@@ -27,13 +26,9 @@ const StyledDropdownMenu = styled(DropdownMenu)`
27
26
28
27
export type LinksFieldInputProps = {
29
28
onCancel ?: ( ) => void ;
30
- onSubmit ?: FieldInputEvent ;
31
29
} ;
32
30
33
- export const LinksFieldInput = ( {
34
- onCancel,
35
- onSubmit,
36
- } : LinksFieldInputProps ) => {
31
+ export const LinksFieldInput = ( { onCancel } : LinksFieldInputProps ) => {
37
32
const { persistLinksField, hotkeyScope, fieldValue } = useLinksField ( ) ;
38
33
39
34
const containerRef = useRef < HTMLDivElement > ( null ) ;
@@ -99,7 +94,6 @@ export const LinksFieldInput = ({
99
94
) {
100
95
setIsInputDisplayed ( false ) ;
101
96
setInputValue ( '' ) ;
102
- onCancel ?.( ) ;
103
97
return ;
104
98
}
105
99
@@ -109,14 +103,11 @@ export const LinksFieldInput = ({
109
103
: toSpliced ( links , linkToEditIndex , 1 , linkValue ) ;
110
104
const [ nextPrimaryLink , ...nextSecondaryLinks ] = nextLinks ;
111
105
112
- onSubmit ?.( ( ) =>
113
- persistLinksField ( {
114
- primaryLinkUrl : nextPrimaryLink . url ?? '' ,
115
- primaryLinkLabel : nextPrimaryLink . label ?? '' ,
116
- secondaryLinks : nextSecondaryLinks ,
117
- } ) ,
118
- ) ;
119
-
106
+ persistLinksField ( {
107
+ primaryLinkUrl : nextPrimaryLink . url ?? '' ,
108
+ primaryLinkLabel : nextPrimaryLink . label ?? '' ,
109
+ secondaryLinks : nextSecondaryLinks ,
110
+ } ) ;
120
111
setIsInputDisplayed ( false ) ;
121
112
setInputValue ( '' ) ;
122
113
} ;
@@ -125,26 +116,18 @@ export const LinksFieldInput = ({
125
116
const nextLinks = moveArrayItem ( links , { fromIndex : index , toIndex : 0 } ) ;
126
117
const [ nextPrimaryLink , ...nextSecondaryLinks ] = nextLinks ;
127
118
128
- onSubmit ?.( ( ) =>
129
- persistLinksField ( {
130
- primaryLinkUrl : nextPrimaryLink . url ?? '' ,
131
- primaryLinkLabel : nextPrimaryLink . label ?? '' ,
132
- secondaryLinks : nextSecondaryLinks ,
133
- } ) ,
134
- ) ;
119
+ persistLinksField ( {
120
+ primaryLinkUrl : nextPrimaryLink . url ?? '' ,
121
+ primaryLinkLabel : nextPrimaryLink . label ?? '' ,
122
+ secondaryLinks : nextSecondaryLinks ,
123
+ } ) ;
135
124
} ;
136
125
137
126
const handleDeleteLink = ( index : number ) => {
138
- onSubmit ?.( ( ) =>
139
- persistLinksField ( {
140
- ...fieldValue ,
141
- secondaryLinks : toSpliced (
142
- fieldValue . secondaryLinks ?? [ ] ,
143
- index - 1 ,
144
- 1 ,
145
- ) ,
146
- } ) ,
147
- ) ;
127
+ persistLinksField ( {
128
+ ...fieldValue ,
129
+ secondaryLinks : toSpliced ( fieldValue . secondaryLinks ?? [ ] , index - 1 , 1 ) ,
130
+ } ) ;
148
131
} ;
149
132
150
133
return (
0 commit comments