@@ -10,10 +10,12 @@ import { useDocStore } from '../../doc-management';
10
10
11
11
type DatabaseSelectorProps = {
12
12
onDatabaseSelected : ( args : { documentId : string ; tableId : string } ) => void ;
13
+ allowCreateSource ?: boolean ;
13
14
} ;
14
15
15
16
export const DatabaseSelector = ( {
16
17
onDatabaseSelected,
18
+ allowCreateSource = false ,
17
19
} : DatabaseSelectorProps ) => {
18
20
const { createTable } = useGristCreateDocAndTable ( ) ;
19
21
const { currentDoc } = useDocStore ( ) ;
@@ -47,25 +49,36 @@ export const DatabaseSelector = ({
47
49
< Icon iconName = "storage" color = "rgb(62, 152, 255)" />
48
50
</ Box >
49
51
< Title > Source de données</ Title >
50
- < Description > Choisissez votre méthode de création</ Description >
52
+ { allowCreateSource && (
53
+ < Description > Choisissez votre méthode de création</ Description >
54
+ ) }
51
55
< OptionsWrapper >
52
- < Option >
53
- < Box
54
- style = { { flexDirection : 'row' , justifyContent : 'space-between' } }
55
- >
56
- < Box >
57
- < OptionTitle > Créer une nouvelle base de données vide</ OptionTitle >
58
- < Description >
59
- Partir d'une base de données vierge
60
- </ Description >
61
- </ Box >
62
- < Button
63
- onClick = { handleCreateNewDatabase }
64
- icon = { < Icon iconName = "add" $color = "white" /> }
65
- > </ Button >
66
- </ Box >
67
- </ Option >
68
- < Text style = { { fontWeight : 600 , fontSize : 14 } } > ou</ Text >
56
+ { allowCreateSource && (
57
+ < >
58
+ < Option >
59
+ < Box
60
+ style = { {
61
+ flexDirection : 'row' ,
62
+ justifyContent : 'space-between' ,
63
+ } }
64
+ >
65
+ < Box >
66
+ < OptionTitle >
67
+ Créer une nouvelle base de données vide
68
+ </ OptionTitle >
69
+ < Description >
70
+ Partir d'une base de données vierge
71
+ </ Description >
72
+ </ Box >
73
+ < Button
74
+ onClick = { handleCreateNewDatabase }
75
+ icon = { < Icon iconName = "add" $color = "white" /> }
76
+ > </ Button >
77
+ </ Box >
78
+ </ Option >
79
+ < Text style = { { fontWeight : 600 , fontSize : 14 } } > ou</ Text >
80
+ </ >
81
+ ) }
69
82
< Option >
70
83
< Box style = { { marginBottom : 10 } } >
71
84
< OptionTitle >
0 commit comments