diff --git a/src/dialogs/common/import-database/import-database.tsx b/src/dialogs/common/import-database/import-database.tsx index 08d0777b..e1747aa6 100644 --- a/src/dialogs/common/import-database/import-database.tsx +++ b/src/dialogs/common/import-database/import-database.tsx @@ -173,130 +173,149 @@ export const ImportDatabase: React.FC = ({ ); }, [title]); + const renderInstructions = useCallback( + () => ( + + ), + [ + databaseType, + importMethod, + setDatabaseEdition, + setImportMethod, + databaseEdition, + setShowSSMSInfoDialog, + showSSMSInfoDialog, + ] + ); + + const renderOutputTextArea = useCallback( + () => ( +
+
+ {importMethod === 'query' + ? 'Smart Query Output' + : 'SQL DDL'} +
+
+ }> + } + theme={ + effectiveTheme === 'dark' + ? 'dbml-dark' + : 'dbml-light' + } + options={{ + minimap: { enabled: false }, + scrollBeyondLastLine: false, + automaticLayout: true, + glyphMargin: false, + lineNumbers: 'on', + guides: { + indentation: false, + }, + folding: true, + lineNumbersMinChars: 3, + renderValidationDecorations: 'off', + lineDecorationsWidth: 0, + overviewRulerBorder: false, + overviewRulerLanes: 0, + hideCursorInOverviewRuler: true, + contextmenu: false, + + scrollbar: { + vertical: 'hidden', + horizontal: 'hidden', + alwaysConsumeMouseWheel: false, + }, + }} + className="size-full min-h-40" + /> + +
+ + {showCheckJsonButton || errorMessage ? ( +
+ {showCheckJsonButton ? ( + + ) : ( +

+ {errorMessage} +

+ )} +
+ ) : null} +
+ ), + [ + errorMessage, + scriptResult, + importMethod, + effectiveTheme, + debouncedHandleInputChange, + showCheckJsonButton, + isCheckingJson, + handleCheckJson, + t, + ] + ); + const renderContent = useCallback(() => { return ( - - - - - {isDesktop ? : null} - -
-
- {importMethod === 'query' - ? 'Smart Query Output' - : 'SQL DDL'} -
-
- }> - } - theme={ - effectiveTheme === 'dark' - ? 'dbml-dark' - : 'dbml-light' - } - options={{ - minimap: { enabled: false }, - scrollBeyondLastLine: false, - automaticLayout: true, - glyphMargin: false, - lineNumbers: 'on', - guides: { - indentation: false, - }, - folding: true, - lineNumbersMinChars: 3, - renderValidationDecorations: 'off', - lineDecorationsWidth: 0, - overviewRulerBorder: false, - overviewRulerLanes: 0, - hideCursorInOverviewRuler: true, - contextmenu: false, - - scrollbar: { - vertical: 'hidden', - horizontal: 'hidden', - alwaysConsumeMouseWheel: false, - }, - }} - className="size-full" - /> - -
- - {showCheckJsonButton || errorMessage ? ( -
- {showCheckJsonButton ? ( - - ) : ( -

- {errorMessage} -

- )} -
- ) : null} -
-
-
+ + {renderInstructions()} + + + + {renderOutputTextArea()} + + + ) : ( +
+ {renderInstructions()} + {renderOutputTextArea()} +
+ )}
); - }, [ - showSSMSInfoDialog, - databaseEdition, - databaseType, - errorMessage, - scriptResult, - setDatabaseEdition, - t, - isDesktop, - showCheckJsonButton, - isCheckingJson, - handleCheckJson, - effectiveTheme, - debouncedHandleInputChange, - importMethod, - setImportMethod, - ]); + }, [renderOutputTextArea, renderInstructions, isDesktop]); const renderFooter = useCallback(() => { return ( diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx index 00c2dfbe..7d11fd7e 100644 --- a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx +++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx @@ -152,7 +152,7 @@ export const CreateDiagramDialog: React.FC = ({ }} > {step === CreateDiagramDialogStep.SELECT_DATABASE ? (