@@ -4,7 +4,7 @@ import { linkRelationTypes } from '@app-builder/models';
44import { useDataModelFeatureAccess } from '@app-builder/services/data/data-model' ;
55import { useMemo } from 'react' ;
66import { useTranslation } from 'react-i18next' ;
7- import { Button , cn , Input , SelectV2 , Typo } from 'ui-design-system' ;
7+ import { Button , Collapsible , cn , Input , SelectV2 , Typo } from 'ui-design-system' ;
88import { Icon } from 'ui-icons' ;
99import { DatatypeIcon } from './DatatypeOption' ;
1010
@@ -30,47 +30,54 @@ export function LinkForm({
3030 const belongsToFieldNames = belongsToLinks . map ( ( link ) => link . tableFieldId ) . filter ( Boolean ) ;
3131
3232 return (
33- < section className = { cn ( 'flex flex-col gap-md rounded-lg ' , hasError && 'bg-red-primary/5 p-sm ' ) } >
34- < div className = "flex flex-col gap-xs ">
33+ < Collapsible . Container className = { cn ( 'border-none p-0 ' , hasError && 'bg-red-primary/5' ) } defaultOpen >
34+ < Collapsible . Title size = "xs" iconPosition = "left ">
3535 < Typo variant = "subtitle2" > { t ( 'data:upload_data.links_title' ) } </ Typo >
36- < p className = "text-s text-grey-secondary" >
37- { t ( 'data:upload_data.links_description' , { tableName : tableLabel } ) }
38- </ p >
39- </ div >
40- { belongsToLinks . length > 1 ? (
41- < Callout color = "orange" icon = "warning" iconColor = "orange" >
42- < span >
43- { t ( 'data:upload_data.multiple_belongs_to_warning' , { tableName : tableLabel } ) }
44- { belongsToFieldNames . length > 0
45- ? ` ${ t ( 'data:upload_data.multiple_belongs_to_warning_fields' , {
46- fields : belongsToFieldNames . join ( ', ' ) ,
47- } ) } `
48- : null }
49- </ span >
50- </ Callout >
51- ) : null }
52- < div className = "flex flex-col gap-md" >
53- { links . map ( ( link ) => (
54- < LinkRow key = { link . linkId } linkId = { link . linkId } compact = { compact } hasError = { errorLinkIds ?. has ( link . linkId ) } />
55- ) ) }
56- </ div >
57- { isCreateDataModelLinkAvailable && (
58- < div className = "flex items-center gap-sm" >
59- < Button
60- variant = "primary"
61- appearance = "stroked"
62- onClick = { ( ) => addLink ( ) }
63- disabled = { ! destinationTableOptions . length }
64- >
65- < Icon icon = "plus" className = "size-4" />
66- { t ( 'data:upload_data.link_add' ) }
67- </ Button >
68- { ! destinationTableOptions . length && (
69- < span className = "text-grey-secondary" > { t ( 'data:create_table.link_destination_table_required' ) } </ span >
36+ </ Collapsible . Title >
37+ < Collapsible . Content className = "border-none" size = "xs" >
38+ < div className = "flex flex-col gap-md" >
39+ < p className = "text-s text-grey-secondary font-normal" >
40+ { t ( 'data:upload_data.links_description' , { tableName : tableLabel } ) }
41+ </ p >
42+ { belongsToLinks . length > 1 ? (
43+ < Callout color = "orange" icon = "warning" iconColor = "orange" >
44+ < span >
45+ { t ( 'data:upload_data.multiple_belongs_to_warning' , { tableName : tableLabel } ) }
46+ { belongsToFieldNames . length > 0
47+ ? ` ${ t ( 'data:upload_data.multiple_belongs_to_warning_fields' , {
48+ fields : belongsToFieldNames . join ( ', ' ) ,
49+ } ) } `
50+ : null }
51+ </ span >
52+ </ Callout >
53+ ) : null }
54+ { links . map ( ( link ) => (
55+ < LinkRow
56+ key = { link . linkId }
57+ linkId = { link . linkId }
58+ compact = { compact }
59+ hasError = { errorLinkIds ?. has ( link . linkId ) }
60+ />
61+ ) ) }
62+ { isCreateDataModelLinkAvailable && (
63+ < div className = "flex items-center gap-sm" >
64+ < Button
65+ variant = "primary"
66+ appearance = "stroked"
67+ onClick = { ( ) => addLink ( ) }
68+ disabled = { ! destinationTableOptions . length }
69+ >
70+ < Icon icon = "plus" className = "size-4" />
71+ { t ( 'data:upload_data.link_add' ) }
72+ </ Button >
73+ { ! destinationTableOptions . length && (
74+ < span className = "text-grey-secondary" > { t ( 'data:create_table.link_destination_table_required' ) } </ span >
75+ ) }
76+ </ div >
7077 ) }
7178 </ div >
72- ) }
73- </ section >
79+ </ Collapsible . Content >
80+ </ Collapsible . Container >
7481 ) ;
7582}
7683
0 commit comments