diff --git a/webapp/packages/plugin-info/.gitignore b/webapp/packages/plugin-help/.gitignore similarity index 100% rename from webapp/packages/plugin-info/.gitignore rename to webapp/packages/plugin-help/.gitignore diff --git a/webapp/packages/plugin-info/package.json b/webapp/packages/plugin-help/package.json similarity index 97% rename from webapp/packages/plugin-info/package.json rename to webapp/packages/plugin-help/package.json index 61974e0217..6c66b2f746 100644 --- a/webapp/packages/plugin-info/package.json +++ b/webapp/packages/plugin-help/package.json @@ -1,5 +1,5 @@ { - "name": "@cloudbeaver/plugin-info", + "name": "@cloudbeaver/plugin-help", "sideEffects": false, "version": "0.1.0", "description": "", diff --git a/webapp/packages/plugin-info/src/Info.tsx b/webapp/packages/plugin-help/src/Info.tsx similarity index 100% rename from webapp/packages/plugin-info/src/Info.tsx rename to webapp/packages/plugin-help/src/Info.tsx diff --git a/webapp/packages/plugin-info/src/LocaleService.ts b/webapp/packages/plugin-help/src/LocaleService.ts similarity index 100% rename from webapp/packages/plugin-info/src/LocaleService.ts rename to webapp/packages/plugin-help/src/LocaleService.ts diff --git a/webapp/packages/plugin-info/src/PluginBootstrap.ts b/webapp/packages/plugin-help/src/PluginBootstrap.ts similarity index 100% rename from webapp/packages/plugin-info/src/PluginBootstrap.ts rename to webapp/packages/plugin-help/src/PluginBootstrap.ts diff --git a/webapp/packages/plugin-info/src/Shortcuts/IShortcut.ts b/webapp/packages/plugin-help/src/Shortcuts/IShortcut.ts similarity index 74% rename from webapp/packages/plugin-info/src/Shortcuts/IShortcut.ts rename to webapp/packages/plugin-help/src/Shortcuts/IShortcut.ts index 52ded6b7f6..83a79c7ee8 100644 --- a/webapp/packages/plugin-info/src/Shortcuts/IShortcut.ts +++ b/webapp/packages/plugin-help/src/Shortcuts/IShortcut.ts @@ -8,13 +8,7 @@ import type { TLocalizationToken } from '@cloudbeaver/core-localization'; -export interface IShortcutBody { - code: string; - and?: IShortcutBody; - or?: IShortcutBody; -} - export interface IShortcut { label: TLocalizationToken; - body: IShortcutBody; + code: string[]; } \ No newline at end of file diff --git a/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts b/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts new file mode 100644 index 0000000000..cd66ec14ca --- /dev/null +++ b/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts @@ -0,0 +1,63 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2022 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +import type { IShortcut } from './IShortcut'; + +export const DATA_VIEWER_SHORTCUTS: IShortcut[] = [ + { + label: 'data_viewer_shortcut_start_inline_editing', + code: ['Enter', 'Backspace'], + }, + { + label: 'data_viewer_shortcut_add_new_row', + code: ['Alt + Insert'], + }, + { + label: 'data_viewer_shortcut_duplicate_row', + code: ['Ctrl + Alt + Insert'], + }, + { + label: 'data_viewer_shortcut_delete_row', + code: ['Delete'], + }, + { + label: 'data_viewer_shortcut_revert_inline_editor_changes', + code: ['Escape'], + }, + { + label: 'data_viewer_shortcut_past_value', + code: ['Ctrl + V'], + }, + { + label: 'data_viewer_shortcut_copy_value', + code: ['Ctrl + C'], + }, +]; + +export const SQL_EDITOR_SHORTCUTS: IShortcut[] = [ + { + label: 'sql_editor_shortcut_execute_statement', + code: ['Ctrl + Enter'], + }, + { + label: 'sql_editor_shortcut_execute_statement_new_tab', + code: ['Ctrl + \\', 'Ctrl + Shift + Enter'], + }, + { + label: 'sql_editor_shortcut_execute_script', + code: ['Alt + X'], + }, + { + label: 'sql_editor_shortcut_show_execution_plan', + code: ['Shift + Ctrl + E'], + }, + { + label: 'sql_editor_shortcut_open_editor_in_new_tab', + code: ['Alt + T'], + }, +]; \ No newline at end of file diff --git a/webapp/packages/plugin-info/src/Shortcuts/ShortcutBody.tsx b/webapp/packages/plugin-help/src/Shortcuts/Shortcut.tsx similarity index 51% rename from webapp/packages/plugin-info/src/Shortcuts/ShortcutBody.tsx rename to webapp/packages/plugin-help/src/Shortcuts/Shortcut.tsx index 0c2e991cf6..a87fcbfedc 100644 --- a/webapp/packages/plugin-info/src/Shortcuts/ShortcutBody.tsx +++ b/webapp/packages/plugin-help/src/Shortcuts/Shortcut.tsx @@ -11,10 +11,10 @@ import styled, { css } from 'reshadow'; import { useTranslate } from '@cloudbeaver/core-localization'; import { composes, useStyles } from '@cloudbeaver/core-theming'; -import type { IShortcutBody } from './IShortcut'; +import type { IShortcut } from './IShortcut'; interface Props { - body: IShortcutBody; + shortcut: IShortcut; } const style = composes( @@ -24,7 +24,15 @@ const style = composes( } `, css` - shortcut-body { + shortcut-container { + display: flex; + align-items: center; + justify-content: space-between; + } + shortcut-label { + margin-right: 8px; + } + shortcut-content { display: flex; align-items: center; gap: 4px; @@ -43,27 +51,27 @@ const style = composes( } `); -export const ShortcutBody: React.FC = function ShortcutBody({ body }) { +export const Shortcut: React.FC = function Shortcut({ shortcut }) { const translate = useTranslate(); - const styles = useStyles(style); - return styled(styles)( - - - {body.code} - - {body.and && ( - <> - + - - - )} - {body.or && ( - <> - {translate('ui_or')} - - - )} - + return styled(useStyles(style))( + + + {translate(shortcut.label)} + + + {shortcut.code.map((code, index, array) => { + const next = !!array[index + 1]; + return ( + <> + + {code} + + {next && {translate('ui_or')}} + + ); + })} + + ); }; \ No newline at end of file diff --git a/webapp/packages/plugin-info/src/Shortcuts/ShortcutsDialog.tsx b/webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx similarity index 100% rename from webapp/packages/plugin-info/src/Shortcuts/ShortcutsDialog.tsx rename to webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx diff --git a/webapp/packages/plugin-info/src/index.ts b/webapp/packages/plugin-help/src/index.ts similarity index 100% rename from webapp/packages/plugin-info/src/index.ts rename to webapp/packages/plugin-help/src/index.ts diff --git a/webapp/packages/plugin-info/src/locales/en.ts b/webapp/packages/plugin-help/src/locales/en.ts similarity index 100% rename from webapp/packages/plugin-info/src/locales/en.ts rename to webapp/packages/plugin-help/src/locales/en.ts diff --git a/webapp/packages/plugin-info/src/locales/it.ts b/webapp/packages/plugin-help/src/locales/it.ts similarity index 100% rename from webapp/packages/plugin-info/src/locales/it.ts rename to webapp/packages/plugin-help/src/locales/it.ts diff --git a/webapp/packages/plugin-info/src/locales/ru.ts b/webapp/packages/plugin-help/src/locales/ru.ts similarity index 100% rename from webapp/packages/plugin-info/src/locales/ru.ts rename to webapp/packages/plugin-help/src/locales/ru.ts diff --git a/webapp/packages/plugin-info/src/locales/zh.ts b/webapp/packages/plugin-help/src/locales/zh.ts similarity index 100% rename from webapp/packages/plugin-info/src/locales/zh.ts rename to webapp/packages/plugin-help/src/locales/zh.ts diff --git a/webapp/packages/plugin-info/src/manifest.ts b/webapp/packages/plugin-help/src/manifest.ts similarity index 95% rename from webapp/packages/plugin-info/src/manifest.ts rename to webapp/packages/plugin-help/src/manifest.ts index f1196de74b..7fdc69a18a 100644 --- a/webapp/packages/plugin-info/src/manifest.ts +++ b/webapp/packages/plugin-help/src/manifest.ts @@ -13,7 +13,7 @@ import { PluginBootstrap } from './PluginBootstrap'; export const manifest: PluginManifest = { info: { - name: 'Info plugin', + name: 'Help plugin', }, providers: [ diff --git a/webapp/packages/plugin-info/tsconfig.json b/webapp/packages/plugin-help/tsconfig.json similarity index 100% rename from webapp/packages/plugin-info/tsconfig.json rename to webapp/packages/plugin-help/tsconfig.json diff --git a/webapp/packages/plugin-info/src/Shortcuts/SHORTCUTS_DATA.ts b/webapp/packages/plugin-info/src/Shortcuts/SHORTCUTS_DATA.ts deleted file mode 100644 index 47e8429997..0000000000 --- a/webapp/packages/plugin-info/src/Shortcuts/SHORTCUTS_DATA.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2022 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ - -import type { IShortcut } from './IShortcut'; - -export const DATA_VIEWER_SHORTCUTS: IShortcut[] = [ - { - label: 'data_viewer_shortcut_start_inline_editing', - body: { - code: 'Enter', - or: { - code: 'Backspace', - }, - }, - }, - { - label: 'data_viewer_shortcut_add_new_row', - body: { - code: 'Alt', - and: { - code: 'Insert', - }, - }, - }, - { - label: 'data_viewer_shortcut_duplicate_row', - body: { - code: 'Ctrl', - and: { - code: 'Alt', - and: { - code: 'Insert', - }, - }, - }, - }, - { - label: 'data_viewer_shortcut_delete_row', - body: { - code: 'Delete', - }, - }, - { - label: 'data_viewer_shortcut_revert_inline_editor_changes', - body: { - code: 'Escape', - }, - }, - { - label: 'data_viewer_shortcut_past_value', - body: { - code: 'Ctrl', - and: { - code: 'V', - }, - }, - }, - { - label: 'data_viewer_shortcut_copy_value', - body: { - code: 'Ctrl', - and: { - code: 'C', - }, - }, - }, -]; - -export const SQL_EDITOR_SHORTCUTS: IShortcut[] = [ - { - label: 'sql_editor_shortcut_execute_statement', - body: { - code: 'Ctrl', - and: { - code: 'Enter', - }, - }, - }, - { - label: 'sql_editor_shortcut_execute_statement_new_tab', - body: { - code: 'Ctrl', - and: { - code: '\\', - }, - or: { - code: 'Ctrl', - and: { - code: 'Shift', - and: { - code: 'Enter', - }, - }, - }, - }, - }, - { - label: 'sql_editor_shortcut_execute_script', - body: { - code: 'Alt', - and: { - code: 'X', - }, - }, - }, - { - label: 'sql_editor_shortcut_show_execution_plan', - body: { - code: 'Shift', - and: { - code: 'Ctrl', - and: { - code: 'E', - }, - }, - }, - }, - { - label: 'sql_editor_shortcut_open_editor_in_new_tab', - body: { - code: 'Alt', - and: { - code: 'T', - }, - }, - }, -]; \ No newline at end of file diff --git a/webapp/packages/plugin-info/src/Shortcuts/Shortcut.tsx b/webapp/packages/plugin-info/src/Shortcuts/Shortcut.tsx deleted file mode 100644 index b6f60588d6..0000000000 --- a/webapp/packages/plugin-info/src/Shortcuts/Shortcut.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2022 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ - -import styled, { css } from 'reshadow'; - -import { useTranslate } from '@cloudbeaver/core-localization'; - -import type { IShortcut } from './IShortcut'; -import { ShortcutBody } from './ShortcutBody'; - -interface Props { - shortcut: IShortcut; -} - -const style = css` - shortcut-container { - display: flex; - align-items: center; - justify-content: space-between; - } - shortcut-label { - margin-right: 8px; - } -`; - -export const Shortcut: React.FC = function Shortcut({ shortcut }) { - const translate = useTranslate(); - - return styled(style)( - - - {translate(shortcut.label)} - - - - ); -}; \ No newline at end of file diff --git a/webapp/packages/product-default/src/index.ts b/webapp/packages/product-default/src/index.ts index fbff9cc513..11367ef31d 100644 --- a/webapp/packages/product-default/src/index.ts +++ b/webapp/packages/product-default/src/index.ts @@ -14,7 +14,7 @@ import spreadsheetNew from '@cloudbeaver/plugin-data-spreadsheet-new'; import dataViewer from '@cloudbeaver/plugin-data-viewer'; import ddlViewer from '@cloudbeaver/plugin-ddl-viewer'; import gisViewer from '@cloudbeaver/plugin-gis-viewer'; -import info from '@cloudbeaver/plugin-info'; +import help from '@cloudbeaver/plugin-help'; import localization from '@cloudbeaver/plugin-localization'; import objectViewer from '@cloudbeaver/plugin-object-viewer'; import productPlugin from '@cloudbeaver/plugin-product'; @@ -56,7 +56,7 @@ const PLUGINS: PluginManifest[] = [ productPlugin, settingsMenu, settingsMenuAdministration, - info, + help, ]; bootstrap(PLUGINS);