Skip to content

Commit 91682df

Browse files
ClemsazertSimonClo
authored andcommitted
✨ allow hiding create db option
1 parent fa9cfd4 commit 91682df

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/DatabaseSelector.tsx

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import { useDocStore } from '../../doc-management';
1010

1111
type DatabaseSelectorProps = {
1212
onDatabaseSelected: (args: { documentId: string; tableId: string }) => void;
13+
allowCreateSource?: boolean;
1314
};
1415

1516
export const DatabaseSelector = ({
1617
onDatabaseSelected,
18+
allowCreateSource = false,
1719
}: DatabaseSelectorProps) => {
1820
const { createTable } = useGristCreateDocAndTable();
1921
const { currentDoc } = useDocStore();
@@ -47,25 +49,36 @@ export const DatabaseSelector = ({
4749
<Icon iconName="storage" color="rgb(62, 152, 255)" />
4850
</Box>
4951
<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+
)}
5155
<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&apos;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&apos;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+
)}
6982
<Option>
7083
<Box style={{ marginBottom: 10 }}>
7184
<OptionTitle>

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/DatabaseBlock.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const DatabaseBlock = createReactBlockSpec(
5757
props: { documentId: documentId.toString(), tableId },
5858
});
5959
}}
60+
allowCreateSource
6061
/>
6162
)}
6263
</Box>

0 commit comments

Comments
 (0)